ocssw  1.0
/disk01/web/ocssw/build/inc/swfinc/hdf4_bin.h (r8096/r4879)
Go to the documentation of this file.
00001 #ifndef hdf4_bin_h
00002 #define hdf4_bin_h
00003 
00004 #include "bin_util.h"
00005 #include "meta_l3b.h"
00006 
00007 namespace Hdf {
00008 
00009   class hdf4_bin {
00010     int32 file_id;
00011     int32 sd_id;
00012     int32 vg_id;
00013     int32 access_mode;
00014 
00015     int32 n_data_prod;
00016     int32 vdata_id[MAXNVDATA];
00017     int32 seagrid_idx;
00018     int32 binindex_idx;
00019     int32 binlist_idx;
00020     int32 bin_ptr;
00021     int32 bindata_idx;
00022     int32 binqual_idx;
00023 
00024     char proddata_name[MAXNPROD][80];
00025     char *product_array[MAXNPROD];
00026     int32 aid[MAXNPROD];
00027     int32  *numbin;
00028     int32  *basebin;
00029     float32 *latbin;
00030     bool hasQual;
00031 
00032     binListStruct *binList;
00033 
00034   public:
00035     hdf4_bin();
00036     ~hdf4_bin();
00037 
00038     int create( char* l3b_filename, int32 nrows);
00039     int open( char* l3b_filename);
00040 
00041     int readBinIndex( int row_num_to_read);
00042     int read( float32* data, binListStruct* binList);
00043     int read( float32* data, float32* var, binListStruct* binList);
00044 
00045     int read( float32* data, binListStruct* binList, int nbins_to_read);
00046     int read( float32* data, float32* var, binListStruct* binList, 
00047         int nbins_to_read);
00048 
00049     int readBinList( int nbins_to_read);
00050     int readBinList();
00051     int readQual( uint8* qual, int nbins_to_read);
00052     int readSums( float32* sums, int nbins_to_read, int iprod);
00053 
00054     int nprod() { return n_data_prod;}
00055     int get_numbin( int irow) { return numbin[irow];}
00056     int get_basebin( int irow) { return basebin[irow];}
00057 
00058     int get_bin_num( int kbin) { return binList[kbin].bin_num;}
00059     int get_nobs( int kbin) { return binList[kbin].nobs;}
00060     int get_nscenes( int kbin) { return binList[kbin].nscenes;}
00061     float get_weights( int kbin) { return binList[kbin].weights;}
00062 
00063     char *get_prodname( int i) { return proddata_name[i];}
00064 
00065     int set_bin_num( int offset, int bin_num)
00066     { binList[offset].bin_num = bin_num; return 0;}
00067     int inc_nobs( int offset, int nobs)
00068     { binList[offset].nobs += nobs; return 0;}
00069     int inc_nscenes( int offset, int nscenes)
00070     { binList[offset].nscenes += nscenes; return 0;}
00071     int inc_weights( int offset, float weights)
00072     { binList[offset].weights += weights; return 0;}
00073     int set_weights( int offset, float weights)
00074     { binList[offset].weights = weights; return 0;}
00075 
00076     int clear_binlist() 
00077     { memset( binList, 0, 2*nrows*sizeof(binListStruct)); return 0;}
00078     int copy_binlist( int src, int dest)
00079     { memcpy( &binList[dest], &binList[src], sizeof(binListStruct)); return 0;}
00080 
00081     int write( char *product_list, int32 nwrite, float32 *data, 
00082            binListStruct* binList);
00083     int writeBinList( int32 nbins_to_write);
00084     int writeQual( uint8* qual, int nbins_to_write);
00085     int writeSums( float32* sums, int nbins_to_write, char *prodname);
00086 
00087     int copy( char *product_list, int32 nwrite, int32 *binsToCopy,
00088           Hdf::binListStruct *inBinList, Hdf::hdf4_bin *input_binfile);
00089     int copymeta( int32 nfiles, Hdf::hdf4_bin *input_binfile[]);
00090 
00091     int close();
00092 
00093     bool has_qual();
00094 
00095     int32 nrows;
00096     int32 n_data_records;
00097     int32 n_active_prod;
00098     bool active_data_prod[MAXNVDATA];
00099     int32  totbins;
00100     int32 noext;
00101 
00102     binIndexStruct binIndex;
00103     meta_l3bType meta_l3b;
00104  };
00105 
00106 }
00107 
00108 #endif
00109