![]() |
MERIS IDL General Purpose Tools |
Issue 2.1 August 2001 |
Last modified: Wed Aug 22 15:11:47 2001.
NAME:
ALTER_PCK
PURPOSE:
alter a packet structure - used to check FLAG_PCK
CATEGORY:
I/O
CALLING SEQUENCE:
status=ALTER_PCK(struct)
INPUTS:
packet struct holding at least the packet header (refer to the
RD_HEADER description for a full list of tags needed)
OPTIONAL INPUTS:
OUTUNIT - specifies the output file unit to which all comments
will be written, if not specified then comments are
written on the IDL standard output stream.
KEYWORD PARAMETERS:
VERBOSE - sets the verbose mode ON
OUTPUTS:
status - return status specifying WHERE the altering stopped
OPTIONAL OUTPUTS:
None
COMMON BLOCKS:
None
SIDE EFFECTS:
Unknown
RESTRICTIONS:
Unknown
PROCEDURE:
EXAMPLE:
filename='/megs_aux/Mescal/mescal.1.3/SCal/inputs/MER_CA__0P_White'
pcks=RD_PACK(filename,/VERBOSE,/DFH)
struct=ALTER_PCK(pcks.head)
MODIFICATION HISTORY:
Created August 2000 by Vincent Fournier-Sicre - vfs@acri.fr
(See $IDL_LOCAL\Meris\rd_pack.pro)
NAME:
CHECK_TAGS
PURPOSE:
checks the presence of given tags in a string array
CATEGORY:
CALLING SEQUENCE:
res=CHECK_TAGS(str_names,OUTUNIT=outunit,/PHD,/DFH,/ALLDFH)
INPUTS:
names - string array
OPTIONAL INPUTS:
outunit - output text stream, if not set then all mesages are
written on the standard output stream
KEYWORD PARAMETERS:
No combination of the following keyword should be used
simultaneously and at least one keyword should be used.
PHD - if set, then only Packet Header tags are tested
DFH - if set, then Data Field Header tags until field
"FormatDef" are tested
ALLDFH - if set then all tags of Data Field Header are tested
OUTPUTS:
0 if a field is missing and 1 otherwise
OPTIONAL OUTPUTS:
None
COMMON BLOCKS:
None
SIDE EFFECTS:
Unknown
RESTRICTIONS:
None
PROCEDURE:
EXAMPLE:
MODIFICATION HISTORY:
Created August 2000 by Vincent Fournier-Sicre - vfs@acri.fr
(See $IDL_LOCAL\Meris\rd_pack.pro)
NAME:
FLAG_PCK
PURPOSE:
check the packeting sequence of a packet array
CATEGORY:
I/O
CALLING SEQUENCE:
status=FLAG_PCK(head,OUTUNIT=outunit,/VERBOSE)
INPUTS:
head - structure (see RD_HEADER documentation for tag list)
OPTIONAL INPUTS:
OUTUNIT - specifies the output file unit to which all comments
will be written, if not specified then comments are
written on the IDL standard output stream.
KEYWORD PARAMETERS:
VERBOSE - sets the verbose mode ON
OUTPUTS:
status - code specifying the checking level:
-1: Nothing could be checked
1: Only the Packet Header could be checked
2: Packet Header + fields until "Number" could be checked
in the Data Field Header
3: Packet Header + Data Field Header could be checked
OPTIONAL OUTPUTS:
None
COMMON BLOCKS:
None
SIDE EFFECTS:
Unknown
RESTRICTIONS:
The input structure must hold the proper tags.
PROCEDURE:
EXAMPLE:
filename='/megs/megs.4.3/catalogues/l0_rr/l0_rr_pacific_30.prd'
pcks=RD_PACK(filename,/VERBOSE)
help,pcks.head,/structure
result=FLAG_PCK(pcks.head)
OPENW,outunit,'~/log.txt',/GET_LUN
pcks=RD_PACK(filename,OUTUNIT=outunit,/VERBOSE)
result=FLAG_PCK(pcks.head,OUTUNIT=outunit)
FREE_LUN,outunit
MODIFICATION HISTORY:
Created August 2000 by Vincent Fournier-Sicre - vfs@acri.fr
(See $IDL_LOCAL\Meris\flag_pck.pro)
NAME:
RD_HEADER
PURPOSE:
decodes the header part of the MERIS packets.
CATEGORY:
I/O
CALLING SEQUENCE:
struct=RD_HEADER(header_bytes)
INPUTS:
header_bytes - 2-dimensional byte array with at least 292 and
a number of lines that may be variable.
OPTIONAL INPUTS:
None
KEYWORD PARAMETERS:
VERBOSE - sets the verbose mode ON
OUTPUTS:
Structure w/ the following tags :
N_records - Number of records found in the array of
bytes passed to this function ; beware : the
number of records is differet from the
number of frames, a frame is a multi-band
array WHEREas WHEREas a record in a set of
packets is valid for one single band.
status - ULONG array used for analysis
========== Packet Header ==============================
pacver - Packet format version number
pactyp - Packet type
dhflag - Data field header flag
apid - APID code
Seg_Flag - Segment flag
pc - Packet counter or source sequence count (0..16383)
Pk_Length - Packet length (header + data)
========== Data Field Header ==========================
DFH_Len - Data Field Header length
ModeFormat - Instrument Mode /Format
obt - On Board Time
red_vec - Redundancy Vector
FirstRow - Band definition: index of its first CCD row
nrows - Band definition: number of CCD rows of the band
GainSet - Gain settings array
number - Band definition: band number (1 to 15, 0 for smear band)
mband - Band definition: number of micro-bands
FormatDef - Format Definition
========== Remaining of Data Field Header ==========================
blank - Blank pixel data
coarse - Coarse offsets
Aij - Ref. Aij coefficients (PER BAND SINCE VERSION V3.0)
Kbm - Smear correction factors
Fov - Field Of View
N_dark - Number of frames for dark calibration
N_gain - Number of frames for gain calibration
N_ave - Number of frames for average
Abm - Averaged Gain
OPTIONAL OUTPUTS:
None
COMMON BLOCKS:
None
SIDE EFFECTS:
None
RESTRICTIONS:
The packet format description that has been used is described
in document "MERSS Description of Sub-Models" -
PO-RS-ACR-SY-0001 Issue 6 Revision 0
PROCEDURE:
EXAMPLE:
This function is called by RD_PACK and should not be used by itself.
MODIFICATION HISTORY:
Created June 2000 by Vincent Fournier-Sicre - vfs@acri.fr
Oct 4 2000 - added Abm tag in output structure
(See $IDL_LOCAL\Meris\rd_pack.pro)
NAME:
RD_PACK
PURPOSE:
retrieves packets from a level 0 product
CATEGORY:
I/O
CALLING SEQUENCE:
packets=RD_PACK(filename,/DATA,/PH,/DFH,/ALLDFH,/PACKET,/VERBOSE,FRAMES=frames)
INPUTS:
filename - MERIS L0 product file ; if not specified than a
dialog box appears to have the user scan the
directories to chose a file.
OPTIONAL INPUTS:
OUTUNIT - specifies the output file unit to which all comments
will be written, if not specified then comments are
written on the IDL standard output stream.
FRAMES - one-dimensional integer array holding number
(starting from 0) of frames to be retrieved ; if not
set than all frames are retrieved.
KEYWORD PARAMETERS:
VERBOSE - sets the verbose mode ON
PH - if set then only Packet Header is retrieved
DFH - if set then Data Field Header until (and including)
the "FormatDef" field is retrieved (default mode)
ALLDFH - if set then Full Data Field Header is retrieved
DATA - if set then data parts of the packets are also
retrieved (by default only the Packet Header is
retrieved) and the entire header is also retrieved
(and not only the "Packet Header" part of the header
PACKET - if set then the data packet structure is preserved;
otherwise it is re-organized as multi-band frames; this keyword
is only effective if DATA is also set.
OUTPUTS:
If no problem occured then returns
a structure holding the following tags :
filename - file from which data has been retrieved
head - for the full description of this tag refer to the
description of the RD_HEADER function.
data - multi-dimensional array
otherwise returns a negative integer.
OPTIONAL OUTPUTS:
None
COMMON BLOCKS:
None
SIDE EFFECTS:
Unknown
RESTRICTIONS:
Unknown
PROCEDURE:
retrieved the record offset w/ the RD_PROD function
then retrieves each record from the L0 product file
then calls RD_HEADER
then, id needed, reorganizes binary data
and finally builds the output structure
EXAMPLE:
pcks=RD_PACK()
filename='/megs/megs.4.3/catalogues/l0_rr/l0_rr_pacific_30.prd'
pcks=RD_PACK(filename)
pcks=RD_PACK(filename,/PH)
pcks=RD_PACK(filename,/DFH)
pcks=RD_PACK(filename,/ALLDFH)
pcks=RD_PACK(filename,/DATA)
pcks=RD_PACK(filename,FRAMES=[0,15,14,28])
pcks=RD_PACK(filename,FRAMES=[0,15,14,28],/DATA)
pcks=RD_PACK(filename,FRAMES=[0,15,14,28],/DATA,/PACKET)
filename='/megs/megs.4.3/catalogues/l0_rr/l0_rr_pacific_30.prd'
OPENW,outunit,'~/log.txt',/GET_LUN
pcks=RD_PACK(filename,OUTUNIT=outunit,/VERBOSE)
FREE_LUN,outunit
MODIFICATION HISTORY:
Created June 2000 by Vincent Fournier-Sicre - vfs@acri.fr
Modified Feb 2001 by LB to allow reading FR/CAL L0 products
(N_pix & Data_length are resolution dependant)
Modified Apr 2001 by LB to use common resources (e.g. rd_prdname)
May 2001 - replaced NUM_DFH by DFH, and created ALLDFH keyword - vfs@acri-st.fr
(See $IDL_LOCAL\Meris\rd_pack.pro)
NAME:
SHOW_SEQ
PURPOSE:
writes on the standard output stream infos about the packet sequencing
CATEGORY:
CALLING SEQUENCE:
INPUTS:
OPTIONAL INPUTS:
KEYWORD PARAMETERS:
OUTPUTS:
OPTIONAL OUTPUTS:
COMMON BLOCKS:
SIDE EFFECTS:
RESTRICTIONS:
PROCEDURE:
EXAMPLE:
MODIFICATION HISTORY:
Created November 2000 by Vincent Fournier-Sicre - vfs@acri.fr
(See $IDL_LOCAL\Meris\show_seq.pro)
NAME:
SHOW_STATUS
PURPOSE:
specifies the different meanings of an internal error code
CATEGORY:
Input/Output
CALLING SEQUENCE:
str=SHOW_STATUS(status)
INPUTS:
status - hexadecimal value
OPTIONAL INPUTS:
None
KEYWORD PARAMETERS:
None
OUTPUTS:
str - string array holding error messages
OPTIONAL OUTPUTS:
None
COMMON BLOCKS:
None
SIDE EFFECTS:
Unknown
RESTRICTIONS:
This function is called from IDENTIFY_SEQ and it is not recommended
to use it from another function.
PROCEDURE:
specified internal hexadecimal codes are tested (err AND hex_code)
and a new element is added to str whenever a new code is identified.
EXAMPLE:
status='0001'X+'0002'X+'0004'X
str=SHOW_STATUS(status)
print,str
MODIFICATION HISTORY:
Created October 2000 by Vincent Fournier-Sicre - vfs@acri.fr
(See $IDL_LOCAL\Meris\rd_pack.pro)
NAME:
STR_APID
PURPOSE:
Returns the meaning of an APID given as a hexadecimal code.
CATEGORY:
I/O
CALLING SEQUENCE:
str=STR_APID(apid)
INPUTS:
apid - hexadecimal code
OPTIONAL INPUTS:
None
KEYWORD PARAMETERS:
None
OUTPUTS:
String scalar giving the meaning of the APID in words.
OPTIONAL OUTPUTS:
None
COMMON BLOCKS:
None
SIDE EFFECTS:
Unknown
RESTRICTIONS:
None
PROCEDURE:
Compares the APID to possible APID hex codes through a CASE
statement and identifies the proper one.
EXAMPLE:
str=STR_APID('0A4'X)
print,str
MODIFICATION HISTORY:
Created August 2000 by Vincent Fournier-Sicre - vfs@acri.fr
(See $IDL_LOCAL\Meris\rd_pack.pro)
NAME:
VISUAL_SEQ
PURPOSE:
visualizes on a graphical display the packets sequencing
CATEGORY:
graphics
CALLING SEQUENCE:
res=VISUAL_SEQ(segment_arr)
INPUTS:
segment_arr - structure array holding infos for all segments
OPTIONAL INPUTS:
None
KEYWORD PARAMETERS:
None
OUTPUTS:
error code different from 0 if problem occured
OPTIONAL OUTPUTS:
None
COMMON BLOCKS:
None
SIDE EFFECTS:
Unknown
RESTRICTIONS:
None
PROCEDURE:
EXAMPLE:
MODIFICATION HISTORY:
Created November 2000 by Vincent Fournier-Sicre - vfs@acri.fr
(See $IDL_LOCAL\Meris\show_seq.pro)