ocssw
V2022
|
sst_cloud_mask_utils.hpp
Go to the documentation of this file.
41 const std::unordered_map<std::string, std::string (*)(const instr *)> get_sst_coeffs_path = {{std::string("SST"),
60 const std::unordered_map<std::string, std::string (*)(const instr *)> get_sses_coeffs_path = {{std::string("SST"),
85 const std::unordered_map<std::string, const std::unordered_map<std::string, int>> bands_set = // bands WV for VIIRS/MODIS needed to produce SST/Cloud mask
154 const std::unordered_map<std::string, std::unordered_set<int>> all_sensors = {{"modis", modis_sensors},
214 // Functions ptr below get the values of BT/RHOs. Compute a value of BT/RHO or its mask at a given pixel
280 void get_var_mask(int *mask, const l1str &l1str, size_t npix, int nbands, int ib, get_valid get_mask);
285 void get_var_vals(float *BT, const l1str &l1str, size_t npix, int nbands, int ib, get_value get_val);
296 void get_window_1D_max(float *maxs_1d, const float *inp1d, const int *mask1d, size_t npix, size_t radius);
309 get_total_2d_max(float *max_global, const float *inp2d, size_t npix, size_t nscan, size_t center, size_t radius);
314 void get_window_1D_min(float *mins_1d, const float *inp1d, const int *mask1d, size_t npix, size_t radius);
320 get_total_2d_min(float *min_global, const float *inp2d, size_t npix, size_t nscan, size_t center, size_t radius);
335 void get_std_box(const float *inp2d, const int *mask2d, size_t npix, size_t nscan, size_t radius_x, size_t radius_y,
480 operator()(size_t iqual, size_t ilat, size_t idiff, size_t isenz, size_t iquar, size_t iday, size_t isst) {
501 calculate_sses_bias_stats(const float *diff, const float *sst, const float *solz, const float *senz, size_t day,
596 PairOfVarsBT(size_t npix, int ib1, int ib2, l1str &l1str, bool has_difference = false, bool has_ratio = false)
643 PairOfSST(size_t npix, float *sst1, float *sst2, bool has_difference) : PairOfVars(npix), sst1(sst1),
679 cldmsk::get_std_box(var_box.data(), mask_box.data(), npix, nscan, rad_x, rad_y, var_std.data(), center,
740 cldmsk::get_std_box(var_box.data(), mask_box.data(), npix, nscan, rad_x, rad_y, var_std.data(), center,
750 cldmsk::get_window_1D_max(var_max_box.data() + index, var_box.data() + index, mask_box.data() + index,
761 cldmsk::get_window_1D_min(var_min_box.data() + index, var_box.data() + index, mask_box.data() + index,
773 Stats(size_t npix, size_t nscan, size_t rad_x, size_t rad_y, size_t center, l1qstr *l1qrec) : npix(npix),
800 StatsSST(size_t npix, size_t nscan, size_t rad_x, size_t rad_y, size_t center, l1qstr *l1qrec, float *sst,
801 bool std_requested = false, bool max_req = false, bool min_req = false, bool min_max_req = false)
809 mask_box.at(index) = (var_box.at(index) >= cldmsk::SSTmin) && (var_box.at(index) <= cldmsk::SSTmax);
826 mask_box.at(index) = var_box.at(index) >= cldmsk::SSTmin && var_box.at(index) <= cldmsk::SSTmax;
844 StatsVarBand(size_t npix, size_t nscan, size_t rad_x, size_t rad_y, size_t center, l1qstr *l1qrec, int ib,
845 size_t nbands, cldmsk::get_valid get_mask, cldmsk::get_value get_val, bool std_requested = false,
846 bool max_requested = false, bool min_requested = false, bool min_max_requested = false) : Stats(
876 std::copy(var_box.begin() + index, var_box.begin() + index + npix, var_box.begin() + index - npix);
an array had not been initialized Several spelling and grammar corrections were which is read from the appropriate MCF the above metadata values were hard coded A problem calculating the average background DN for SWIR bands when the moon is in the space view port was corrected The new algorithm used to calculate the average background DN for all reflective bands when the moon is in the space view port is now the same as the algorithm employed by the thermal bands For non SWIR changes in the averages are typically less than Also for non SWIR the black body DNs remain a backup in case the SV DNs are not available For SWIR the changes in computed averages were larger because the old which used the black body suffered from contamination by the micron leak As a consequence of the if SV DNs are not available for the SWIR the EV pixels will not be the granule time is used to identify the appropriate tables within the set given for one LUT the first two or last two tables respectively will be used for the interpolation If there is only one LUT in the set of it will be treated as a constant LUT The manner in which Earth View data is checked for saturation was changed Previously the raw Earth View DNs and Space View DNs were checked against the lookup table values contained in the table dn_sat The change made is to check the raw Earth and Space View DNs to be sure they are less than the maximum saturation value and to check the Space View subtracted Earth View dns against a set of values contained in the new lookup table dn_sat_ev The metadata configuration and ASSOCIATEDINSTRUMENTSHORTNAME from the MOD02HKM product The same metatdata with extensions and were removed from the MOD021KM and MOD02OBC products ASSOCIATEDSENSORSHORTNAME was set to MODIS in all products These changes are reflected in new File Specification which users may consult for exact the pow functions were eliminated in Emissive_Cal and Emissive bands replaced by more efficient code Other calculations throughout the code were also made more efficient Aside from a few round off there was no difference to the product The CPU time decreased by about for a day case and for a night case A minor bug in calculating the uncertainty index for emissive bands was corrected The frame index(0-based) was previously being used the frame number(1-based) should have been used. There were only a few minor changes to the uncertainty index(maximum of 1 digit). 3. Some inefficient arrays(Sigma_RVS_norm_sq) were eliminated and some code lines in Preprocess_L1A_Data were moved into Process_OBCEng_Emiss. There were no changes to the product. Required RAM was reduced by 20 MB. Now
Stats(size_t npix, size_t nscan, size_t rad_x, size_t rad_y, size_t center, l1qstr *l1qrec)
Definition: sst_cloud_mask_utils.hpp:773
std::vector< int16_t > counts_out
Definition: sst_cloud_mask_utils.hpp:367
bool(* get_valid)(const l1str &, int, int, int)
Definition: sst_cloud_mask_utils.hpp:215
These are used to scale the SD before writing it to the HDF4 file The default is and which means the product is not scaled at all Since the product is usually stored as a float inside of this is a way to write the float out as a integer l2prod min
Definition: HOWTO_Add_a_product.txt:76
const std::unordered_map< int, std::string > platforms
Definition: sst_cloud_mask_utils.hpp:156
void get_window_1D_min(float *mins_1d, const float *inp1d, const int *mask1d, size_t npix, size_t radius)
the same as get_window_1D_max but for min
Definition: sst_cloud_mask_utils.cpp:87
const std::unordered_map< std::string, const std::unordered_map< std::string, int > > bands_set
Definition: sst_cloud_mask_utils.hpp:85
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 out
Definition: HISTORY.txt:422
float(* get_value)(const l1str &, int, int, int)
Definition: sst_cloud_mask_utils.hpp:216
PairOfSST(size_t npix, float *sst1, float *sst2, bool has_difference)
Definition: sst_cloud_mask_utils.hpp:643
const std::unordered_set< int > viirs_sensors
Definition: sst_cloud_mask_utils.hpp:153
void read_sst_bands(const std::string &sat, std::unordered_map< std::string, int > &bands)
Definition: sst_cloud_mask_utils.cpp:166
StatsSST(size_t npix, size_t nscan, size_t rad_x, size_t rad_y, size_t center, l1qstr *l1qrec, float *sst, bool std_requested=false, bool max_req=false, bool min_req=false, bool min_max_req=false)
Definition: sst_cloud_mask_utils.hpp:800
std::ostream & operator<<(std::ostream &stream, const std::vector< T > &data)
prints a vector
Definition: sst_cloud_mask_utils.hpp:188
std::vector< float > difference
Definition: sst_cloud_mask_utils.hpp:566
StatsVarBand(size_t npix, size_t nscan, size_t rad_x, size_t rad_y, size_t center, l1qstr *l1qrec, int ib, size_t nbands, cldmsk::get_valid get_mask, cldmsk::get_value get_val, bool std_requested=false, bool max_requested=false, bool min_requested=false, bool min_max_requested=false)
Definition: sst_cloud_mask_utils.hpp:844
Contains the data/stats for variables (BTs and SSTs) needed for cloud masks tests / ADT.
Definition: sst_cloud_mask_utils.hpp:560
std::vector< float > bias_mean_out
Definition: sst_cloud_mask_utils.hpp:366
const std::unordered_map< std::string, std::string(*)(const instr *)> get_sses_coeffs_path
returns the SSES LUTs paths to netCDF files depending on requested product
Definition: sst_cloud_mask_utils.hpp:60
float * operator()(const std::string &key)
Definition: sst_cloud_mask_utils.hpp:783
SSES data structure. Contains the LUTs and a look up routine. Reads NetCDF file LUTs file.
Definition: sst_cloud_mask_utils.hpp:343
A derived class to compute stats for an SST.
Definition: sst_cloud_mask_utils.hpp:795
const double scan_time_modis_t_day2
Definition: sst_cloud_mask_utils.hpp:162
const std::unordered_map< std::string, float > cldthresh_list
Definition: sst_cloud_mask_utils.hpp:83
void calculate_sses_bias_stats(const float *diff, const float *sst, const float *solz, const float *senz, size_t day, const float *lat, const int8_t *qual, const int16_t *flags, const float *glint)
Calculates the SSES bias vars.
Definition: sst_cloud_mask_utils.hpp:501
void get_window_1D_max(float *maxs_1d, const float *inp1d, const int *mask1d, size_t npix, size_t radius)
Compute max values within a 1D window in one line in a queue.
Definition: sst_cloud_mask_utils.cpp:55
A derived class to compute stats for a BT.
Definition: sst_cloud_mask_utils.hpp:836
Definition: sst_cloud_mask_utils.cpp:4
a context in which it is NOT documented to do so subscript which cannot be easily calculated when extracting TONS attitude data from the Terra L0 files Corrected several defects in extraction of entrained ephemeris and and as HDF file for both the L1A and Geolocation enabling retrieval of South Polar DEM data Resolved Bug by changing to opent the geolocation file only after a successful read of the L1A and also by checking for fatal errors from not restoring C5 and to report how many of those high resolution values were water in the new WaterPresent SDS Added valid_range attribute to Land SeaMask Changed to bilinearly interpolate the geoid_height to remove artifacts at one degree lines Made corrections to const qualification of pointers allowed by new version of M API library Removed casts that are no longer for same not the geoid Corrected off by one error in calculation of high resolution offsets Corrected parsing of maneuver list configuration parameter Corrected to set Height SDS to fill values when geolocation when for elevation and land water mask
Definition: HISTORY.txt:114
const std::unordered_map< std::string, size_t > bt_box_sizes
Definition: sst_cloud_mask_utils.hpp:107
void get_difference(l1str &l1str)
Definition: sst_cloud_mask_utils.hpp:608
void get_total_2d_min(float *min_global, const float *inp2d, size_t npix, size_t nscan, size_t center, size_t radius)
the same as get_total_2d_max but for min
Definition: sst_cloud_mask_utils.cpp:105
A base class for a variable. Holds values for STD, MAX, MIN within a sliding windows.
Definition: sst_cloud_mask_utils.hpp:660
this program makes no use of any feature of the SDP Toolkit that could generate such a then geolocation is calculated at that and then aggregated up to Resolved feature request Bug by adding three new int8 SDSs for each high resolution pixel
Definition: HISTORY.txt:192
PairOfVarsBT(size_t npix, int ib1, int ib2, l1str &l1str, bool has_difference=false, bool has_ratio=false)
Definition: sst_cloud_mask_utils.hpp:596
no change in intended resolving MODur00064 Corrected handling of bad ephemeris attitude data
Definition: HISTORY.txt:356
std::vector< float > & month_data()
month variable for the desicion tree traversal
Definition: sst_cloud_mask_utils.cpp:18
SSESData(const std::string &nc_path_LUTs, size_t npix)
Construct a new SSESData object.
Definition: sst_cloud_mask_utils.hpp:375
const std::unordered_map< std::string, std::string(*)(const instr *)> get_sst_coeffs_path
returns the sst coefs paths to netCDF files depending on requested product
Definition: sst_cloud_mask_utils.hpp:41
void rearrange_stats()
when a l1 queue is updated, we need to updated the supporting arrays/queus as well
Definition: sst_cloud_mask_utils.hpp:738
size_t operator()(size_t iqual, size_t ilat, size_t idiff, size_t isenz, size_t iquar, size_t iday, size_t isst)
Definition: sst_cloud_mask_utils.hpp:480
void get_std_box(const float *inp2d, const int *mask2d, size_t npix, size_t nscan, size_t radius_x, size_t radius_y, float *out, size_t center, l1qstr *l1qrec)
Compute standard deviation in a window.
Definition: sst_cloud_mask_utils.cpp:121
void get_total_2d_max(float *max_global, const float *inp2d, size_t npix, size_t nscan, size_t center, size_t radius)
Get the max value of center line with 2D sliding window using a 1D max queue computed with get_window...
Definition: sst_cloud_mask_utils.cpp:72
void copy(double **aout, double **ain, int n)
float btrefdiffv6(int32_t ip, float BT39, float BT40, const l1str *l1rec, int fullscanpix)
Legacy BT diff test with interpolation adjutment.
Definition: sst_cloud_mask_utils.cpp:31
const std::unordered_map< std::string, float *(*)(const l1str &)> get_non_BT_vars
Definition: sst_cloud_mask_utils.hpp:260
void set_maxmin()
Init and compute difference between MAX and MIN.
Definition: sst_cloud_mask_utils.hpp:723
const double scan_time_modis_t_day1
Definition: sst_cloud_mask_utils.hpp:161
A base class for a pair of vars. Holds the variables difference and ratio.
Definition: sst_cloud_mask_utils.hpp:565
void get_var_mask(int *mask, const l1str &l1str, size_t npix, int nbands, int ib, get_valid get_mask)
Get the mask (line) of a BT.
Definition: sst_cloud_mask_utils.cpp:43
const std::unordered_map< std::string, std::unordered_set< int > > all_sensors
Definition: sst_cloud_mask_utils.hpp:154
void get_var_vals(float *BT, const l1str &l1str, size_t npix, int nbands, int ib, get_value get_val)
the same as get_var_mask but gets values
Definition: sst_cloud_mask_utils.cpp:49
const std::unordered_set< int > modis_sensors
Definition: sst_cloud_mask_utils.hpp:151
std::unordered_map< std::string, float * > return_vals
Definition: sst_cloud_mask_utils.hpp:671