• Main Page
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

/home/pascal/depot/filedata/src/parasolfilerecord.h

00001 /***************************************************************************
00002  *   Copyright (C) 2005 by Nicolas PASCAL   *
00003  *   nicolas.pascal@icare.univ-lille1.fr   *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  *                                                                         *
00010  *   This program is distributed in the hope that it will be useful,       *
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00013  *   GNU General Public License for more details.                          *
00014  *                                                                         *
00015  *   You should have received a copy of the GNU General Public License     *
00016  *   along with this program; if not, write to the                         *
00017  *   Free Software Foundation, Inc.,                                       *
00018  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00019  ***************************************************************************/
00020 #ifndef PARASOLFILERECORD_H
00021 #define PARASOLFILERECORD_H
00022 
00023 #include <cstring>
00024 #include "tools.h"
00025 #include "g_exception.h"
00026 #define MAX_PARAM 400
00027 
00028 #include <vector>
00029 using namespace std;
00030 
00032 static const int MAX_PARASOL_DIRECTION=16;
00034 static const int NB_MAX_PARASOL_SEQUENCE = 130;
00036 static const int NB_MAX_PARASOL_IMAGE_PER_SEQUENCE = 9;
00040 enum Record{
00041     // leader file record
00042     LEADER_FILE_DESCRIPTOR = 0,
00043     HEADER,
00044     SPATIO_TEMPORAL_CHARACTERISTICS,
00045     INSTRUMENT_SETTING_PARAMETERS,
00046     TECHNOLOGICAL_PARAMETERS,
00047     DATA_PROCESSING_PARAMETERS,
00048     SCALING_FACTORS,
00049     ANNOTATIONS,
00050     // data file record
00051     DATA_FILE_DESCRIPTOR,
00052     DATA
00053 };
00059 class PARASOLFileRecord{
00060 public:
00061     unsigned int rec_nb; 
00062     unsigned short rec_len; 
00064     PARASOLFileRecord(){};
00065     virtual ~PARASOLFileRecord(){};
00066 
00075     virtual void* get_entry(const int& entry_index, const int val_index) {
00076         vector <int> v_ival (1);
00077         v_ival [0] = val_index;
00078         return get_entry(entry_index, v_ival);
00079     };
00087     virtual void* get_entry(const int& entry_index, const vector <int> v_ival = vector <int>(0)) = 0;
00088 };
00089 
00093 class LeaderFileDescriptorRecord : public PARASOLFileRecord {
00094 public:
00095     char ref_doc_id[12+1]; 
00096     char ref_doc_version[6+1]; 
00097     char soft_version[6+1]; 
00098     char file_nb[4+1]; 
00099     char filename[16+1]; 
00100     unsigned int nb_header_rec; 
00101     unsigned int header_rec_len; 
00102     unsigned int nb_spatio_temp_char_rec; 
00103     unsigned int spatio_temp_char_rec_len; 
00104     unsigned int nb_instr_setting_param_rec; 
00105     unsigned int instr_setting_param_rec_len; 
00106     unsigned int nb_tech_param_rec; 
00107     unsigned int tech_param_rec_len; 
00108     unsigned int nb_data_proc_param_rec; 
00109     unsigned int data_proc_param_rec_len; 
00110     unsigned int nb_scaling_factor_rec; 
00111     unsigned int scaling_factor_rec_len; 
00112     unsigned int nb_annot_rec; 
00113     unsigned int annot_rec_len; 
00118     LeaderFileDescriptorRecord(){
00119       ref_doc_id[12]='\0';
00120       ref_doc_version[6]='\0';
00121       soft_version[6]='\0';
00122       file_nb[4]='\0';
00123       filename[16]='\0';
00124     };
00125     ~LeaderFileDescriptorRecord(){};
00126 
00134     void* get_entry(const int& entry_index, const vector <int> v_ival = vector <int>(0));
00141     const int get_record_size(const Record& record);
00142 };
00143 
00147 class HeaderRecord : public PARASOLFileRecord {
00148 public:
00149     char phone_nb[16+1]; 
00150     char product_id[16+1]; 
00151     char sat_id[8+1]; 
00152     char instr_id[8+1]; 
00153     char spatial_cover[16+1]; 
00155     char pix_size[8+1]; 
00156     char ellips_name[30+1]; 
00157     char ellips_minor_axis_len[12+1]; 
00158     char ellips_major_axis_len[12+1]; 
00159     char DEM_name[30+1]; 
00160     char DEM_spatial_res_lat[8+1]; 
00161     char DEM_spatial_res_lon[8+1]; 
00166     HeaderRecord(){
00167       phone_nb[16]='\0';
00168       product_id[16]='\0';
00169       sat_id[8]='\0';
00170       instr_id[8]='\0';
00171       spatial_cover[16]='\0';
00172       pix_size[8]='\0';
00173       ellips_name[30]='\0';
00174       ellips_minor_axis_len[12]='\0';
00175       ellips_major_axis_len[12]='\0';
00176       DEM_name[30]='\0';
00177       DEM_spatial_res_lat[8]='\0';
00178       DEM_spatial_res_lon[8]='\0';
00179     };
00187     void* get_entry(const int& entry_index, const vector <int> v_ival = vector <int>(0));
00188 };
00189 
00193 class SpatioTemporalCharacteristicsRecord : public PARASOLFileRecord {
00194 public:
00195     char cycle_nb[4+1]; 
00196     char orbit_nb[4+1]; 
00197     char subsat_track_nb[4+1]; 
00198     char desc_node_lon[8+1]; 
00199     char desc_node_date[16+1]; 
00201     char first_acq_date[16+1]; 
00202     char last_acq_date[16+1]; 
00203     char nb_seq[4+1]; 
00204     char line_nb_northern_pix[4+1]; 
00205     char line_nb_southern_pix[4+1]; 
00210     SpatioTemporalCharacteristicsRecord(){
00211       cycle_nb[4]='\0';
00212       orbit_nb[4]='\0';
00213       subsat_track_nb[4]='\0';
00214       desc_node_lon[8]='\0';
00215       desc_node_date[16]='\0';
00216       first_acq_date[16]='\0';
00217       last_acq_date[16]='\0';
00218       nb_seq[4]='\0';
00219       line_nb_northern_pix[4]='\0';
00220       line_nb_southern_pix[4]='\0';
00221     };
00229     void* get_entry(const int& entry_index, const vector <int> v_ival = vector <int>(0));
00230 };
00231 
00235 class InstrumentSettingParametersRecord : public PARASOLFileRecord {
00236 public:
00237     char SIA_duration[8+1]; 
00238     char LIA_duration[8+1]; 
00239     char integration_time_def_type_A[16+1]; 
00240     char integration_time_def_type_B[16+1]; 
00241     unsigned char seq_type[16]; 
00242     char analog_gain_nb[8+1]; 
00247     InstrumentSettingParametersRecord(){
00248       SIA_duration[8]='\0';
00249       LIA_duration[8]='\0';
00250       integration_time_def_type_A[16]='\0';
00251       integration_time_def_type_B[16]='\0';
00252       analog_gain_nb[8]='\0';
00253     };
00261     void* get_entry(const int& entry_index, const vector <int> v_ival = vector <int>(0));
00262 };
00263 
00267 class TechnologicalParametersRecord : public PARASOLFileRecord {
00268 public:
00269     char seq_nb[4 + 1]; 
00270     char intern_lens_temp [8 + 1]; 
00271     char extern_lens_temp [8 + 1]; 
00272     char short_acq_time_duration [8 + 1]; 
00273     char long_acq_time_duration  [8 + 1]; 
00275     // sequential group entries
00276     char img_nb    [NB_MAX_PARASOL_SEQUENCE] [NB_MAX_PARASOL_IMAGE_PER_SEQUENCE] [2 + 1] ; 
00277     char time_acq  [NB_MAX_PARASOL_SEQUENCE] [NB_MAX_PARASOL_IMAGE_PER_SEQUENCE] [16 + 1]; 
00278     char x_sat     [NB_MAX_PARASOL_SEQUENCE] [NB_MAX_PARASOL_IMAGE_PER_SEQUENCE] [16 + 1]; 
00279     char y_sat     [NB_MAX_PARASOL_SEQUENCE] [NB_MAX_PARASOL_IMAGE_PER_SEQUENCE] [16 + 1]; 
00280     char z_sat     [NB_MAX_PARASOL_SEQUENCE] [NB_MAX_PARASOL_IMAGE_PER_SEQUENCE] [16 + 1]; 
00281     char vx_sat    [NB_MAX_PARASOL_SEQUENCE] [NB_MAX_PARASOL_IMAGE_PER_SEQUENCE] [16 + 1]; 
00282     char vy_sat    [NB_MAX_PARASOL_SEQUENCE] [NB_MAX_PARASOL_IMAGE_PER_SEQUENCE] [16 + 1]; 
00283     char vz_sat    [NB_MAX_PARASOL_SEQUENCE] [NB_MAX_PARASOL_IMAGE_PER_SEQUENCE] [16 + 1]; 
00284     char yaw_sat   [NB_MAX_PARASOL_SEQUENCE] [NB_MAX_PARASOL_IMAGE_PER_SEQUENCE] [8 + 1] ; 
00285     char pitch_sat [NB_MAX_PARASOL_SEQUENCE] [NB_MAX_PARASOL_IMAGE_PER_SEQUENCE] [8 + 1] ; 
00286     char roll_sat  [NB_MAX_PARASOL_SEQUENCE] [NB_MAX_PARASOL_IMAGE_PER_SEQUENCE] [8 + 1] ; 
00288 public:
00296     void* get_entry(const int& entry_index, const vector <int> v_ival = vector <int>(0));
00297 
00305     void get_xyz_sat (double * v_x_sat, double * v_y_sat, double * v_z_sat);
00306 };
00307 
00311 class DataProcessingParametersRecord : public PARASOLFileRecord {
00312 public:
00313     char l0_creation_country[8+1]; 
00314     char l0_creation_agency[8+1]; 
00315     char l0_creation_facility[16+1]; 
00316     char l0_creation_date[16+1]; 
00317     char l0_process_soft_version[8+1]; 
00318     char l1_creation_country[8+1]; 
00319     char l1_creation_agency[8+1]; 
00320     char l1_creation_facility[16+1]; 
00321     char l1_creation_date[16+1]; 
00322     char l1_process_soft_version[8+1]; 
00323     char l0_input_parasol_data_id[16+1]; 
00324     char calib_data_version[8+1]; 
00325     char calib_creation_date[16+1]; 
00326     char calib_applic_date[16+1]; 
00327     char geo_process_data_version[8+1]; 
00328     char geo_file_creation_date[16+1]; 
00329     char geo_applic_date[16+1]; 
00330     unsigned char product_confidence[4]; 
00331     char l2_creation_country[8+1]; 
00332     char l2_creation_agency[8+1]; 
00333     char l2_creation_facility[16+1]; 
00334     char l2_creation_date[16+1]; 
00335     char process_line_id[16+1]; 
00336     char product_them_id[32+1]; 
00337     char l2_process_soft_version[8+1]; 
00338     char l1_input_parasol_data_id[16+1]; 
00339     char l3_input_parasol_data_num1_id[16+1]; 
00340     char l3_input_parasol_data_num2_id[16+1]; 
00341     char l3_input_parasol_data_num3_id[16+1]; 
00342     char input_meteo_data_num1_id[32+1]; 
00343     char input_meteo_data_num2_id[32+1]; 
00344     char input_meteo_data_num3_id[32+1]; 
00345     char input_TOMS_data_num1_id[32+1]; 
00346     char input_TOMS_data_num2_id[32+1]; 
00347     unsigned char product_confidence_intern[4]; 
00352     DataProcessingParametersRecord(){
00353       l0_creation_country[8]='\0'; 
00354       l0_creation_agency[8]='\0'; 
00355       l0_creation_facility[16]='\0'; 
00356       l0_creation_date[16]='\0'; 
00357       l0_process_soft_version[8]='\0'; 
00358       l1_creation_country[8]='\0'; 
00359       l1_creation_agency[8]='\0'; 
00360       l1_creation_facility[16]='\0'; 
00361       l1_creation_date[16]='\0'; 
00362       l1_process_soft_version[8]='\0'; 
00363       l0_input_parasol_data_id[16]='\0'; 
00364       calib_data_version[8]='\0'; 
00365       calib_creation_date[16]='\0'; 
00366       calib_applic_date[16]='\0'; 
00367       geo_process_data_version[8]='\0'; 
00368       geo_file_creation_date[16]='\0'; 
00369       geo_applic_date[16]='\0'; 
00370       l2_creation_country[8]='\0'; 
00371       l2_creation_agency[8]='\0'; 
00372       l2_creation_facility[16]='\0'; 
00373       l2_creation_date[16]='\0'; 
00374       process_line_id[16]='\0'; 
00375       product_them_id[32]='\0'; 
00376       l2_process_soft_version[8]='\0'; 
00377       l1_input_parasol_data_id[16]='\0'; 
00378       l3_input_parasol_data_num1_id[16]='\0'; 
00379       l3_input_parasol_data_num2_id[16]='\0'; 
00380       l3_input_parasol_data_num3_id[16]='\0'; 
00381       input_meteo_data_num1_id[32]='\0'; 
00382       input_meteo_data_num2_id[32]='\0'; 
00383       input_meteo_data_num3_id[32]='\0'; 
00384       input_TOMS_data_num1_id[32]='\0'; 
00385       input_TOMS_data_num2_id[32]='\0'; 
00386     };
00387 
00395     void* get_entry(const int& entry_index, const vector <int> v_ival = vector <int>(0));
00396 };
00400 class ScalingFactorsRecord : public PARASOLFileRecord {
00401 public:
00402     char interleave_id[8+1]; 
00403     char byte_order[16+1]; 
00404     char nb_pix_param[4+1]; 
00405     char nb_pix_bytes[8+1]; 
00406     char nb_bytes[MAX_PARAM][2+1]; 
00407     char slope[MAX_PARAM][17+1]; 
00408     char offset[MAX_PARAM][17+1]; 
00413     ScalingFactorsRecord () {
00414       memset(interleave_id,0,8+1);
00415       memset(byte_order,0,16+1);
00416       memset(nb_pix_param,0,4+1);
00417       memset(nb_pix_bytes,0,8+1);
00418       memset(nb_bytes,0,(MAX_PARAM*(2+1)));
00419       memset(slope,0,(MAX_PARAM*(17+1)));
00420       memset(offset,0,(MAX_PARAM*(17+1)));
00421     }
00422 
00430     void* get_entry(const int& entry_index, const vector <int> v_ival = vector <int>(0));
00431 };
00435 class AnnotationsRecord : public PARASOLFileRecord {
00436     struct c5 {
00437         char c[4+1];
00438     };
00439 public:
00440     char l2_dummy_data_percent[4+1]; 
00441     char l2_non_significant_data_percent[4+1]; 
00442     char l2_land_pix_percent[4+1]; 
00443     char l2_ocean_pix_percent[4+1]; 
00444     char l2_coast_pix_percent[4+1]; 
00445     vector<c5> cloudy_pix_percent_per_lat_band; 
00446     char nb_non_empty_grid_line[4+1]; 
00447     vector<c5> nb_pix_per_line; 
00452     AnnotationsRecord(){
00453       l2_dummy_data_percent[4]='\0'; 
00454       l2_non_significant_data_percent[4]='\0'; 
00455       l2_land_pix_percent[4]='\0'; 
00456       l2_ocean_pix_percent[4]='\0'; 
00457       l2_coast_pix_percent[4]='\0'; 
00458       nb_non_empty_grid_line[4]='\0'; 
00459     };
00460 
00468     void* get_entry(const int& entry_index, const vector <int> v_ival = vector <int>(0));
00469 };
00473 class DataFileDescriptorRecord : public PARASOLFileRecord {
00474 public:
00475     char ref_doc_id[12+1]; 
00476     char ref_doc_version[6+1]; 
00477     char soft_version[6+1]; 
00478     char file_nb[4+1]; 
00479     char filename[16+1]; 
00480     unsigned int nb_data_rec; 
00481     unsigned int one_data_rec_len; 
00482     unsigned int data_rec_prefix_len; 
00483     unsigned int data_rec_data_len; 
00484     unsigned int data_rec_suffix_len; 
00489     DataFileDescriptorRecord(){
00490       ref_doc_id[12]='\0'; 
00491       ref_doc_version[6]='\0'; 
00492       soft_version[6]='\0'; 
00493       file_nb[4]='\0'; 
00494       filename[16]='\0'; 
00495     };
00496 
00504     void* get_entry(const int& entry_index, const vector <int> v_ival = vector <int>(0));
00511     const int get_record_size(const Record& record);
00512 };
00516 class DataRecord : public PARASOLFileRecord {
00517 public:
00518     unsigned short line_nb;
00519     unsigned short col_nb;
00520 
00528 //     void* get_entry(const int& entry_index, const vector <int> v_ival = vector <int>(0));
00529 };
00534 class RB2_DataRecord : public DataRecord {
00535 public:
00536     signed short mean_alt;  
00537     unsigned short land_percent; 
00538     unsigned char dsqtrait[2]; 
00539     unsigned short obs_time_hr; 
00540     unsigned short obs_time_min; 
00541     unsigned short nb_view_dir; 
00542     unsigned short nb_Pray_dir; 
00543     unsigned short minmax_glint_dir; 
00544     unsigned short solar_zenith_angle_cos; 
00545     unsigned short mean_albedo; 
00546     unsigned short spatial_stddev_albedo; 
00547     unsigned short angular_stddev_albedo; 
00548     unsigned short albedo_QI; 
00549     unsigned short scene_albedo; 
00550     unsigned short angular_stddev_scene_albedo; 
00551     unsigned short clear_albedo; 
00552     unsigned short sw_albedo; 
00553     unsigned short clear_sw_albedo; 
00554     unsigned short cloud_cover; 
00555     unsigned short indet2clear_pix_fraction; 
00556     unsigned short cloud_cover_QI; 
00557     unsigned short water_vapor_column; 
00558     unsigned short water_vapor_stddev; 
00559     unsigned short mean_po2; 
00560     unsigned short angular_stddev_po2; 
00561     unsigned short mean_pray; 
00562     unsigned short angular_stddev_pray; 
00563     unsigned short opt_th; 
00564     unsigned short stddev_opt_th; 
00565     unsigned short homogeneity_coef_opt_th; 
00566     unsigned short sperical_albedo; 
00567     unsigned short cloud_phase; 
00568     unsigned short ice_shape_idx; 
00569     unsigned short strato_aero_opt_th; 
00570     unsigned short ozone_total_column; 
00571     unsigned short surf_wind_speed; 
00572     unsigned short surf_wind_dir; 
00573     unsigned short surf_pressure; 
00574     unsigned short temp_prof[10]; 
00575     unsigned short water_vapor_prof[10]; 
00576     // directionnal group entries : for
00577     unsigned short view_zenith_angle[MAX_PARASOL_DIRECTION]; 
00578     unsigned short azimuth_angle[MAX_PARASOL_DIRECTION]; 
00579     unsigned short reflectance[MAX_PARASOL_DIRECTION]; 
00580     unsigned short narrow_albedo[MAX_PARASOL_DIRECTION]; 
00581     unsigned short dir_sw_reflectance[MAX_PARASOL_DIRECTION]; 
00582     unsigned short dir_sw_albedo[MAX_PARASOL_DIRECTION]; 
00583     unsigned short polar_radiance[MAX_PARASOL_DIRECTION]; 
00584     unsigned short clear_cloudy_pix_fraction[MAX_PARASOL_DIRECTION]; 
00585     unsigned short dir_cloud_cover[MAX_PARASOL_DIRECTION]; 
00586     unsigned short dir_spherical_albedo[MAX_PARASOL_DIRECTION]; 
00595     void* get_entry(const int& entry_index, const vector <int> v_ival = vector <int>(0));
00596 };
00601 class BASIC_1_DataRecord : public DataRecord {
00602 public:
00603     signed short alt; 
00604     unsigned short land_percent; 
00605     unsigned char dqx[32]; 
00606     unsigned short rough_cloud_ind; 
00607     unsigned short phis; 
00608     unsigned short ni; 
00609     unsigned char seq_arrang[2]; 
00610     // directionnal group entries
00611     unsigned short seq_nb[MAX_PARASOL_DIRECTION]; 
00612     signed short ccd_lin[MAX_PARASOL_DIRECTION]; 
00613     signed short ccd_col[MAX_PARASOL_DIRECTION]; 
00614     unsigned short thetas[MAX_PARASOL_DIRECTION]; 
00615     unsigned short thetav[MAX_PARASOL_DIRECTION]; 
00616     unsigned short phi[MAX_PARASOL_DIRECTION]; 
00617     signed short delta_thetav_cosphi[MAX_PARASOL_DIRECTION]; 
00618     signed short delta_thetav_sinphi[MAX_PARASOL_DIRECTION]; 
00619     unsigned short rad443NP[MAX_PARASOL_DIRECTION]; 
00620     unsigned short rad490P[MAX_PARASOL_DIRECTION]; 
00621     unsigned short rad1020NP[MAX_PARASOL_DIRECTION]; 
00622     unsigned short rad565NP[MAX_PARASOL_DIRECTION]; 
00623     unsigned short rad670P[MAX_PARASOL_DIRECTION]; 
00624     unsigned short rad763NP[MAX_PARASOL_DIRECTION]; 
00625     unsigned short rad765NP[MAX_PARASOL_DIRECTION]; 
00626     unsigned short rad865P[MAX_PARASOL_DIRECTION]; 
00627     unsigned short rad910NP[MAX_PARASOL_DIRECTION]; 
00628     unsigned short Q490P[MAX_PARASOL_DIRECTION]; 
00629     unsigned short Q670P[MAX_PARASOL_DIRECTION]; 
00630     unsigned short Q865P[MAX_PARASOL_DIRECTION]; 
00631     unsigned short U490P[MAX_PARASOL_DIRECTION]; 
00632     unsigned short U670P[MAX_PARASOL_DIRECTION]; 
00633     unsigned short U865P[MAX_PARASOL_DIRECTION]; 
00642     void* get_entry(const int& entry_index, const vector <int> v_ival = vector <int>(0));
00643 };
00644 
00645 // void * PARASOLFileRecord::get_entry(const int & i_entry, const vector< int > v_ival) {
00646 //     int sz_v_ival = v_ival.size();
00647 //     if (sz_v_ival == 0)
00648 //         return get_entry (i_entry);
00649 //     else if (sz_v_ival == 1)
00650 //         return get_entry (i_entry, v_ival[0]);
00651 //     else {
00652 //     }
00653 // }
00654 
00655 #endif

Generated on Thu Feb 14 2013 17:59:03 for filedata.kdevelop by  doxygen 1.7.1