![]() |
ACRIST MERIS Tools |
Last modified: Wed Dec 05 10:45:16 2001.
NAME:
COMPARE
PURPOSE:
Compares fields between two *.BAF files.
CATEGORY:
Input/Output
CALLING SEQUENCE:
COMPARE,FILE1=file1,FILE2=file2,fields=fields,ZONE=zone,DIFF_FIELDS=diff_fields
INPUTS:
All inputs are passed using keyword parameters.
OPTIONAL INPUTS:
None
KEYWORD PARAMETERS:
FILE1 - filename of first file
FILE2 - filename of second file
FIELDS - string array specifying the fields to check, if not
set than all fields are compared.
ZONE - 4 integer array specifying the zone to check
(ZONE=[X0,Y0,X1,Y1]) where the pixel coordinates are
given wrt the global line/column pixel
coordinates. If this keyword is not set than the
entire image is compared.
OUTPUTS:
None
OPTIONAL OUTPUTS:
DIFF_FIELDS - string array giving, among the fields that are
checked, the fields that differ between the two
files.
DIFF_STATS - 5-column array giving statistics for all the fields
that differ between the 2 files. The 5 values are
respectively for the region Of Interest:
number of pixels that differ
maximum difference
minimum difference
mean difference
stddev difference
COMMON BLOCKS:
None
SIDE EFFECTS:
Unknown
RESTRICTIONS:
RD_BAF.PRO must be compiled before using this function. If the
FIELDS keyword is not set then it is highly recommended to compare
*.BAF files of same type (i.e both int_s1 file types).
PROCEDURE:
retrieves field names from file1, then in sequence retrieves
each field from both files on the Region Of Interest and compares them.
EXAMPLE:
file1='/megs/megs.4.3/folders/test/case1_30_copy/files/int_s1l2.baf'
file2='/u7/lb/Meris/gmv/case1_30_int_s1l2.baf'
fields=['view_zenith']
zone=[609,1,703,63]
zone=[608,0,704,64]
COMPARE,FILE1=file1,FILE2=file2,fields=fields,ZONE=zone
diff_fields=1
COMPARE,FILE1=file1,FILE2=file2,ZONE=zone,DIFF_FIELDS=diff_fields
COMPARE,FILE1=file1,FILE2=file2,ZONE=zone,DIFF_FIELDS=diff_fields,fields=['rho']
MODIFICATION HISTORY:
Created by Vincent Fournier-Sicre - vfs@acri-st.fr - 23 October 2000
(See $IDL_LOCAL\Meris\compare.pro)
NAME:
RD_ANNOT
PURPOSE:
retrieves the geometry from a MERIS product file (L1b or L2)
CATEGORY:
INPUT/OUTPUT
CALLING SEQUENCE:
struct=rd_annot(PRDFILE=prdfile,/FULL)
INPUTS:
None (all inputs are passed to the function using keyword)
OPTIONAL INPUTS:
None
KEYWORD PARAMETERS:
PRDFILE - scalar string holding filename of MERIS product
PARAM - list of fields to retrieve ; if PARAM is not specified
then all annotations are retrieved.
FULL - if set then the geometry for all pixels is computed using bilinear
interpolations,and annotations are computed for all pixels.
OUTPUTS:
struct - structure w/ holding 2-dimensional arrays for
annotations; the full list of possible tags is the
following: 'lat','lon','altitude','roughness',
'latitude_corr','longitude_corr','sun_zenith','view_zenith',
'sun_azimuth','view_azimuth','delta_azimuth',
'windu','windv','windm','pressure','ozone','humidity'
OPTIONAL OUTPUTS:
NA
COMMON BLOCKS:
NA
SIDE EFFECTS:
None
RESTRICTIONS:
None
PROCEDURE:
Reads the MERIS product header to define the resolution and level of the product,
retrieveds geometry annotations on tue-points using the "rd_prod" function,
expands the geometry on all pixels if the FULL keyword is set,
creates a structure holding all geometry variables.
EXAMPLE:
prdfile='/megs/megs.4.2/folders/sat_L02_4_2/pacific_30/files/l2_rr.prd'
prdfile='/megs/megs.4.3/folders/brockmann/poster_seine/files/l2_rr.prd'
geometry=rd_annot(PRDFILE=prdfile,/FULL)
MODIFICATION HISTORY:
created by Vincent Fournier-Sicre - vfs@acri.fr - December 1999
19 Jan. 2001 - vfs - uses FILE_TEST to test file existence
(See $IDL_LOCAL\Meris\rd_annot.pro)
NAME:
RD_BAF
PURPOSE:
reads data from a breakpoint/intermediate level 2 file
CATEGORY:
Input/Output
CALLING SEQUENCE:
s=rd_baf(FILENAME=filename,PARAM=['param1','param2','param3'],ZONE=[x0,y0,x1,y1],/SPECTRAL_FIELDS)
INPUTS:
All inputs are passed with keyword parameters
OPTIONAL INPUTS:
None
KEYWORD PARAMETERS:
FILENAME - string scalar holding breakpoint/intermediate filename
PARAM - string array holding field keywords that need to be retrieved;
SPECTRAL_FIELDS - if set, then the returned structure holds for
each spectral field one tag per wavelength
ZONE - 4 elements integer array specifying the zone
from which you wish to retrieve data (ZONE=[X0,Y0,X1,Y1])
where X0,Y0,X1,Y1 are respectively column and line coordinates of
first and last pixels to retrieve wrt MERIS
global product coordinates. If the zone that
is passed to the function is larger than the
zone actually stored in the file or if it is
obviously falty than it is corrected and modified by the function.
OUTPUTS:
structure with tag names corresponding to field keywords passed to the function.
OPTIONAL OUTPUTS:
ZONE - zone becomes an optional output if it is passed to the
function but not initialized as a 4 integer array, in
this case it is updated by the function to output the
line/column coordinates of the zone that is actualy retrieved.
COMMON BLOCKS:
None
SIDE EFFECTS:
Unknown
RESTRICTIONS:
The breakpoint/intermediate file is entirely scanned for each
parameter that is retrieved ---> this should be improved
PROCEDURE:
The file is scanned for each parameter and whenever the field
keyword is identified, values are retrieved and stored in a structure.
EXAMPLE:
baffile='/megs/megs.4.3/folders/sat_l2/pacific_30/files/brk_s2l2.baf'
s=rd_baf(FILENAME=baffile,param=['aer'])
s=rd_baf(FILENAME=baffile,param=['tutu','fa','chl_1','aer'])
baffile='/megs/megs.4.3/folders/sat_l2/pacific_30/files/int_s1l2.baf'
s=rd_baf(FILENAME=baffile,param=['altitude'])
s=rd_baf(FILENAME=baffile,param=['rho'],/SPECTRAL_FIELDS)
file="/u7/lb/Meris/gmv/case1_30_int_s1l2.baf"
myparam="view_zenith"
zone=[608,0,704,64]
res_tds=rd_baf(FILENAME=file,PARAM=[myparam],ZONE=zone)
zone=1
res_tds=rd_baf(FILENAME=file,PARAM=[myparam],ZONE=zone)
MODIFICATION HISTORY:
Created by Vincent Fournier-Sicre - vfs@acri.fr - December 1999
added AREA optional output - Uwe Kraemer - 10/2000
corrected standard output comment when zone is set - vfs - 23/10/2000
modified x0,y0,x1,y1 computation when ZONE is set - vfs - 23/10/2000
displaced the area limits computation - vfs - 23/10/2000
replaced 32 & 64 by Width_Bloc-1 and Height_Bloc-1 - vfs - 23/10/2000
suppresion of the AREA tag in the output structure, the zone
keyword is updated instead - vfs - 24/10/2000
uses FILE_TEST function to test file existence - vfs - 19/01/2001
(See $IDL_LOCAL\Meris\rd_baf.pro)
NAME:
RD_LPROD
PURPOSE:
retrieves geophysical products from MERIS L1 or L2 products
CATEGORY:
INPUT/OUTPUT
CALLING SEQUENCE:
struct=rd_lprod(FILENAME=filename,PARAM=param,BAND=band,STRUCT=struct,DATABASE_DIR=database_dir)
INPUTS:
None
OPTIONAL INPUTS:
FILENAME - product filename
PARAM - string array specifying the fields to be extracted
The array may hold any of the following strings:
'TOAR' - Level 1 Top Of Atmosphere Radiances
'TOAR_###' - same as above for given wavelength (for exemple TOAR_412)
'L1FLAGS' - Level 1 product flags
'L2FLAGS' - Level 2 product flags
'RN1' - Normalised Surf. reflectances for L2 bands
'RN1_###' - same as above for given wavelength (for exemple RN1_412)
'CHL_1' - case1 CHL (in mg/m-3 ... NO LOG!) for water pixels (NAN otherwise)
'CHL_2' - case2 CHL (in mg/m-3 ... NO LOG!) for water pixels (NAN otherwise)
'SPM' - SPM (in g/m-3 ... NO LOG!) for water pixels (NAN otherwise)
'YS' - YS for water pixels (NAN otherwise)
'WVAP' - WATER VAPOUR
'TOAVI' - TOAVI for land pixels (NAN otherwise)
'BOAVI' - BOAVI for land pixels (NAN otherwise)
'PRES' - SURFACE PRESSURE for land pixels (NAN otherwise)
'PAR' - PAR for ocean pixels (NAN otherwise)
'C_ALB' - CLOUD ALBEDO for cloud pixels (NAN otherwise)
'EPSILON' - aerosol epsilon for land pixels (NAN otherwise)
'CLOUD_TAU' - CLOUD OPTICAL THIKNESS for cloud pixels (NAN otherwise)
'AERO_TAU' - AEROSOL OPTICAL THIKNESS for cloud pixels (NAN otherwise)
'CLOUD_TYPE' - TYPE OF CLOUD for cloud pixels (NAN otherwise)
'CTP' - CLOUD TOP PRESSURE for cloud pixels (NAN otherwise)
'RECT_RHO_IR' - Rectified infrared reflectance
'RECT_RHO_NIR' - Rectified near infrared reflectance
Note: this function is not case sensitive
(e.g. param=['TOAR'] and param=['tOaR'] will equally work)
STRUCT - In the case you need to add a parameter over a valid struct, do STRUCT=DATA
where data is the name of structure already built.
BAND - integer array specifying the bands to retrieve
([0-14] for L1 products and [0-12] for L2 products)
if not set then all bands are retrieved
DATABASE_DIR - sets the DATABASE_DIR environment variable
index_#.txa files must be under DATABASE_DIR
obsolete if IDL_LOCAL is set
KEYWORD PARAMETERS:
None
OUTPUTS:
structure holding possibly (if asked through the PARAM
keyword) the following tags :
TOAR_### - array w/ TOAR data for band specified by ###
L1FLAGS - array w/ L1FLAGS data
SPECTRAL_SHIFT - array w/ SPECTRAL_SHIFT data
L2FLAGS - array w/ L2FLAGS data
RN1_### - array w/ RN1 data for band specified by ###
CHL_1 - array w/ CHL_1 data
CHL_2 - array w/ CHL_2 data
SPM - array w/ SPM data
YS - array w/ YS data
WVAP - array w/ WVAP data
TOAVI - array w/ TOAVI data
BOAVI - array w/ BOAVI data
PRES - array w/ PRES data
PAR - array w/ PAR data
C_ALB - array w/ C_ALB data
EPSILON - array w/ EPSILON data
CLOUD_THICK - array w/ CLOUD_THICK data
AERO_THIC - array w/ AERO_THICK data
CLOUD_TYPE - array w/ TYPE data
CTP - array w/ CLOUD TOP PRESSURE data
RECT_RHO_IR - array w/ Rectified infrared reflectance
RECT_RHO_NIR - array w/ Rectified near infrared reflectance
OPTIONAL OUTPUTS:
None
COMMON BLOCKS:
None
RESTRICTIONS:
As some unsigned types did not exist in version 5.1 of IDL it
is preferable to use version 5.2 instead (like for
retrieveing L2 normalized water leaving reflectances that are
coded as unsigned short integers)
PROCEDURE:
It is the main function, and there are called other functions:
+ RD_PARAM()
- this function puts the results (geophysical result) into
a structure. This funct calles three sub-functions more with the following order:
+ RD_SCALED()
- computes the geophysical values using the count,
the scaling factor and the offset.
+ RD_MASK()
- the pixels that are classified (water-land-cloud) different
from what it is the product will be set to NAN value.
EXAMPLE:
filename='/h/pfcab/CPtools/data/l2_rr.prd'
filename='/u7/vfs/megs/level2/l2_rr_pacific30.prd'
DATA1=rd_lprod(filename=filename,param=['CHL_1','RN1'],band=['1','4'])
DATA2=rd_lprod(filename=filename,param=['SPM','BOAVI'],STRUCT=DATA1)
DATA2=rd_lprod(filename=filename,param=['TOAR','L1FLAGS'])
DATA2=rd_lprod(filename=filename,param=['TOAR_442','TOAR_665','L1FLAGS'])
MODIFICATION HISTORY:
written by Carolina Gabarro - November 1999 - car@acri.fr
Vincent Fourier-Sicre vfs@acri.fr
ACRI S.A.
19 Sep. 2000 - keyword ONLYFLAG suppressed - vfs
19 Sep. 2000 - keyword PCD suppressed - vfs
19 Sep. 2000 - keyword DATABASE_DIR added - vfs
19 Sep. 2000 - corrected bug for BAND keyword - vfs
19 Sep. 2000 - tag names are now checked and ignored if
invalid for product level- vfs
19 Sep. 2000 - band number checked when using BAND keyword
25 Apr. 2001 - released pointer memory ... (vfs)
(See $IDL_LOCAL\Meris\rd_lprod.pro)
NAME:
RD_MERIS
PURPOSE:
Launches a GUI interface to retrieve MERIS geophysical products.
CATEGORY:
Input/Output
CALLING SEQUENCE:
res=RD_MERIS(TLB=tlb,FILENAME=filename)
INPUTS:
None
OPTIONAL INPUTS:
None
KEYWORD PARAMETERS:
TLB - Top Level Base widget ID
FILENAME - MERIS filename
OUTPUTS:
A structure holding the different fields.
OPTIONAL OUTPUTS:
None
COMMON BLOCKS:
None
SIDE EFFECTS:
Unknown
RESTRICTIONS:
Only to be used through MERISVIEW!!!
info structure MUST exist!!!
PROCEDURE:
EXAMPLE:
s=RD_MERIS(TLB=tlb)
MODIFICATION HISTORY:
Written by Vincent Fournier-Sicre - Spring 2001 - vfs@acri-st.fr
(See $IDL_LOCAL\Meris\rd_meris.pro)
NAME:
RD_RWMAP
PURPOSE:
retrieves data from MEGS L1 intermediate data files
and stores the content (header and optionaly data)
in a structure.
It accepts all types of MEGS L1b intermediate files:
tmp_rad1.meg, tmp_rad2.meg: calibrated & stray light corrected radiances resp.
tmp_fla1.meg, tmp_fla2.meg: pixel flags associated to above radiances resp.
tmp_buf.meg: geo-location and meteo annotations at tie points
tmp_pcd.meg: internal PCDs at both frame and product level
see OUTPUTS for more details on each file content
CATEGORY:
I/O
CALLING SEQUENCE:
map=RD_RWMAP(FILENAME=filename,/HEADER,/VERBOSE,/LAMBDA,/PIXEL, $
PARAM=param, ZONE=[X0,Y0,X1,Y1,DX,DY])
INPUTS:
All input parameters are passed with keywords (see below).
OPTIONAL INPUTS:
None
KEYWORD PARAMETERS:
FILENAME - data filename (need not be a MEGS file name, if not
the user will be asked for a type)
HEADER - when set only the header of the file is retrieved
DATA - when set only the data of the file is retrieved
VERBOSE - when set then produces additional diagnostic outputs
during the reading of the data file.
LAMBDA - when set then one field is created for each wavelength
(applicable to intermediate radiance files only:
tmp_rad1.meg or tmp_rad2.meg)
ZONE - integer array of 4,5 or 6 values defining area to retrieve
ZONE=[X0,Y0,X1,Y1,DX,DY] DX and DY are subsampling
factors in X/Y directions
PARAM - string array specifying the fields to retrieve
PIXEL - when set then annotations are interpolated to pixel product
OUTPUTS:
Structure with tags "header" and "data" the content of which vary
with the file type.
Note that data tag may be omitted if HEADER keyword is set.
1) radiance files:
"header" is a structure with tags :
filename - full path to the file (syntax is platform dependant)
common_hdr - file common header (for format identification only)
simulator_id - name of simulator that generated the file (MEGS or MERSS)
fld_03 - info field (software name and version, MEGS only)
fld_04 - info field (resolution in MEGS)
fld_05 - info field, not used
fld_06 - info field, not used
fld_07 - date array [yy,mm,dd,hh,mn,ss,ms] not used in MEGS
n_frames - number of frames in file (=AL dimension)
JD_first - UTC time of first frame (processing format)
JD_last - UTC time of last frame (processing format)
fld_11 - unused
fld_12 - index of first extracted module (starts at 1)
n_modules - number of extracted modules
n_columns - total number of columns (all modules, =AC dimension)
fld_15 - unused
n_bands - number of bands (=15)
wavelengths - array of band central wavelengths (nm)
band_widths - array of band widths (FWHM, nm)
"data" is a structure with tags :
l1masks - array of dimensions [n_columns,n_frames]
holding mask registers contained in file.
NOTE: those masks are not set within MEGS, they
are included for compatibility with MERSS format
and either a global array (default):
values - array of dimensions [n_bands,n_columns,n_frames] holding
radiance data for all bands
or per band arrays (optional keyword LAMBDA set):
rad1_xxx or rad2_xxx (depending on file type) - arrays of dimensions
[n_columns,n_frames] holding radiance data for
each band separately. xxx is the wavelength as extracted from
the header and rounded to nearest integer
2) flag files:
"header" is a structure with tags :
filename - full path to the file (syntax is platform dependant)
common_hdr - file common header (for format identification only)
n_frames - number of frames in file (=AL dimension)
n_columns - total number of columns (all modules, =AC dimension)
"data" is a structure with tags :
frame_index - vector of frame indices (length n_frames)
JD - vector of frame times in processing format (length n_frames)
valid_frame_f - vector of frame validity flags (1=valid, length n_frames)
l1saturated_f - array of saturated samples per band flags register, size [n_columns,n_frames]
l1dubious_f - array of dubious samples per band flags register, size [n_columns,n_frames]
l1cosmetic_f - array of cosmetic samples per band flags register, size [n_columns,n_frames]
Note: for the 3 per band flag registers above: flags for band b is coded on bit b
of given register (band and bit indices start at 0, bit 0 is least significant)
l1others_f - array of size [n_columns,n_frames] holding various per pixel flags,
bits meaning are (if set):
0:land, (not set means water, from Atlas only: no radiometry)
1:not used
2:coastline,
3:bright,
4:duplicate,
5:glint risk,
6:stray light risk,
7:invalid.
3) annotation file:
"header" is a structure with tags :
filename - full path to the file (syntax is platform dependant)
common_hdr - file common header (for format identification only)
n_tie_frames - number of Tie Frames in file (=AL dimension)
n_tie_columns - number of Tie Points (=AC dimension)
"data" is a structure with tags :
frame_index - vector of frame indices (length n_frames)
JD - vector of frame times in processing format (length n_frames)
pointing - array of pointing angles at Tie Points (TP), size [n_tie_columns,n_tie_frames]
latitude - array of latitudes at TP, size [n_tie_columns,n_tie_frames]
longitude - array of longitudes at TP, size [n_tie_columns,n_tie_frames]
altitude - array of altitudes at TP, size [n_tie_columns,n_tie_frames]
roughness - array of surface roughness at TP, size [n_tie_columns,n_tie_frames]
VAA - array of View Aziumth Angle at TP, size [n_tie_columns,n_tie_frames]
VZA - array of View Zenith Angle at TP, size [n_tie_columns,n_tie_frames]
SAA - array of Sun Aziumth Angle at TP, size [n_tie_columns,n_tie_frames]
SZA - array of Sun Zenith Angle at TP, size [n_tie_columns,n_tie_frames]
lat_corr - array of latitude correction at TP (due to altitude), size [n_tie_columns,n_tie_frames]
lon_corr - array of longitude correction at TP (due to altitude), size [n_tie_columns,n_tie_frames]
msl_press - array of mean sea level pressure at TP, size [n_tie_columns,n_tie_frames]
ozone - array of total column ozone at TP, size [n_tie_columns,n_tie_frames]
zonal_w - array of zonal wind at 10m height at TP, size [n_tie_columns,n_tie_frames]
merid_w - array of meridional wind at 10m height at TP, size [n_tie_columns,n_tie_frames]
humidity - array of relative humidity at TP, size [n_tie_columns,n_tie_frames]
4) PCD file:
"header" is a structure with tags :
filename - full path to the file (syntax is platform dependant)
common_hdr - file common header (for format identification only)
n_frames - number of frames in file (=AL dimension)
n_modules - number of modules in file (=AC dimension)
"data" is a structure with tags :
frame_index - vector of frame indices (length n_frames)
JD - vector of frame times in processing format (length n_frames)
OutRgPCD - array of image pixels Out Of Range PCD, size [16,n_modules,n_frames]
BlankPCD - array of Blank Pixels PCD, size [16,n_modules,n_frames]
TRANS_ERR - Transmission Error PCD (product wide, scalar)
FORMAT_ERR - Format Error PCD (product wide, scalar)
COARSE_ERR - Coarse Offsets Error PCD (product wide, scalar)
DATABASE_ERR - Auxiliary Database Error PCD (product wide, scalar)
ECMWF_TYPE - ECMWF Data Type PCD (product wide, scalar)
ECMWF_LAG - ECMWF Validity Time PCD (product wide, scalar)
OPTIONAL OUTPUTS:
When HEADER keyword is set then only the header is retrieved
from the rwmap data file and the "DATA" tag is not present in
the structure that is retrieved with this function.
COMMON BLOCKS:
None
SIDE EFFECTS:
Unknown
RESTRICTIONS:
None
PROCEDURE:
If filename is not passed as argument, a file browser is submitted to the user,
when the filename is retrieved, either its type is recognised from the name or
it is requested from the user. File is then checked for existence, readability and
format. If everything is OK, the file is read record after record, each header
and data tag is dimensioned according to its own record ID and header sizing
parameters. Some field dimension and content are checked to confirm that the
file is of rwmap format.
EXAMPLES:
struct=rd_rwmap()
FILENAME='/megs/megs.4.3/folders/sat_l1/RR_Geoloc/files/tmp_rad1.meg'
struct=RD_RWMAP(FILENAME=filename,/HEADER,/VERBOSE)
struct=RD_RWMAP(FILENAME=filename,/VERBOSE)
struct=RD_RWMAP(FILENAME=filename)
struct=RD_RWMAP(FILENAME=filename,/LAMBDA)
filename='/megs_test/validation/Level1b/Perfo/limub_pacific_45_stray.mer_RR'
struct=rd_rwmap(FILENAME=filename)
MODIFICATION HISTORY:
Created Friday February 18 2000 by Vincent Fournier-Sicre - vfs@acri.fr
modified 22/11/00 by lb@acri.fr (added read of 'tmp_buf.meg', L1B annotations
intermediate file, see rd_rwmap_data)
modified 03/12/00 by lb@acri.fr (replaced str_sep by strsplit)
modified 20/11/01 by lb@acri.fr (added read of 'tmp_fla?.meg', 'tmp_pcd.meg',
L1B flags and PCDs intermediate files, see rd_rwmap_data)
modified 20/11/01 by lb@acri.fr: uniformisation of interfaces, documentation update,
new keywords.
(See $IDL_LOCAL\Meris\rd_rwmap.pro)