ocssw
V2022
|
l1cgen.cpp
Go to the documentation of this file.
49 float * lati = nullptr, * loni = nullptr, * lati2 = nullptr, * loni2 = nullptr,** lat_gd = nullptr, ** lon_gd = nullptr, * az_gd = nullptr;
55 int16_t* tiod = nullptr, * odir = nullptr, * fileid = nullptr, * swtdid = nullptr, * nfiles_swt = nullptr;
115 //******************************************************************************************************************************
116 if (format.type != FT_SPEXONE && format.type != FT_HARP2 & format.type != FT_HARP && l1cfile.l1c_pflag == 3)
120 cout<<"*********************************legacy sensor ************************************"<<endl;
121 cout << "number of files to be processed for creating the L1C grid..." << l1cfile.ifiles.size() << endl;
144 cout<<"ALL GRANULES are processed TOO IF selgran input argument was not setup in CLI ..please use selgran=-1 for binning ALL granules or selgran>0 for speccific granules"<<endl;
171 printf("-E-%s: status=2 error computing equatorial crossing time%p for file%s.................\n", argv[0], tcross, ptstr);
192 ptl1c->mov_sd2(&l1cfile, &l1cinput, tcross, fileid, swtdid, nfiles_swt, ect_d, tiod, odir, mgvswt);
200 time_mgv = (double*)calloc(4000,sizeof(double)); //estimate of number of grids, assuming 4000 gridlines MAX...
203 ptl1c->time_swt2(swtd, &l1cfile, &l1cinput, ect_d, swtdid, fileid, nfiles_swt, mgvswt, time_mgv);
218 ptl1c->interp_swt1(swtd, &l1cfile,&l1cinput, swtdid, fileid, nfiles_swt, time_mgv, velig, lati, loni);
220 ptl1c->interp_swt_dist3(swtd, &l1cfile, &l1cinput, swtdid, fileid, nfiles_swt, time_mgv, lati, loni, lati2, loni2);
221 ptl1c->across_gridlines_l1c2(swtd, &l1cfile, &l1cinput, swtdid, fileid, nfiles_swt, lati2, loni2, lat_gd, lon_gd, az_gd);
272 cout << "original # gridlines.." << NY << "NY1.first gdline." << NY1 << "NY2..last gdline" << NY2 << endl;
277 cout << "*********** SORTING LAT/LON GRIDPOINTS AND TRACKING INDEXES ********************" << endl;
317 cout<<"binning filename (NOT LINE-BY-LINE CALLING) =......."<<ptstr<<"selected granules #....."<<fi<<endl;
318 ptl1c->xy_pixsize_sf3(ptstr,&l1cfile,&l1cinput,pix_size_u,pix_size_v,lat_gd,lon_gd,lat_cgd,lon_cgd,Ltfracsum,areabinsum,nobs_perbin,lat_asort,index_xy);
319 cout<<"calling savebinL1C_v2.....producing nc files with area-weighted Lts................filename.=.."<<ptstr<<endl;
387 cout<<"done processing options #3..Binning granule based on area-weighting in "<<etime<<"minutes..."<<endl;
391 //**********************************************************************************************************************
392 else if (format.type != FT_SPEXONE && format.type != FT_HARP2 && format.type != FT_HARP && l1cfile.l1c_pflag == 1)
416 cout<<"ERROR selgran>=0 ..all granules for the swath are used to produce the L1C grid, not specific ones.."<<"l1cfile.selgran[0]<=0...."<<e<<endl;
433 printf("-E- %s: status=2 error computing equatorial crossing time%f for file%s.................\n", argv[0], tcross[i], ptstr);
453 ptl1c->mov_sd2(&l1cfile, &l1cinput, tcross, fileid, swtdid, nfiles_swt, ect_d, tiod, odir, mgvswt);
461 time_mgv = (double*)calloc(4000,sizeof(double)); //estimate of number of grids, assuming 4000 gridlines MAX...
463 ptl1c->time_swt2(swtd, &l1cfile, &l1cinput, ect_d, swtdid, fileid, nfiles_swt, mgvswt, time_mgv);
473 cout << "num of gridlines..before interpolation or (+ 2 lines)...." << num_gridlines << "num_pixels.." << num_pixels << endl;
485 ptl1c->interp_swt1(swtd, &l1cfile,&l1cinput, swtdid, fileid, nfiles_swt, time_mgv, velig, lati, loni);
490 ptl1c->interp_swt_dist3(swtd, &l1cfile, &l1cinput, swtdid, fileid, nfiles_swt, time_mgv, lati, loni, lati2, loni2);
499 ptl1c->across_gridlines_l1c2(swtd, &l1cfile, &l1cinput, swtdid, fileid, nfiles_swt, lati2, loni2, lat_gd, lon_gd, az_gd);
527 //**********************************************************************************************************************************************
528 else if (format.type != FT_SPEXONE && format.type != FT_HARP2 && format.type != FT_HARP && l1cfile.l1c_pflag == 2)
531 float** lat_asort=nullptr,** lat_gd=nullptr, ** lon_gd=nullptr, * az_east=nullptr,****binLt=nullptr;
537 cout << "loading L1C grid and processing L1C granule............................................................................." << endl;
591 ptl1c->openL1Cgrid(swtd,&l1cstr,&l1cfile,&l1cinput,swtdid,fileid,nfiles_swt,lat_gd,lon_gd,az_east,lat_asort,index_xy);
598 cout<<"binning granule....................................................................................."<<fi<<"filename......................................................#"<<l1cfile.l1b_name<<endl;
622 printf("-E- %lu: status=2 error reading line#%d..from L1B file for sensor...............\n", sline,format.type);
625 ptl1c->binL1C_sbs_line(swtd,ptl1c,&l1cstr,&l1cfile,&l1cinput,swtdid,fileid,nfiles_swt,lat_gd,lon_gd,az_east,lat_asort,index_xy,binLt,bincount,sline,fi);
666 cout<<"done processing options #2..(Binning granule using saddleback search processing (LINE-BY-LINE)"<<etime<<"minutes..."<<endl;
686 printf("-E- %s: status=2 error computing equatorial crossing time%f for file%s.................\n", argv[0], tcross[i], ptstr);
707 ptl1c->mov_sd3(&l1cfile, &l1cinput, tcross, fileid, swtdid, nfiles_swt, ect_d, tiod, odir, mgvswt);
717 ptl1c->time_swt2(swtd, &l1cfile, &l1cinput, ect_d, swtdid, fileid, nfiles_swt, mgvswt, time_mgv);
739 ptl1c->interp_swt1(swtd, &l1cfile,&l1cinput, swtdid, fileid, nfiles_swt, time_mgv, velig, lati, loni);
743 ptl1c->interp_swt_dist3(swtd, &l1cfile, &l1cinput, swtdid, fileid, nfiles_swt, time_mgv, lati, loni, lati2, loni2);
752 ptl1c->across_gridlines_l1c2(swtd, &l1cfile, &l1cinput, swtdid, fileid, nfiles_swt, lati2, loni2, lat_gd, lon_gd, az_gd);
791 printf("-E- %s: status=2 error computing equatorial crossing time%f for file%s.................\n", argv[0], tcross[i], ptstr);
812 ptl1c->mov_sd4(&l1cfile, &l1cinput, tcross, fileid, swtdid, nfiles_swt, ect_d, tiod, odir, mgvswt);
894 printf("-E- %s: status=2 error computing equatorial crossing time%f for file%s.................\n", argv[0], tcross[i], ptstr);
916 ptl1c->mov_sd3(&l1cfile, &l1cinput, tcross, fileid, swtdid, nfiles_swt, ect_d, tiod, odir, mgvswt);
919 ptl1c->time_swt3(swtd, &l1cfile, &l1cinput, ect_d, swtdid, fileid, nfiles_swt, mgvswt, time_mgv);
940 ptl1c->interp_swt1(swtd, &l1cfile,&l1cinput, swtdid, fileid, nfiles_swt, time_mgv, velig, lati, loni);
944 ptl1c->interp_swt_dist3(swtd, &l1cfile, &l1cinput, swtdid, fileid, nfiles_swt, time_mgv, lati, loni, lati2, loni2);
953 ptl1c->across_gridlines_l1c2(swtd, &l1cfile, &l1cinput, swtdid, fileid, nfiles_swt, lati2, loni2, lat_gd, lon_gd, az_gd);
1069 //----- READING L2 FILES ---READING WITH SDS --------------------------------------------------------------
1070 //**********************************************************************************************************-
1073 float** lat_asort=nullptr,** lat_gd=nullptr, ** lon_gd=nullptr, * az_east=nullptr,****binprod=nullptr;
1082 cout << "loading L1C grid and processing L2 file to L1C granule............................................................................." << endl;
1135 ptl1c->openL1Cgrid(swtd,&l1cstr,&l1cfile,&l1cinput,swtdid,fileid,nfiles_swt,lat_gd,lon_gd,az_east,lat_asort,index_xy);
1141 cout<<"binning filename......................................................................................#"<<l1cfile.l1b_name<<endl;
1163 cout<<"number of views.."<<l1cfile.n_views<<"number of products.."<<l2str.nl2prod<<"#gridlines.."<<l1cfile.num_gridlines<<"number of xbins.."<<l1cfile.nbinx<<endl;
1170 printf("-E- %lu: status=2 error reading line#%d..from L2 file for sensor...............\n", sline,format.type);
1173 ptl1c->binL1C_sbs_line_l2(swtd,ptl1c,&l2str,&l1cfile,&l1cinput,swtdid,fileid,nfiles_swt,lat_gd,lon_gd,az_east,lat_asort,index_xy,binprod,bincount,sline,fi);
1213 cout<<"done processing options #4..(Binning L2 file using saddleback search processing "<<etime<<"minutes..."<<endl;
1216 //----- READING L2 FILES ---READING WITH SDS --------------------------------------------------------------
1217 //**********************************************************************************************************-
1233 cout<<"done processing options #5..(creating SOCEA L1C common grid from telemetry "<<etime<<"minutes..."<<endl;
1239 printf("-E- %s: Error opening %s for reading unknown sensor...................\n", argv[0], l1cfile.l1b_name.c_str());
virtual int32_t readl1b_ocis_l1c(l1c_str *l1cstr, l1c_filehandle *l1cfile, int16_t *file_id, int32_t recnum)
Definition: l1c_str.cpp:413
virtual int32_t time_swt2(int swtd, l1c_filehandle *l1cfile, L1C_input *l1cinput, double *ect_d, int16_t *swtdid, int16_t *fileid, int16_t *nfiles_swt, float *mgv_swt, double *time_mgv)
Definition: l1c.cpp:22621
virtual int32_t savebinL1C_v2(int swtd, L1C_input *l1cinput, l1c_filehandle *l1cfile, float **lat_gd, float **lon_gd, float **Ltfracsum, float **areafracsum, float **nobs_perbin)
Definition: l1c.cpp:2388
Utility functions for allocating and freeing three-dimensional arrays of various types.
virtual int32_t binL1C_sbs_line_l2(int swtd, L1C *l1c, l2_str *l2str, l1c_filehandle *l1cfile, L1C_input *l1cinput, int16_t *swtd_id, int16_t *file_id, int16_t *nfiles_swt, float **lat_gd, float **lon_gd, float *az_east, float **lat_asort, short **index_xy, float ****binmean_prod, int ****bincount, size_t sline, int granid)
Definition: l1c.cpp:5893
virtual int32_t binL1C_sbs_line(int swtd, L1C *l1c, l1c_str *l1cstr, l1c_filehandle *l1cfile, L1C_input *l1cinput, int16_t *swtd_id, int16_t *file_id, int16_t *nfiles_swt, float **lat_gd, float **lon_gd, float *az_east, float **lat_asort, short **index_xy, float ****binLt, int ****bincount, size_t recnums, int granid)
Definition: l1c.cpp:6374
float **** allocate4d_float(size_t nr, size_t nz, size_t ny, size_t nx)
Allocate a four-dimensional array of type float of a given size.
Definition: allocate4d.c:56
virtual int32_t ect_sf2(const char *filename, L1C_input *l1cinput, l1c_filehandle *l1cfile)
Definition: l1c.cpp:23904
virtual int32_t xy_pixsize_sf3(const char *filename, l1c_filehandle *l1cfile, L1C_input *l1cinput, float **pix_size_u, float **pix_size_v, float **lat_gd, float **lon_gd, double **lat_cgd, double **lon_cgd, float **Ltfracsum, float **areabinsum, float **nobs_perbin, float **lat_asort, short **index_xy)
Definition: l1c.cpp:16258
virtual int32_t open_l1atol1c(L1C_input *l1cinput, l1c_filehandle *l1cfile)
Definition: l1c.cpp:560
virtual int32_t closel2_ocis_l1c(l2_str *l2str, l1c_filehandle *l1cfile)
Definition: l2_str.cpp:371
Definition: filetype.h:66
int **** allocate4d_int(size_t nr, size_t nz, size_t ny, size_t nx)
Allocate a four-dimensional array of type int of a given size.
Definition: allocate4d.c:12
virtual int32_t l1c_inputmain(int argc, char **argv, L1C_input *l1cinput, l1c_filehandle *l1cfile, const char *prog, const char *version)
Definition: l1c_input.cpp:701
Definition: l2_str.h:24
virtual int32_t openl1b_ocis_l1c(l1c_str *l1cstr, l1c_filehandle *l1cfile, int16_t *file_id)
Definition: l1c_str.cpp:156
virtual int32_t openl2_ocis_l1c(L1C_input *l1cinput, l2_str *l2str, l1c_filehandle *l1cfile, int16_t *file_id)
Definition: l2_str.cpp:115
Definition: l1c_filehandle.h:27
virtual int32_t ect_sf(const char *filename, l1c_filehandle *l1cfilei, L1C_input *l1cinput)
Definition: l1c.cpp:24279
Utility functions for allocating and freeing four-dimensional arrays of various types.
virtual int32_t readl2_ocis_l1c(l2_str *l2str, l1c_filehandle *l1cfile, int16_t *file_id, int32_t recnum)
Definition: l2_str.cpp:333
virtual int32_t across_gridlines_l1c2(int swtd, l1c_filehandle *l1cfile, L1C_input *l1cinput, int16_t *swtd_id, int16_t *file_id, int16_t *nfiles_swt, float *lati3, float *loni3, float **lat_cgd, float **lon_cgd, float *az_east)
Definition: l1c.cpp:20351
virtual int32_t binL1C_wgranule6(int swtd, l1c_filehandle *l1cfile, L1C_input *l1cinput, int16_t *swtd_id, int16_t *odir, int16_t *file_id, int16_t *nfiles_swt)
Definition: l1c.cpp:11035
virtual int32_t binL1C_wgranule7(int swtd, l1c_filehandle *l1cfile, L1C_input *l1cinput, int16_t *swtd_id, int16_t *odir, int16_t *file_id, int16_t *nfiles_swt)
Definition: l1c.cpp:9682
virtual int32_t interp_swt1(int swtd, l1c_filehandle *l1cfile, L1C_input *l1cinput, int16_t *swtd_id, int16_t *file_id, int16_t *nfiles_swt, double *time_mgv, orb_array *velig, float *lati, float *loni)
Definition: l1c.cpp:22262
Definition: l1c.cpp:76
virtual int32_t closel1b_ocis_l1c(l1c_str *l1cstr, l1c_filehandle *l1cfile)
Definition: l1c_str.cpp:481
Utility functions for allocating and freeing two-dimensional arrays of various types.
virtual int32_t interp_swt_dist3(int swtd, l1c_filehandle *l1cfile, L1C_input *l1cinput, int16_t *swtd_id, int16_t *file_id, int16_t *nfiles_swt, double *time_mgv, float *lati, float *loni, float *lati2, float *loni2)
Definition: l1c.cpp:21975
Definition: l1c_str.h:24
virtual int32_t load_l1c_filehandle4(l1c_filehandle *l1cfile, L1C_input *l1cinput)
Definition: l1c.cpp:24585
u5 which has been done in the LOCALGRANULEID metadata should have an extension NRT It is requested to identify the NRT production Changes from v6 which may affect scientific the sector rotation may actually occur during one of the scans earlier than the one where it is first reported As a the b1 values are about the LOCALGRANULEID metadata should have an extension NRT It is requested to identify the NRT to fill pixels affected by dead subframes with a special value Output the metadata of noisy and dead subframe Dead Subframe EV and Detector Quality Flag2 Removed the function call of Fill_Dead_Detector_SI to stop interpolating SI values for dead but also for all downstream products for science test only Changes from v5 which will affect scientific to conform to MODIS requirements Removed the Mixed option from the ScanType in the code because the L1A Scan Type is never Mixed Changed for ANSI C compliance and comments to better document the fact that when the HDF_EOS metadata is stricly the and products are off by and in the track respectively Corrected some misspelling of RCS swir_oob_sending_detector to the Reflective LUTs to enable the SWIR OOB correction detector so that if any of the sending detectors becomes noisy or non near by good detectors from the same sending band can be specified as the substitute in the new look up table Code change for adding an additional dimension of mirror side to the Band_21_b1 LUT to separate the coefficient of the two mirror sides for just like other thermal emissive so that the L1B code can calibrate Band scan to scan with mirror side dependency which leads better calibration result Changes which do not affect scientific when the EV data are not provided in this Crosstalk Correction will not be performed to the Band calibration data Changes which do not affect scientific and BB_500m in L1A Logic was added to turn off the or to spatial aggregation processes and the EV_250m_Aggr1km_RefSB and EV_500m_Aggr1km_RefSB fields were set to fill values when SDSs EV_250m and EV_500m are absent in L1A file Logic was added to skip the processing and turn off the output of the L1B QKM and HKM EV data when EV_250m and EV_500m are absent from L1A In this the new process avoids accessing and reading the and L1A EV skips and writing to the L1B and EV omits reading and subsampling SDSs from geolocation file and writing them to the L1B and omits writing metadata to L1B and EV and skips closing the L1A and L1B EV and SDSs Logic was added to turn off the L1B OBC output when the high resolution OBC SDSs are absent from L1A This is accomplished by skipping the openning the writing of metadata and the closing of the L1B OBC hdf which is Bit in the scan by scan bit QA has been changed Until now
Definition: HISTORY.txt:361
Definition: l1c_input.h:27
double ** allocate2d_double(size_t h, size_t w)
Allocate a two-dimensional array of type double of a given size.
Definition: allocate2d.c:153
virtual int32_t mov_sd4(l1c_filehandle *l1cfile, L1C_input *l1cinput, double *tcross, int16_t *file_id, int16_t *swtd_id, int16_t *nfiles_swt, double *ect_swtd, int16_t *tod, int16_t *orbdir, float *mgv_swath)
Definition: l1c.cpp:23256
virtual int32_t openL1Cgrid(int swtd, l1c_str *l1cstr, l1c_filehandle *l1cfile, L1C_input *l1cinput, int16_t *swtd_id, int16_t *file_id, int16_t *nfiles_swt, float **lat_gd, float **lon_gd, float *az_east, float **lat_asort, short **index_xy)
Definition: l1c.cpp:5655
virtual int32_t time_swt3(int swtd, l1c_filehandle *l1cfile, L1C_input *l1cinput, double *ect_d, int16_t *swtdid, int16_t *fileid, int16_t *nfiles_swt, float *mgv_swt, double *time_mgv)
Definition: l1c.cpp:22497
short ** allocate2d_short(size_t h, size_t w)
Allocate a two-dimensional array of type short of a given size.
Definition: allocate2d.c:97
float ** allocate2d_float(size_t h, size_t w)
Allocate a two-dimensional array of type float of a given size.
Definition: allocate2d.c:125
no change in intended resolving MODur00064 Corrected handling of bad ephemeris attitude resolving resolving GSFcd00179 Corrected handling of fill values for[Sensor|Solar][Zenith|Azimuth] resolving MODxl01751 Changed to validate LUT version against a value retrieved from the resolving MODxl02056 Changed to calculate Solar Diffuser angles without adjustment for estimated post launch changes in the MODIS orientation relative to incidentally resolving defects MODxl01766 Also resolves MODxl01947 Changed to ignore fill values in SCI_ABNORM and SCI_STATE rather than treating them as resolving MODxl01780 Changed to use spacecraft ancillary data to recognise when the mirror encoder data is being set by side A or side B and to change calculations accordingly This removes the need for seperate LUTs for Side A and Side B data it makes the new LUTs incompatible with older versions of the and vice versa Also resolves MODxl01685 A more robust GRing algorithm is being which will create a non default GRing anytime there s even a single geolocated pixel in a granule Removed obsolete messages from seed as required for compatibility with version of the SDP toolkit Corrected test output file names to end in per delivery and then split off a new MYD_PR03 pcf file for Aqua Added AssociatedPlatformInstrumentSensor to the inventory metadata in MOD01 mcf and MOD03 mcf Created new versions named MYD01 mcf and MYD03 where AssociatedPlatformShortName is rather than Terra The program itself has been changed to read the Satellite Instrument validate it against the input L1A and LUT and to use it determine the correct files to retrieve the ephemeris and attitude data from Changed to produce a LocalGranuleID starting with MYD03 if run on Aqua data Added the Scan Type file attribute to the Geolocation copied from the L1A and attitude_angels to radians rather than degrees The accumulation of Cumulated gflags was moved from GEO_validate_earth_location c to GEO_locate_one_scan c
Definition: HISTORY.txt:464
virtual int32_t l1c_usage(const char *prog, const char *version)
Definition: l1c_input.cpp:98
virtual int32_t mov_sd2(l1c_filehandle *l1cfile, L1C_input *l1cinput, double *tcross, int16_t *file_id, int16_t *swtd_id, int16_t *nfiles_swt, double *ect_swtd, int16_t *tod, int16_t *orbdir, float *mgv_swath)
Definition: l1c.cpp:23582
virtual int32_t mov_sd3(l1c_filehandle *l1cfile, L1C_input *l1cinput, double *tcross, int16_t *file_id, int16_t *swtd_id, int16_t *nfiles_swt, double *ect_swtd, int16_t *tod, int16_t *orbdir, float *mgv_swath)
Definition: l1c.cpp:22745