/*************************************************************************** * Copyright (C) 2005 by Nicolas PASCAL * * nicolas.pascal@icare.univ-lille1.fr * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #include "parasolfileformat.h" void PARASOLLeaderFormat::build_level_1_record_format() { build_common_record_format (); /********** TECHNOLOGICAL PARAMETERS ****************/ technological_parameters_format.push_back( EntryFormat("rec_nb", 1, 1, UINT32, "Record Number")); technological_parameters_format.push_back( EntryFormat("rec_len", 5, 1, UINT32, "Length of this record")); technological_parameters_format.push_back( EntryFormat("seq_nb", 9, 4, CHAR8, "Sequence Number")); technological_parameters_format.push_back( EntryFormat("intern_lens_temp", 13, 1, FLOAT8_3, "Internal lens temperature during the sequence (Celsius degrees)")); technological_parameters_format.push_back( EntryFormat("extern_lens_temp", 21, 1, FLOAT8_3, "External lens temperature during the sequence (Celsius degrees)")); technological_parameters_format.push_back( EntryFormat("short_acq_time_duration", 29, 1, FLOAT8_3, "Short Acquisition Time duration (ms)")); technological_parameters_format.push_back( EntryFormat("long_acq_time_duration", 37, 1, FLOAT8_3, "Long Acquisition Time duration (ms)")); // start group entries by sequence. Best should be to manage by a sequence iterator, and an image number iterator. At this time, only one group iterator (sequence one) is implemented. The fastyest way is to implement explicitly each image entry // int off_img_grp = 0; // offset of the current image data block in bytes // int sz_img_grp = 138; // size of an image data block in bytes // int i_img = 0; // indice of current image // // // - image #1 // off_img_grp = i_img++ * sz_img_grp; // i_img = 0; // off_img_grp = ++i_img * sz_img_grp; technological_parameters_format.push_back( EntryFormat("img_nb", 45, 2, CHAR8, "Image Number : i (0≤i≤9). i=im if the sequence was acquired and processed; i=0 otherwise")); technological_parameters_format.push_back( EntryFormat("time_acq", 47, 16, CHAR8, "Date and UT time of the acquisition of image #1 in sequence is : yyyymmddhhmmsscc")); technological_parameters_format.push_back( EntryFormat("x_sat", 63, 1, FLOAT16_7, "X component of the Parasol position during acquisition of image #1 in the sequence (km)")); technological_parameters_format.push_back( EntryFormat("y_sat", 79, 1, FLOAT16_7, "Y component of the Parasol position during acquisition of image #1 in the sequence (km)")); technological_parameters_format.push_back( EntryFormat("z_sat", 95, 1, FLOAT16_7, "Z component of the Parasol position during acquisition of image #1 in the sequence (km)")); technological_parameters_format.push_back( EntryFormat("vx_sat", 111, 1, FLOAT16_7, "Vx component of the Parasol speed vector during the acquisition of image #1 in the sequence (km.s-1)")); technological_parameters_format.push_back( EntryFormat("vy_sat", 127, 1, FLOAT16_7, "Vy component of the Parasol speed vector during the acquisition of image #1 in the sequence (km.s-1)")); technological_parameters_format.push_back( EntryFormat("vz_sat", 143, 1, FLOAT16_7, "Vz component of the Parasol speed vector during the acquisition of image #1 in the sequence (km.s-1)")); technological_parameters_format.push_back( EntryFormat("yaw_sat", 159, 1, FLOAT8_3, "Yaw of the Parasol instrument during acquisition of image #1 in the sequence")); technological_parameters_format.push_back( EntryFormat("pitch_sat", 167, 1, FLOAT8_3, "Pitch of the Parasol instrument during acquisition of image #1 in the sequence")); technological_parameters_format.push_back( EntryFormat("roll_sat", 175, 1, FLOAT8_3, "Roll of the Parasol instrument during acquisition of image #1 in the sequence")); } void PARASOLLeaderFormat::build_level_3_record_format() { string msg ("Format not implemented yet") ; g_exception e( __FILE__ , __LINE__ , msg ); throw e; } void PARASOLLeaderFormat::build_common_record_format() { // format : record_name.push_bask( = EntryFormat(short_name,position,length,type,description ) ) /********** LEADER FILE DESCRIPTOR ****************/ leader_file_descriptor_format.push_back( EntryFormat("rec_nb", 1, 1, UINT32,"Record Number")); leader_file_descriptor_format.push_back( EntryFormat("rec_len", 5, 1, UINT32,"Length of this record")); leader_file_descriptor_format.push_back( EntryFormat("ref_doc_id", 9, 12, CHAR8,"Reference Document Identification")); leader_file_descriptor_format.push_back( EntryFormat("ref_doc_version", 21, 6, CHAR8,"Reference Document Version Number")); leader_file_descriptor_format.push_back( EntryFormat("soft_version", 27, 6, CHAR8,"Software Version Number")); leader_file_descriptor_format.push_back( EntryFormat("file_nb", 33, 4, CHAR8,"File Number")); leader_file_descriptor_format.push_back( EntryFormat("file_name", 37, 16, CHAR8,"File Name")); leader_file_descriptor_format.push_back( EntryFormat("nb_header_rec", 53, 1, UINT32,"Nb of Header records")); leader_file_descriptor_format.push_back( EntryFormat("header_rec_len", 57, 1, UINT32,"Length of Header record")); leader_file_descriptor_format.push_back( EntryFormat("nb_spatio_temp_char_rec", 61, 1, UINT32,"Nb of Spatio-Temporal Characteristics records")); leader_file_descriptor_format.push_back( EntryFormat("spatio_temp_char_rec_len", 65, 1, UINT32,"Length of Spatio-Temporal Characteristics record")); leader_file_descriptor_format.push_back( EntryFormat("nb_instr_setting_param_rec", 69, 1, UINT32,"Nb of Instrument setting parameters records")); leader_file_descriptor_format.push_back( EntryFormat("instr_setting_param_rec_len", 73, 1, UINT32,"Length of Instrument setting parameters record")); leader_file_descriptor_format.push_back( EntryFormat("nb_tech_param_rec", 77, 1, UINT32,"Nb of Technological parameters records")); leader_file_descriptor_format.push_back( EntryFormat("tech_param_rec_len", 81, 1, UINT32,"Length of Technological parameters record")); leader_file_descriptor_format.push_back( EntryFormat("nb_data_proc_param_rec", 85, 1, UINT32,"Nb of Data processing parameters records")); leader_file_descriptor_format.push_back( EntryFormat("data_proc_param_rec_len", 89, 1, UINT32,"Length of Data processing parameters record")); leader_file_descriptor_format.push_back( EntryFormat("nb_scaling_factor_rec", 93, 1, UINT32,"Nb of Scaling factors records")); leader_file_descriptor_format.push_back( EntryFormat("scaling_factor_rec_len", 97, 1, UINT32,"Length of Scaling factors record")); leader_file_descriptor_format.push_back( EntryFormat("nb_annot_rec", 101, 1, UINT32,"Nb of Annotation records")); leader_file_descriptor_format.push_back( EntryFormat("annot_rec_len", 105, 1, UINT32,"Length of Annotation record")); /********** HEADER ****************/ header_format.push_back( EntryFormat("rec_nb", 1, 1, UINT32,"Record Number in the file")); header_format.push_back( EntryFormat("rec_len", 5, 1, UINT32,"Length of this record")); header_format.push_back( EntryFormat("phone_nb", 9, 16, CHAR8,"Information Point Phone Number")); header_format.push_back( EntryFormat("product_id", 25, 16, CHAR8,"Product identification")); header_format.push_back( EntryFormat("sat_id", 41, 8, CHAR8,"Satellite identificator")); header_format.push_back( EntryFormat("instr_id", 49, 8, CHAR8,"Instrument identificator")); header_format.push_back( EntryFormat("spatial_cover", 57, 16, CHAR8,"Spatial Coverage")); header_format.push_back( EntryFormat("pix_size", 73, 8, CHAR8,"Pixel size of the POLDER/Parasol grid")); header_format.push_back( EntryFormat("ellips_name", 81, 30, CHAR8,"Name of the ellipsoid used for the data registration")); header_format.push_back( EntryFormat("ellips_minor_axis_len", 111, 1, FLOAT12_4,"Length of the ellipsoid minor axis")); header_format.push_back( EntryFormat("ellips_major_axis_len", 123, 1, FLOAT12_4,"Length of the ellipsoid major axis")); header_format.push_back( EntryFormat("DEM_name", 135, 30, CHAR8,"Name of the DEM used for the data registration")); header_format.push_back( EntryFormat("DEM_spatial_res_lat", 165, 8, CHAR8,"Spatial resolution of the DEM along the latitudes")); header_format.push_back( EntryFormat("DEM_spatial_res_lon", 173, 8, CHAR8,"Spatial resolution of the DEM along the longitudes")); /********** SPATIO-TEMPORAL CHARACTERISTICS ****************/ spatio_temporal_characteristics_format.push_back( EntryFormat("rec_nb", 1, 1, UINT32,"Record Number in the file")); spatio_temporal_characteristics_format.push_back( EntryFormat("rec_len", 5, 1, UINT32,"Length of this record")); spatio_temporal_characteristics_format.push_back( EntryFormat("cycle_nb", 9, 4, CHAR8,"Cycle number")); spatio_temporal_characteristics_format.push_back( EntryFormat("orbit_nb", 13, 4, CHAR8,"Orbit Number in the cycle")); spatio_temporal_characteristics_format.push_back( EntryFormat("subsat_track_nb", 17, 4, CHAR8,"Sub satellite track number")); spatio_temporal_characteristics_format.push_back( EntryFormat("desc_node_lon", 51, 8, CHAR8,"Descending Node Longitude")); spatio_temporal_characteristics_format.push_back( EntryFormat("desc_node_date", 59, 16, CHAR8,"Descending Node date")); spatio_temporal_characteristics_format.push_back( EntryFormat("first_acq_date", 101, 16, CHAR8,"Date first acquisition")); spatio_temporal_characteristics_format.push_back( EntryFormat("last_acq_date", 117, 16, CHAR8,"Date last acquisition")); spatio_temporal_characteristics_format.push_back( EntryFormat("nb_seq", 201, 4, CHAR8,"Number of sequences")); spatio_temporal_characteristics_format.push_back( EntryFormat("line_nb_northern_pix", 301, 4, CHAR8,"Line number of northern most pixel")); spatio_temporal_characteristics_format.push_back( EntryFormat("line_nb_southern_pix", 305, 4, CHAR8,"Line number of southern most pixel")); /********** INSTRUMENT SETTING ****************/ instrument_setting_parameters_format.push_back( EntryFormat("rec_nb", 1, 1, UINT32,"Record Number in the file")); instrument_setting_parameters_format.push_back( EntryFormat("rec_len", 5, 1, UINT32,"Length of this record")); instrument_setting_parameters_format.push_back( EntryFormat("SIA_duration", 9, 8, CHAR8,"SIA duration")); instrument_setting_parameters_format.push_back( EntryFormat("LIA_duration", 17, 8, CHAR8,"LIA duration")); instrument_setting_parameters_format.push_back( EntryFormat("integration_time_def_type_A", 25, 16, CHAR8,"Integration Time Definition for sequence type A")); instrument_setting_parameters_format.push_back( EntryFormat("integration_time_def_type_B", 41, 16, CHAR8,"Integration Time Definition for sequence type B")); instrument_setting_parameters_format.push_back( EntryFormat("seq_type", 57, 1, B16,"Sequence Type")); instrument_setting_parameters_format.push_back( EntryFormat("analog_gain_nb", 73, 2, CHAR8,"Analogic Gain Number")); /********** NO TECHNOLOGICAL PARAMETERS FOR L2 ****************/ /********** DATA PROCESSING ****************/ data_processing_parameters_format.push_back( EntryFormat("rec_nb", 1, 1, UINT32,"Record Number in the file")); data_processing_parameters_format.push_back( EntryFormat("rec_len", 5, 1, UINT32,"Length of this record")); data_processing_parameters_format.push_back( EntryFormat("l0_creation_country", 9, 8, CHAR8,"Level-0 creation country")); data_processing_parameters_format.push_back( EntryFormat("l0_creation_agency", 17, 8, CHAR8,"Level-0 creation agency")); data_processing_parameters_format.push_back( EntryFormat("l0_creation_facility", 25, 16, CHAR8,"Level-0 creation facility")); data_processing_parameters_format.push_back( EntryFormat("l0_creation_date", 41, 16, CHAR8,"Level-0 creation date")); data_processing_parameters_format.push_back( EntryFormat("l0_process_soft_version", 57, 8, CHAR8,"Level-0 processing software version")); data_processing_parameters_format.push_back( EntryFormat("l1_creation_country", 201, 8, CHAR8,"Level-1 creation country")); data_processing_parameters_format.push_back( EntryFormat("l1_creation_agency", 209, 8, CHAR8,"Level-1 creation agency")); data_processing_parameters_format.push_back( EntryFormat("l1_creation_facility", 217, 16, CHAR8,"Level-1 creation facility")); data_processing_parameters_format.push_back( EntryFormat("l1_creation_date", 233, 16, CHAR8,"Level-1 creation date")); data_processing_parameters_format.push_back( EntryFormat("l1_process_soft_version", 249, 8, CHAR8,"Level-1 processing software version")); data_processing_parameters_format.push_back( EntryFormat("l0_input_parasol_data_id", 257, 16, CHAR8,"Identificator of level-0 Input PARASOL data")); data_processing_parameters_format.push_back( EntryFormat("calib_data_version", 273, 8, CHAR8,"Version of data used for Calibration")); data_processing_parameters_format.push_back( EntryFormat("calib_creation_date", 281, 16, CHAR8,"Date of Calibration File Creation")); data_processing_parameters_format.push_back( EntryFormat("calib_applic_date", 297, 16, CHAR8,"Date of Begining of Calibration Applicability")); data_processing_parameters_format.push_back( EntryFormat("geo_process_data_version", 313, 8, CHAR8,"Version of data for Geometric Processing")); data_processing_parameters_format.push_back( EntryFormat("geo_file_creation_date", 321, 16, CHAR8,"Date of Geometric File Creation")); data_processing_parameters_format.push_back( EntryFormat("geo_applic_date", 337, 16, CHAR8,"Date of Begining of Geometric Applicability")); data_processing_parameters_format.push_back( EntryFormat("product_confidence", 353, 1, B4,"Product Confidence Data")); data_processing_parameters_format.push_back( EntryFormat("l2_creation_country", 361, 8, CHAR8,"Level-2 creation country")); data_processing_parameters_format.push_back( EntryFormat("l2_creation_agency", 369, 8, CHAR8,"Level-2 creation agency")); data_processing_parameters_format.push_back( EntryFormat("l2_creation_facility", 377, 16, CHAR8,"Level-2 creation facility")); data_processing_parameters_format.push_back( EntryFormat("l2_creation_date", 393, 16, CHAR8,"Level-2 creation date")); data_processing_parameters_format.push_back( EntryFormat("process_line_id", 409, 16, CHAR8,"Processing Line Identification")); data_processing_parameters_format.push_back( EntryFormat("product_them_id", 425, 32, CHAR8,"Product Thematic identification")); data_processing_parameters_format.push_back( EntryFormat("l2_process_soft_version", 457, 8, CHAR8,"Level-2 processing software version")); data_processing_parameters_format.push_back( EntryFormat("l1_input_parasol_data_id", 465, 16, CHAR8,"Identificator of level-1 Input PARASOL data")); data_processing_parameters_format.push_back( EntryFormat("l3_input_parasol_data_num1_id", 481, 16, CHAR8,"Identificator of 1st level-3 Input PARASOL data")); data_processing_parameters_format.push_back( EntryFormat("l3_input_parasol_data_num2_id", 497, 16, CHAR8,"Identificator of 2nd level-3 Input PARASOL data")); data_processing_parameters_format.push_back( EntryFormat("l3_input_parasol_data_num3_id", 513, 16, CHAR8,"Identificator of 3rd level-3 Input PARASOL data")); data_processing_parameters_format.push_back( EntryFormat("input_meteo_data_num1_id", 529, 32, CHAR8,"Identificator of 1st input Meteo data")); data_processing_parameters_format.push_back( EntryFormat("input_meteo_data_num2_id", 561, 32, CHAR8,"Identificator of 2nd input Meteo data")); data_processing_parameters_format.push_back( EntryFormat("input_meteo_data_num3_id", 593, 32, CHAR8,"Identificator of 3rd input Meteo data")); data_processing_parameters_format.push_back( EntryFormat("input_TOMS_data_num1_id", 625, 32, CHAR8,"Identificator of 1st input TOMS data")); data_processing_parameters_format.push_back( EntryFormat("input_TOMS_data_num2_id", 657, 32, CHAR8,"Identificator of 2nd input TOMS data")); data_processing_parameters_format.push_back( EntryFormat("product_confidence_intern", 689, 1, B4,"Product Confidence Data (internal)")); /************ SCALING FACTORS *****************/ scaling_factors_format.push_back( EntryFormat("rec_nb", 1, 1, UINT32,"Record Number in the file")); scaling_factors_format.push_back( EntryFormat("rec_len", 5, 1, UINT32,"Length of this record")); scaling_factors_format.push_back( EntryFormat("interleave_id", 9, 8, CHAR8,"Interleaving indicator")); scaling_factors_format.push_back( EntryFormat("byte_order", 17, 16, CHAR8,"Byte ordering standard")); scaling_factors_format.push_back( EntryFormat("nb_pix_param", 33, 4, CHAR8,"Nb parameters per pixel")); scaling_factors_format.push_back( EntryFormat("nb_pix_bytes", 37, 8, CHAR8,"Nb bytes per pixel")); // following entry has "Nb parameters per pixel" values. In storage class, it will be a vector of ParameterScalingFactor objects // BE CAREFUL if you change the name of the 3 following entries, change it also in PARASOLLeader::get_nb_val scaling_factors_format.push_back( EntryFormat("nb_bytes", 45, 2, CHAR8,"Nb bytes for Param #")); scaling_factors_format.push_back( EntryFormat("slope", 47, 1, EXP12_5,"Slope for Param #")); scaling_factors_format.push_back( EntryFormat("offset", 59, 1, EXP12_5,"Offset for Param #")); /********** ANNOTATIONS ****************/ annotations_format.push_back( EntryFormat("rec_nb", 1, 1, UINT32,"Record Number in the file")); annotations_format.push_back( EntryFormat("rec_len", 5, 1, UINT32,"Length of this record")); annotations_format.push_back( EntryFormat("l2_dummy_data_percent", 9, 4, CHAR8,"% of Dummy data in level-2 product")); annotations_format.push_back( EntryFormat("l2_non_significant_data_percent", 13, 4, CHAR8,"% of non significant data in level-2 product")); annotations_format.push_back( EntryFormat("l2_land_pix_percent", 17, 4, CHAR8,"% of Land pixels in level-2 product")); annotations_format.push_back( EntryFormat("l2_ocean_pix_percent", 21, 4, CHAR8,"% of Ocean pixels in level-2 product")); annotations_format.push_back( EntryFormat("l2_coast_pix_percent", 25, 4, CHAR8,"% of Coast pixels in level-2 product")); // following entry has 18 values : 1<=latitude band number<=18 : in storage class, it will be a vector // BE CAREFUL if you change the name of the following entry, change it also in PARASOLLeader::get_nb_val annotations_format.push_back( EntryFormat("cloudy_pix_percent_per_lat_band", 29, 4, CHAR8,"% of cloudy pixels for 10 degrees latitude band #")); annotations_format.push_back( EntryFormat("nb_non_empty_grid_line", 201, 4, CHAR8,"Nb grid lines with at least one pixel")); // following entry has 3240 or 1080 values following of the product's grid resolution : in storage class, it will be a vector // BE CAREFUL if you change the name of the following entry, change it also in PARASOLLeader::get_nb_val annotations_format.push_back( EntryFormat("nb_pix_per_line", 201, 4, CHAR8,"Nb pixel for line #")); } void PARASOLLeaderFormat::build_level_2_record_format() { build_common_record_format(); } void PARASOLDataFormat::build_data_descriptor_record_format() { // this format is common to all PARASOL data files // format : record_name ["Entry name"] = EntryFormat("",position,length,type ) /********** DATA FILE DESCRIPTOR ****************/ data_file_descriptor_format.push_back( EntryFormat("rec_nb", 1, 1, UINT32,"Record Number in the file")); data_file_descriptor_format.push_back( EntryFormat("rec_len", 5, 1, UINT32,"Length of this record")); data_file_descriptor_format.push_back( EntryFormat("ref_doc_id", 9, 12, CHAR8,"Reference Document Identification")); data_file_descriptor_format.push_back( EntryFormat("ref_doc_version", 21, 6, CHAR8,"Reference Document Version Number")); data_file_descriptor_format.push_back( EntryFormat("soft_version", 27, 6, CHAR8,"Software Version Number")); data_file_descriptor_format.push_back( EntryFormat("file_nb", 33, 4, CHAR8,"File Number")); data_file_descriptor_format.push_back( EntryFormat("file_name", 37, 16, CHAR8,"File Name")); data_file_descriptor_format.push_back( EntryFormat("nb_data_rec", 53, 1, UINT32,"Nb of Data records")); data_file_descriptor_format.push_back( EntryFormat("one_data_rec_len", 57, 1, UINT32,"Length of One Data record")); data_file_descriptor_format.push_back( EntryFormat("data_rec_prefix_len", 101, 1, UINT32,"Length of Data Record Prefix")); data_file_descriptor_format.push_back( EntryFormat("data_rec_data_len", 105, 1, UINT32,"Length of Data Record Data")); data_file_descriptor_format.push_back( EntryFormat("data_rec_suffix_len", 109, 1, UINT32,"Length of Data Record Suffix")); } void PARASOLDataFormat::build_RB_2_record_format( ) { data_format.push_back( EntryFormat("rec_nb", 1, 1, UINT32,"Record Number in the file")); data_format.push_back( EntryFormat("rec_len", 5, 1, UINT16,"Length of this record")); data_format.push_back( EntryFormat("line", 7, 1, UINT16,"Line Nb")); data_format.push_back( EntryFormat("col", 9, 1, UINT16,"Col Nb")); data_format.push_back( EntryFormat("alt", 11, 1, INT16,"Mean pixel Altitude from the DEM (m)")); data_format.push_back( EntryFormat("land_percent", 13, 1, UINT8,"Surface Type Indicator")); data_format.push_back( EntryFormat("dsqtrait", 14, 1, B2,"Pixel Confidence Data")); data_format.push_back( EntryFormat("utc_hour", 16, 1, UINT8,"Observation UTC time (hours)")); data_format.push_back( EntryFormat("utc_minute", 17, 1, UINT8,"Observation UTC time (min)")); data_format.push_back( EntryFormat("ni", 18, 1, UINT8,"Nb Viewing Directions")); data_format.push_back( EntryFormat("ni_pray", 19, 1, UINT8,"Nb Directions for Pray Estimation")); data_format.push_back( EntryFormat("minmaxglit", 20, 1, UINT8,"First and Last directions contamined by glint")); data_format.push_back( EntryFormat("mus", 21, 1, UINT8,"Cosine of Solar Zenith angle")); data_format.push_back( EntryFormat("avis", 22, 1, UINT16,"Mean Albedo at 670/865 nm")); data_format.push_back( EntryFormat("rsd_avis", 24, 1, UINT8,"Relative spatial std dev of the albedos")); data_format.push_back( EntryFormat("rad_avis", 25, 1, UINT8,"Relative angular std dev of the albedos")); data_format.push_back( EntryFormat("qavis", 26, 1, UINT8,"Albedo Quality Index")); data_format.push_back( EntryFormat("ascvis", 27, 1, UINT16,"Scene Albedo")); data_format.push_back( EntryFormat("rad_ascvis", 29, 1, UINT8,"Relative Angular std dev of the Scene Albedo")); data_format.push_back( EntryFormat("avisclear", 30, 1, UINT8,"Clear Albedo at 670/865 nm")); data_format.push_back( EntryFormat("asw", 31, 1, UINT16,"Shortwave Albedo")); data_format.push_back( EntryFormat("aswclear", 33, 1, UINT8,"Clear Shortwave Albedo")); data_format.push_back( EntryFormat("cc", 34, 1, UINT8,"Cloud Cover")); data_format.push_back( EntryFormat("dcc_cloudclear", 35, 1, UINT8,"Fraction of Pix firstly indet Finally Clear/cloudy")); data_format.push_back( EntryFormat("qcc", 36, 1, UINT8,"Cloud Cover Quality Index")); data_format.push_back( EntryFormat("uh2o", 37, 1, UINT8,"Water Vapor Column")); data_format.push_back( EntryFormat("sd_h2o", 38, 1, UINT8,"Std dev of Water Vapor")); data_format.push_back( EntryFormat("po2", 39, 1, UINT8,"Mean Cloud PO2")); data_format.push_back( EntryFormat("ad_po2", 40, 1, UINT8,"Angular Std dev PO2")); data_format.push_back( EntryFormat("pray", 41, 1, UINT8,"Mean Cloud Pray")); data_format.push_back( EntryFormat("ad_pray", 42, 1, UINT8,"Angular Std dev Pray")); data_format.push_back( EntryFormat("tau", 43, 1, UINT16,"Cloud Optical Thickness (Linear Mean)")); data_format.push_back( EntryFormat("rsd_tau", 45, 1, UINT8,"Relative Std Dev of Optical Thickness")); data_format.push_back( EntryFormat("eps_tau", 46, 1, UINT8,"Homogeneity Coef of Optical Thickness")); data_format.push_back( EntryFormat("svis", 47, 1, UINT8,"Cloud Spherical Albedo at 670/865 nm")); data_format.push_back( EntryFormat("phase", 48, 1, UINT8,"Cloud Phase")); data_format.push_back( EntryFormat("micro_index", 49, 1, UINT8,"Ice Crystal Shape Index")); data_format.push_back( EntryFormat("tau_strato_aer", 50, 1, UINT8,"Stratospheric Aerosol Optical Thickness")); data_format.push_back( EntryFormat("uo3", 51, 1, UINT8,"Ozone Total Column")); data_format.push_back( EntryFormat("v_wind", 52, 1, UINT8,"Surface Wind Speed")); data_format.push_back( EntryFormat("phi_wind", 53, 1, UINT8,"Surface Wind Direction")); data_format.push_back( EntryFormat("psurf", 54, 1, UINT8,"Surface Pressure")); data_format.push_back( EntryFormat("temp_prof", 55, 10, UINT8,"Temperature Profile")); data_format.push_back( EntryFormat("water_prof", 65, 10, UINT8,"Water Vapor Profile")); // start directionnal group entries data_format.push_back( EntryFormat("thetav", 75, 1, UINT8,"View Zenith Angle")); data_format.push_back( EntryFormat("phi", 76, 1, UINT8,"Relative Azimuth Angle")); data_format.push_back( EntryFormat("rvis", 77, 1, UINT16,"Reflectance Corrected for gas Absorption")); data_format.push_back( EntryFormat("avis", 79, 1, UINT16,"Narrowband Albedo")); data_format.push_back( EntryFormat("rsw", 81, 1, UINT16,"Shortwave Reflectance")); data_format.push_back( EntryFormat("asw", 83, 1, UINT16,"Shortwave Albedo")); data_format.push_back( EntryFormat("lpsmod", 85, 1, UINT8,"Polarized Radiance at 865 nm")); data_format.push_back( EntryFormat("nclearcloudy", 86, 1, UINT8,"Clear/CLoudy Pix Fraction")); data_format.push_back( EntryFormat("cc_dir", 87, 1, UINT8,"Directional Cloud Cover")); data_format.push_back( EntryFormat("svis_dir", 88, 1, UINT8,"Directional Cloud Spherical Albedo at 670/865 nm")); } void PARASOLDataFormat::build_BASIC_1_record_format( ) { // F. Ducos, 19-jul-2007 data_format.push_back( EntryFormat("rec_nb", 1, 1, UINT32,"Record Number in the file")); data_format.push_back( EntryFormat("rec_len", 5, 1, UINT16,"Length of this record")); data_format.push_back( EntryFormat("line", 7, 1, UINT16,"Line Nb")); data_format.push_back( EntryFormat("col", 9, 1, UINT16,"Col Nb")); data_format.push_back( EntryFormat("alt", 11, 1, INT16,"Pixel Altitude from the DEM (m)")); data_format.push_back( EntryFormat("land_percent", 13, 1, UINT8,"Land Percentage (0%:sea, 100%:land, 50%:mixed)")); // dqx is repeated for all directions -> considered as a group // data_format.push_back( EntryFormat("dqx", 14, MAX_PARASOL_DIRECTION, B2,"Pixel Quality Index)")); // one value for each direction data_format.push_back( EntryFormat("dqx", 14, 1, B2,"Pixel Quality Index)")); // one value for each direction // end dqx group data_format.push_back( EntryFormat("rough_cloud_ind", 46, 1, UINT8 ,"Rough Cloud Indicator (0:clear, 100:cloudy, 50:undetermined)")); data_format.push_back( EntryFormat("phis", 47, 1, UINT8 ,"Solar Azimuth Angle")); data_format.push_back( EntryFormat("ni", 48, 1, UINT8 ,"Number of available viewing directions")); data_format.push_back( EntryFormat("seq_arrang", 49, 1, B2,"Sequence Arrangement Indicator")); // start directionnal group entries data_format.push_back( EntryFormat("seq_nb", 51, 1, UINT8 ,"Sequence Number")); data_format.push_back( EntryFormat("ccd_lin", 52, 1, INT16 ,"Line number of the CCD matrix detector which has observed the pixel for filter 670P2")); data_format.push_back( EntryFormat("ccd_col", 54, 1, INT16 ,"Column number of the CCD matrix detector which has observed the pixel for filter 670P2")); data_format.push_back( EntryFormat("thetas", 56, 1, UINT16,"Solar Zenith Angle")); data_format.push_back( EntryFormat("thetav", 58, 1, UINT16,"View Zenith Angle for filter 670P2")); data_format.push_back( EntryFormat("phi", 60, 1, UINT16,"Relative Azimuth Angle for filter 670P2")); data_format.push_back( EntryFormat("delta_thetav_cosphi", 62, 1, INT8,"Delta(Thetav.cos(phi)) : relative variation of viewing geometry between the filters")); data_format.push_back( EntryFormat("delta_thetav_sinphi", 63, 1, INT8,"Delta(Thetav.sin(phi)) : relative variation of viewing geometry between the filters")); data_format.push_back( EntryFormat("rad443NP", 64, 1, INT16,"Normalized radiance for channel 443NP")); data_format.push_back( EntryFormat("rad490P", 66, 1, INT16,"Normalized radiance for channel 490P")); data_format.push_back( EntryFormat("rad1020NP", 68, 1, INT16,"Normalized radiance for channel 1020NP")); data_format.push_back( EntryFormat("rad565NP", 70, 1, INT16,"Normalized radiance for channel 565NP")); data_format.push_back( EntryFormat("rad670P", 72, 1, INT16,"Normalized radiance for channel 670P")); data_format.push_back( EntryFormat("rad763NP", 74, 1, INT16,"Normalized radiance for channel 763NP")); data_format.push_back( EntryFormat("rad765NP", 76, 1, INT16,"Normalized radiance for channel 765NP")); data_format.push_back( EntryFormat("rad865P", 78, 1, INT16,"Normalized radiance for channel 865NP")); data_format.push_back( EntryFormat("rad910NP", 80, 1, INT16,"Normalized radiance for channel 910NP")); data_format.push_back( EntryFormat("Q490P", 82, 1, INT16,"Second component of Stokes Vector (Q) for channel 490P")); data_format.push_back( EntryFormat("Q670P", 84, 1, INT16,"Second component of Stokes Vector (Q) for channel 670P")); data_format.push_back( EntryFormat("Q865P", 86, 1, INT16,"Second component of Stokes Vector (Q) for channel 865P")); data_format.push_back( EntryFormat("U490P", 88, 1, INT16,"Third component of Stokes Vector (U) for channel 490P")); data_format.push_back( EntryFormat("U670P", 90, 1, INT16,"Third component of Stokes Vector (U) for channel 670P")); data_format.push_back( EntryFormat("U865P", 92, 1, INT16,"Third component of Stokes Vector (U) for channel 865P")); } void PARASOLDataFormat::build_OC_SURF_DIR_2_record_format( ) { string msg ("Format not implemented yet") ; g_exception e( __FILE__ , __LINE__ , msg ); throw e; } void PARASOLDataFormat::build_OC_SURF_NON_DIR_2_record_format( ) { string msg ("Format not implemented yet") ; g_exception e( __FILE__ , __LINE__ , msg ); throw e; } void PARASOLDataFormat::build_OC_AEROSOL_2_record_format( ) { // F. Ducos, 19-jul-2007 data_format.push_back( EntryFormat("rec_nb", 1, 1, UINT32,"Record Number in the file")); data_format.push_back( EntryFormat("rec_len", 5, 1, UINT16,"Length of this record")); data_format.push_back( EntryFormat("line", 7, 1, UINT16,"Line Nb")); data_format.push_back( EntryFormat("col", 9, 1, UINT16,"Col Nb")); data_format.push_back( EntryFormat("alt", 11, 1, INT16 ,"Mean pixel Altitude from the DEM (m)")); data_format.push_back( EntryFormat("water_ind", 13, 1, UINT8 ,"Water Indicator")); data_format.push_back( EntryFormat("dqs", 14, 1, UINT32,"Quality Indicator")); data_format.push_back( EntryFormat("iq", 18, 1, UINT8 ,"Quality of the fit : iq = (1 - sigma_lum/2E-3)")); data_format.push_back( EntryFormat("thetas", 19, 1, UINT16,"Solar Zenith Angle")); data_format.push_back( EntryFormat("tau_a865", 21, 1, UINT16,"Aerosol Optical Thickness 865 nm")); data_format.push_back( EntryFormat("tau_a670", 23, 1, UINT16,"Aerosol Optical Thickness 670 nm")); data_format.push_back( EntryFormat("a", 25, 1, UINT16,"Aerosol Angstrom Coefficient")); data_format.push_back( EntryFormat("w0", 27, 1, UINT8 ,"Single Scattering Albedo 865 nm")); data_format.push_back( EntryFormat("g", 28, 1, UINT8 ,"Aerosol Scattering Asymmetry Factor")); data_format.push_back( EntryFormat("ai", 29, 1, UINT16,"Aerosol Index")); data_format.push_back( EntryFormat("reff", 31, 1, UINT8 ,"Aerosol Effective Radius (um)")); data_format.push_back( EntryFormat("reffp", 32, 1, UINT8 ,"Fine Mode Effective Radius (um)")); data_format.push_back( EntryFormat("reffg", 33, 1, UINT8 ,"Large Mode Effective Radius (um)")); data_format.push_back( EntryFormat("tau_ap865", 34, 1, UINT16,"Fine Mode Optical Thickness 865 nm")); data_format.push_back( EntryFormat("tau_ap670", 36, 1, UINT16,"Fine Mode Optical Thickness 670 nm")); data_format.push_back( EntryFormat("ap", 38, 1, UINT16,"Fine Mode Angstrom exponent")); data_format.push_back( EntryFormat("tau_ags865", 40, 1, UINT16,"Optical Thickness of spherical coarse mode at 865 nm")); data_format.push_back( EntryFormat("tau_agns865", 42, 1, UINT16,"Optical Thickness of non spherical particles in large mode")); data_format.push_back( EntryFormat("id", 44, 1, UINT8 ,"Relative contribution of non spherical particles in large mode")); data_format.push_back( EntryFormat("mp", 45, 1, UINT8 ,"Refractive index of the fine mode")); data_format.push_back( EntryFormat("mg", 46, 1, UINT8 ,"Refractive index of the coarse mode")); data_format.push_back( EntryFormat("beta_log_565", 47, 1, UINT16,"Logarithm of the backscattering coefficient at 565 nm")); data_format.push_back( EntryFormat("beta_log_1020", 49, 1, UINT16,"Logarithm of the backscattering coefficient at 1020 nm")); } void PARASOLDataFormat::build_LS_SURF_DIR_2_record_format( ) { string msg ("Format not implemented yet") ; g_exception e( __FILE__ , __LINE__ , msg ); throw e; } void PARASOLDataFormat::build_LS_AEROSOL_2_record_format( ) { // F. Ducos, 19-jul-2007 data_format.push_back( EntryFormat("rec_nb", 1, 1, UINT32,"Record Number in the file")); data_format.push_back( EntryFormat("rec_len", 5, 1, UINT16,"Length of this record")); data_format.push_back( EntryFormat("line", 7, 1, UINT16,"Line Nb")); data_format.push_back( EntryFormat("col", 9, 1, UINT16,"Col Nb")); data_format.push_back( EntryFormat("alt", 11, 1, INT16 ,"Mean pixel Altitude from the DEM (m)")); data_format.push_back( EntryFormat("land_percent", 13, 1, UINT8 ,"Land (100), Water (0) or Mixed (50) indicator")); data_format.push_back( EntryFormat("dqs", 14, 1, UINT32,"Quality Indicator")); data_format.push_back( EntryFormat("aer_tau", 18, 1, UINT16,"Aerosol Optical Thickness at 865 nm")); data_format.push_back( EntryFormat("aer_refrac", 20, 1, UINT8 ,"Aerosol Model Refractive Index (Real part)")); data_format.push_back( EntryFormat("aer_angstrom", 21, 1, UINT8 ,"Aerosol Model Angstrom Coefficient")); data_format.push_back( EntryFormat("aer_index", 22, 1, UINT16,"Aerosol Index")); data_format.push_back( EntryFormat("model_tau", 24, 1, UINT16,"Fixed Model Optical Thickness at 865 nm")); data_format.push_back( EntryFormat("qual_viewcond", 26, 1, UINT16,"Quality index for viewing geometry conditions (0: bad, 1: excellent)")); data_format.push_back( EntryFormat("qual_polreffit", 28, 1, UINT8 ,"Quality index for polarized reflectance fit (0: bad, 1: excellent)")); } void PARASOLDataFormat::build_RB_3_record_format( ) { string msg ("Format not implemented yet") ; g_exception e( __FILE__ , __LINE__ , msg ); throw e; } void PARASOLDataFormat::build_OC_MARINE_3_record_format( ) { string msg ("Format not implemented yet") ; g_exception e( __FILE__ , __LINE__ , msg ); throw e; } void PARASOLDataFormat::build_OC_AEROSOL_3_record_format( ) { string msg ("Format not implemented yet") ; g_exception e( __FILE__ , __LINE__ , msg ); throw e; } void PARASOLDataFormat::build_LS_DIR_SIGN_3_record_format( ) { string msg ("Format not implemented yet") ; g_exception e( __FILE__ , __LINE__ , msg ); throw e; } void PARASOLDataFormat::build_LS_ALBEDO_3_record_format( ) { string msg ("Format not implemented yet") ; g_exception e( __FILE__ , __LINE__ , msg ); throw e; } void PARASOLDataFormat::build_LS_ATMO_3_record_format( ) { string msg ("Format not implemented yet") ; g_exception e( __FILE__ , __LINE__ , msg ); throw e; } PARASOLLeaderFormat::PARASOLLeaderFormat( const PARASOLProduct product ) : PARASOLFileFormat(product) { switch (product) { case BASIC_1 : build_level_1_record_format(); break; case RB_2 : case OC_SURF_DIR_2 : case OC_SURF_NON_DIR_2 : case OC_AEROSOL_2 : case LS_SURF_DIR_2 : case LS_AEROSOL_2 : build_level_2_record_format(); break; case RB_3 : case OC_MARINE_3 : case OC_AEROSOL_3 : case LS_DIR_SIGN_3 : case LS_ALBEDO_3 : case LS_ATMO_3 : build_level_3_record_format(); break; default : string msg ("Unknown PARASOL product" + MyTools::to_string(product) ) ; g_exception e( __FILE__ , __LINE__ , msg ); throw e; break; } } PARASOLDataFormat::PARASOLDataFormat( const PARASOLProduct product ) : PARASOLFileFormat(product) { build_data_descriptor_record_format(); // common to all products switch (product) { case BASIC_1 : build_BASIC_1_record_format(); break; case RB_2 : build_RB_2_record_format(); break; case OC_SURF_DIR_2 : build_OC_SURF_DIR_2_record_format(); break; case OC_SURF_NON_DIR_2 : build_OC_SURF_NON_DIR_2_record_format(); break; case OC_AEROSOL_2 : build_OC_AEROSOL_2_record_format(); break; case LS_SURF_DIR_2 : build_LS_SURF_DIR_2_record_format(); break; case LS_AEROSOL_2 : build_LS_AEROSOL_2_record_format(); break; case RB_3 : build_RB_3_record_format(); break; case OC_MARINE_3 : build_OC_MARINE_3_record_format(); break; case OC_AEROSOL_3 : build_OC_AEROSOL_3_record_format(); break; case LS_DIR_SIGN_3 : build_LS_DIR_SIGN_3_record_format(); break; case LS_ALBEDO_3 : build_LS_ALBEDO_3_record_format(); break; case LS_ATMO_3 : build_LS_ATMO_3_record_format(); break; default : string msg ("Unknown PARASOL product" + MyTools::to_string(product) ) ; g_exception e( __FILE__ , __LINE__ , msg ); throw e; break; } } const size_t PARASOLFileFormat::get_size_of( PARASOLDataType code ) { switch (code) { case CHAR8 : case UCHAR8 : case UINT8 : case INT8 : return sizeof(char); break; case INT16 : case UINT16 : case B2 : return 2 * sizeof(char); break; case INT32 : case UINT32 : case B4 : return 4 * sizeof(char); break; case FLOAT8_3 : return 8 * sizeof(char); break; case FLOAT12_4 : case EXP12_5 : return 12 * sizeof(char); break; case B16 : case FLOAT16_7 : return 16 * sizeof(char); break; default : string msg ("Unknown PARASOLDataType " + MyTools::to_string(code) ) ; g_exception e( __FILE__ , __LINE__ , msg ); throw e; break; } } const int PARASOLFileFormat::get_level( const PARASOLProduct & product ) { switch (product) { case BASIC_1 : return 1; break; case RB_2 : case OC_SURF_DIR_2 : case OC_SURF_NON_DIR_2 : case OC_AEROSOL_2 : case LS_SURF_DIR_2 : case LS_AEROSOL_2 : return 2; break; case RB_3 : case OC_MARINE_3 : case OC_AEROSOL_3 : case LS_DIR_SIGN_3 : case LS_ALBEDO_3 : case LS_ATMO_3 : return 3; break; default : string msg ("Unknown PARASOL product" + MyTools::to_string(product) ) ; g_exception e( __FILE__ , __LINE__ , msg ); throw e; break; } return -1; // will never be here } const int PARASOLFileFormat::get_grid_factor( const PARASOLProduct & product ) { // see PARASOL level 1 Standard product manual Appendix A switch (product) { case BASIC_1 : case OC_SURF_DIR_2 : case OC_SURF_NON_DIR_2 : case LS_SURF_DIR_2 : case OC_MARINE_3 : case LS_DIR_SIGN_3 : case LS_ALBEDO_3 : return 1; break; case RB_2 : case OC_AEROSOL_2 : case LS_AEROSOL_2 : case RB_3 : case OC_AEROSOL_3 : case LS_ATMO_3 : return 2; break; default : string msg ("Unknown PARASOL product" + MyTools::to_string(product) ) ; g_exception e( __FILE__ , __LINE__ , msg ); throw e; break; } return -1; // will never be here } const int PARASOLFileFormat::get_nb_grid_line( const PARASOLProduct & product ) { return PARASOLFileFormat::full_res_grid_line_max/PARASOLFileFormat::get_grid_factor(product); } const int PARASOLDataFormat::get_entry_index( const string& var_name ) const { int i = 0; int nb_param=data_format.size(); while (i!=nb_param && (data_format.begin()+i)->name!=var_name) ++i; if (i==nb_param) { // not found bad_parametre e(var_name); throw e; } return i; }