Skip to content

Commit

Permalink
Bugfix 2867 point2grid qc unittest (#2913)
Browse files Browse the repository at this point in the history
* #2867 Added compute_adp_qc_flag and adjusted ADP QC flags

* #2867 Added point2grid_GOES_16_ADP_Enterprise_high. Changed AOD QC flags to 0,1,2 (was 1,2,3)

* #2867 Added get_nc_att_values_

* #2867 Added get_nc_att_values. Added the argument allow_conversion to get_nc_data(netCDF::NcVar *, uchar  *data)

* #2867 Read the ADP QC flag values and meanings attributes from DQF variable and set the QC high, meduium, low values to support Enterprise algorithm. Adjusted the ADP QC values by using AOD qc values

* #2867 Cleanup

* #2867 Corrected indent

* #2867 Changed log message

* #2867 Removed unused argument

* #2867 Removed unused argument

* Cleanup

* #2867 Fix SonarQube findings

* #2867 Deleted protected section with no members

* #2867 Cleanup

* #2867 FIxed SonarQube findings; unused local variables, decalare as const, etc

* #2867 MOved include directives to top

* #2867 Changed some argumenmt with references to avoid copying objects

* #2867 Do not filter by QC flag if -qc is not given

* #2867 Use enumj class for GOES QC: HIGH, MEDIUM, and LOW

* #2867 Added log message back which were deleted accidently

* #2867 Chaned statci const to constexpr

* #2867 Initial release. Separated from nc_utils.h

* @2867 Added nc_utils_core.h

* #2867 Moved some blocks to nc_utils_core.h

* #2867 Include nc_utils_core.h

* #2867 Added const references

* #2867 Some 'static const' were chnaged to constexpr

* #2867 Changed -qc options (1,2,3 to 0,1 - high & medium) for AOD

* #2867 Merged develop branch

* #2867 Corrected the unit test name

---------

Co-authored-by: Howard Soh <hsoh@seneca.rap.ucar.edu>
  • Loading branch information
hsoh-u and Howard Soh committed Jun 14, 2024
1 parent 6f75e5a commit 4179f55
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 56 deletions.
8 changes: 4 additions & 4 deletions internal/test_unit/xml/unit_point2grid.xml
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@
G212 \
&OUTPUT_DIR;/point2grid/point2grid_GOES_16_AOD_TO_G212_compute.nc \
-field 'name="AOD"; level="(*,*)";' \
-qc 1,2,3 -method MAX \
-qc 0,1 -method MAX \
-v 1
</param>
<output>
Expand Down Expand Up @@ -167,7 +167,7 @@
&OUTPUT_DIR;/point2grid/point2grid_GOES_16_ADP.nc \
-field 'name="AOD_Smoke"; level="(*,*)";' \
-adp &DATA_DIR_MODEL;/goes_16/OR_ABI-L2-ADPC-M6_G16_s20192662141196_e20192662143569_c20192662144526.nc \
-qc 1,2 -method MAX \
-qc 0,1 -method MAX \
-v 1
</param>
<output>
Expand Down Expand Up @@ -213,7 +213,7 @@
</output>
</test>

<test name="point2grid_GOES_16_ADP_Enterprise_high">
<test name="point2grid_GOES_16_ADP_Enterprise_high_medium">
<exec>&MET_BIN;/point2grid</exec>
<env>
<pair><name>MET_TMP_DIR</name> <value>&OUTPUT_DIR;/point2grid</value></pair>
Expand Down Expand Up @@ -259,7 +259,7 @@
G212 \
&OUTPUT_DIR;/point2grid/point2grid_GOES_16_AOD_TO_G212_unsigned.nc \
-field 'name="AOD"; level="(*,*)";' \
-qc 1,2,3 -method MAX \
-qc 0,1,2 -method MAX \
-v 1
</param>
<output>
Expand Down
104 changes: 52 additions & 52 deletions src/libcode/vx_nc_util/nc_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,49 +52,49 @@ typedef unsigned char uchar;

#define OBS_BUFFER_SIZE (128 * 1024)

static const char nc_dim_nhdr[] = "nhdr";
static const char nc_dim_nhdr_typ[] = "nhdr_typ";
static const char nc_dim_nhdr_sid[] = "nhdr_sid";
static const char nc_dim_nhdr_vld[] = "nhdr_vld";
static const char nc_dim_npbhdr[] = "npbhdr";
static const char nc_dim_nobs[] = "nobs";
static const char nc_dim_nqty[] = "nobs_qty";
static const char nc_dim_hdr_arr[] = "hdr_arr_len";
static const char nc_dim_obs_arr[] = "obs_arr_len";
static const char nc_dim_mxstr[] = "mxstr";
static const char nc_dim_mxstr2[] = "mxstr2";
static const char nc_dim_mxstr3[] = "mxstr3";
static const char nc_dim_nvar[] = "obs_var_num";
static const char nc_dim_unit[] = "unit_len";
static const char nc_dim_desc[] = "desc_len";
static const char nc_var_desc[] = "obs_desc";
static const char nc_var_hdr_arr[] = "hdr_arr";
static const char nc_var_hdr_lat[] = "hdr_lat";
static const char nc_var_hdr_lon[] = "hdr_lon";
static const char nc_var_hdr_elv[] = "hdr_elv";
static const char nc_var_hdr_typ[] = "hdr_typ";
static const char nc_var_hdr_sid[] = "hdr_sid";
static const char nc_var_hdr_vld[] = "hdr_vld";
static const char nc_var_hdr_prpt_typ[] = "hdr_prpt_typ";
static const char nc_var_hdr_irpt_typ[] = "hdr_irpt_typ";
static const char nc_var_hdr_inst_typ[] = "hdr_inst_typ";
static const char nc_var_hdr_typ_tbl[] = "hdr_typ_table";
static const char nc_var_hdr_sid_tbl[] = "hdr_sid_table";
static const char nc_var_hdr_vld_tbl[] = "hdr_vld_table";
static const char nc_var_obs_arr[] = "obs_arr";
static const char nc_var_obs_hid[] = "obs_hid";
static const char nc_var_obs_gc[] = "obs_gc";
static const char nc_var_obs_vid[] = "obs_vid";
static const char nc_var_obs_lvl[] = "obs_lvl";
static const char nc_var_obs_hgt[] = "obs_hgt";
static const char nc_var_obs_val[] = "obs_val";
static const char nc_var_obs_qty[] = "obs_qty";
static const char nc_var_obs_qty_tbl[] = "obs_qty_table";
static const char nc_var_obs_var[] = "obs_var";
static const char nc_var_unit[] = "obs_unit";
static const std::string nc_att_use_var_id = "use_var_id";
static const char nc_att_obs_version[] = "MET_Obs_version";
static const char nc_att_met_point_nccf[] = "MET_point_NCCF";
constexpr char nc_dim_nhdr[] = "nhdr";
constexpr char nc_dim_nhdr_typ[] = "nhdr_typ";
constexpr char nc_dim_nhdr_sid[] = "nhdr_sid";
constexpr char nc_dim_nhdr_vld[] = "nhdr_vld";
constexpr char nc_dim_npbhdr[] = "npbhdr";
constexpr char nc_dim_nobs[] = "nobs";
constexpr char nc_dim_nqty[] = "nobs_qty";
constexpr char nc_dim_hdr_arr[] = "hdr_arr_len";
constexpr char nc_dim_obs_arr[] = "obs_arr_len";
constexpr char nc_dim_mxstr[] = "mxstr";
constexpr char nc_dim_mxstr2[] = "mxstr2";
constexpr char nc_dim_mxstr3[] = "mxstr3";
constexpr char nc_dim_nvar[] = "obs_var_num";
constexpr char nc_dim_unit[] = "unit_len";
constexpr char nc_dim_desc[] = "desc_len";
constexpr char nc_var_desc[] = "obs_desc";
constexpr char nc_var_hdr_arr[] = "hdr_arr";
constexpr char nc_var_hdr_lat[] = "hdr_lat";
constexpr char nc_var_hdr_lon[] = "hdr_lon";
constexpr char nc_var_hdr_elv[] = "hdr_elv";
constexpr char nc_var_hdr_typ[] = "hdr_typ";
constexpr char nc_var_hdr_sid[] = "hdr_sid";
constexpr char nc_var_hdr_vld[] = "hdr_vld";
constexpr char nc_var_hdr_prpt_typ[] = "hdr_prpt_typ";
constexpr char nc_var_hdr_irpt_typ[] = "hdr_irpt_typ";
constexpr char nc_var_hdr_inst_typ[] = "hdr_inst_typ";
constexpr char nc_var_hdr_typ_tbl[] = "hdr_typ_table";
constexpr char nc_var_hdr_sid_tbl[] = "hdr_sid_table";
constexpr char nc_var_hdr_vld_tbl[] = "hdr_vld_table";
constexpr char nc_var_obs_arr[] = "obs_arr";
constexpr char nc_var_obs_hid[] = "obs_hid";
constexpr char nc_var_obs_gc[] = "obs_gc";
constexpr char nc_var_obs_vid[] = "obs_vid";
constexpr char nc_var_obs_lvl[] = "obs_lvl";
constexpr char nc_var_obs_hgt[] = "obs_hgt";
constexpr char nc_var_obs_val[] = "obs_val";
constexpr char nc_var_obs_qty[] = "obs_qty";
constexpr char nc_var_obs_qty_tbl[] = "obs_qty_table";
constexpr char nc_var_obs_var[] = "obs_var";
constexpr char nc_var_unit[] = "obs_unit";
constexpr char nc_att_use_var_id[] = "use_var_id";
constexpr char nc_att_obs_version[] = "MET_Obs_version";
constexpr char nc_att_met_point_nccf[] = "MET_point_NCCF";

static const std::string add_offset_att_name = "add_offset";
static const std::string axis_att_name = "axis";
Expand All @@ -111,17 +111,17 @@ static const std::string scale_factor_att_name = "scale_factor";
static const std::string standard_name_att_name = "standard_name";
static const std::string units_att_name = "units";

static const char nc_time_unit_exp[] = "^[a-z|A-Z]* *since *[0-9]\\{1,4\\}-[0-9]\\{1,2\\}-[0-9]\\{1,2\\}";
static const char nc_time_unit_ymd_exp[] = "[0-9]\\{1,4\\}-[0-9]\\{1,2\\}-[0-9]\\{1,2\\}";
constexpr char nc_time_unit_exp[] = "^[a-z|A-Z]* *since *[0-9]\\{1,4\\}-[0-9]\\{1,2\\}-[0-9]\\{1,2\\}";
constexpr char nc_time_unit_ymd_exp[] = "[0-9]\\{1,4\\}-[0-9]\\{1,2\\}-[0-9]\\{1,2\\}";

static const char MET_NC_Obs_ver_1_2[] = "1.02";
static const char MET_NC_Obs_version[] = "1.02";
constexpr char MET_NC_Obs_ver_1_2[] = "1.02";
constexpr char MET_NC_Obs_version[] = "1.02";

static const int exit_code_no_error = 0;
static const int exit_code_no_dim = 1;
static const int exit_code_no_hdr_vars = 2;
static const int exit_code_no_loc_vars = 3;
static const int exit_code_no_obs_vars = 4;
constexpr int exit_code_no_error = 0;
constexpr int exit_code_no_dim = 1;
constexpr int exit_code_no_hdr_vars = 2;
constexpr int exit_code_no_loc_vars = 3;
constexpr int exit_code_no_obs_vars = 4;

////////////////////////////////////////////////////////////////////////

Expand Down

0 comments on commit 4179f55

Please sign in to comment.