Documentation for /home/davin/idl/socware/

Generated by IDLdoc

single page | use frames     summary     class     fields     routine details     file attributes

projects/maven/mag/

maven_mag_pkts_read.pro


*NAME: maven_mag_pkts_read *PURPOSE: Read the MAVEN MAG data. Formats handled are from - instrument, - engineering packet from University of California at Berkeley Particle and Fields Package (PFP) DPU, - science packets (multiple formats) from PFP DPU, and - CCSDS format from spacecraft (available via LASP SDC). *CALLING SEQUENCE: maven_mag_pkts_read,filename,data,data_source, $ input_path=input_path,verbose=verbose *PARAMETERS: filename (required) (input) (string) (scalar) Input filename - without path. data (required) (output) (structure) (array) Data in a array of structures. One array entry per packet. data_source (required) (input) (scalar) (string) Describes the source os the data file. 'instrument' - from the instrument, no PFP or spacecraft in path 'pfp_eng' - engineering data via the PFP DPU which includes the PFP header 'pfp_sci' - science data via the PFP DPU which includes the PFP header 'ccsds' - data from the spacecraft which includes the CCSDS and PFP headers input_path (keyword) (input) (string) (scalar) Path to input file. verbose (keyword) (input) (integer) (scalar) Set to have additional output to screen. *EXAMPLES: pfp_input_path = '/data4/maven/data/ucb/' file26 = 'APID_26.dat' maven_mag_pkts_read,file26,data26,'pfp_eng', $ input_path=pfp_input_path,/verbose file40 = 'APID_40.dat' maven_mag_pkts_read,file40,data40,'pfp_sci', $ input_path=pfp_input_path,/verbose file40avg = 'APID_40_avg2.dat' maven_mag_pkts_read,file40avg,data40avg,'pfp_sci', $ input_path=pfp_input_path input_path = '/home/magdata/maven/data/flight/telemetry/sci/mag/l0/' file = 'mvn_mag_svy_l0_20131205_v2.dat' maven_mag_pkts_read,file,data,'ccsds',input_path=input_path *SYSTEM VARIABLES USED: none *INTERACTIVE INPUT: none *SUBROUTINES CALLED: parsestr marker_search bitlis decom_2s_complement checksum_16bits *FILES USED: File given in input parameters. *SIDE EFFECTS: none *RESTRICTIONS: assumes data in input files is - all from the instrument, or - all engineering via PFP DPU (ApIds 26 and 27), or - all science via PFP DPU (ApIds 40, 41, 42, and 43), or - from the spacecraft with CCSDS and PFP headers. ApId 30 (passthru) not coded for Maximum of 550,000 packets per file currently permitted. *NOTES: PFP MAG engineering checksum only uses MAG portion PFP MAG science checksum uses PFP header and MAG portion Which MAG sensor is which: OB is FM1; on +Y; SSN #5; PFP APID 26 (engr), 40, 42; Drive select 0 IB is FM2; on -Y; SSN #6; PFP APID 27 (engr), 41, 43; Drive select 3 PFP test setup at SSL is EM; SSN #1 Message ID not modified by PFP FSW - not to be used to determine packet type Problems - message ids not as expected for PFP packets - decom id not as expected for engr pkt (set to 0 not expected 1) - no PFP ApID 30 data (passthru) *PROCEDURE: - determine input path to use - make sure input file exists - setup useful values and structures - read until end of file - or not enough bytes left - for the first (index 0) packet, calculate estimated number of packets - if CCSDS source, decome that header - if data via PFP DPU, decom the PFP header - if not a MAG packet, skip - if a MAG science packet, include the PFP header in the MAG checksum calculation - decom the MAG data header - failed_flag set to 1 if values are not as expected - decom the MAG engineering data (if not a science data packet) - decom MAG science data (if not an engineering packet) - decom MAG checksum and verify value - for instrument packet, last bit will always be 0 - if engineering data via PFP DPU, decom extra bytes - if CCSDS packet, decom CCSDS checksum (not being checked) - if falied_flag is set, find next packet - after file is read, save only entries that have data *MODIFICATION HISTORY: 30 Mar 2012 PJL started writing 26 Apr 2012 PJL continued 27 Apr 2012 PJL continued 8 May 2012 PJL determined that message ids in UCB supplied data and not as expected; change code to check second 9 May 2012 byte to determine type - perfer to use message id - will need to rework after data is corrected 18 May 2012 PJL might be able to handle muplitple UCB ApIds in one file now - not tested Feb 2013 PJL added CCSDC header; more of UCB header 24 May 2013 PJL add code to skip bytes if PFP, but not MAG pkt 13 Mar 2013 PJL add check for if marker_search found additional data; before each readu, check that there are enough bytes remaining 24 May 2013 PJL skip data that is not MAG data 29 May 2013 PJL corrected data subseting at end (0.4.1) 19 Jun 2013 PJL handle headers with no or only time data 19 Jul 2013 PJL added check of source 2 if hex to determine source is an 'else' (still need to code marker_search) 22 Jul 2013 PJL rearranged failed flag code; handle sync pattern not found 15 Oct 2013 PJL handle CCSDS length of 0 bytes; set the marker_search after_byte based on expected packet type (0.4.5) 27 Nov 2013 PJL data_source as input instead of trying to determine 29 Nov 2013 PJL adding MAG data checksum check (works for engineering data, but not for science data); engineering tags renamed 'z' replaced with 'e' for 8p2vp, 8p2vn, 13vp, 13vn, 11p4v, 2p5vp, and 3p3vp 02 Dec 2013 PJL reformat help print 04 Dec 2013 PJL finally understand PFP MAG science packet checksum 06 Dec 2013 PJL ucb_ changed to pfp_; rename pfp_extra_engr to pfp_engr; decom pfp_engr; data_type (unused) replaced with source; replaced apid with apid_hex; added apid (decimal); clean up; additional notes; additional checks for failed cases (0.4.7) 11 Dec 2013 PJL messaage ids will not be fixed - remove messages that assumes they will; cross check serial number, drive value, and PFP apid; passthru (PFP Apid 0x30) code commented out (no data to test; handle direct from instrument (last bit always zero) checksum verification correctly; updated prolog (0.5) 20 Dec 2013 PJL compare pkt_type and difference flags - if not correct match, set failed flag 11 Mar 2014 PJL changed MAVEN spacecraft number from 202 to -202 18 Mar 2014 PJL correct difference words (skip first difference since all zeros and use next 63)

Routines

top source maven_mag_pkts_read

maven_mag_pkts_read, filename, data, data_source, input_path=input_path, verbose=verbose

Parameters

filename
data
data_source

Keywords

input_path
verbose

File attributes

Modification date: Mon Jun 9 05:59:00 2014
Lines: 1,208