Skip to content

Commit

Permalink
Feature #2880 point2grid qc (#2984)
Browse files Browse the repository at this point in the history
* Per #2880, remove Point2Grid quality_mark_thresh config option and add obs_quality_inc and obs_quality_exc from the config file.

* Per #2880, update point2grid docs and reformat whitespace throughout.

* Per #2880, remove quality_mark_thresh and add obs_quality_inc and obs_quality_exc.

* Unrelated to #2880, fix formatting of this R-string which cannot include any special formatting, such as \n.

* Per #2880, not working quite right yet but this is progress

* Per #2880, add a write_css(IntArray) utility function.

* Per #2880, update NcPointObsData class to read the obs quality values from the input file.

* Per #2880, update the log message about the quality  control filter options applied.

* Per #2880, tweak log messages.

* Per #2880, tweak log messages.

* Per #2880, add a Point2Grid unit test to demonstrate using the obs_quality_inc and obs_quality_exc options.

* Per #2880, declare these get accessor functions as const to avoid SonarQube code smell.

* Per #2880, many changes to the vx_nc_obs library and point2grid application to replace dynamically allocated memory with STL vectors to satisfy SonarQube code smells.

* Per #2880, fix compilation error.

* Per #2880, fix compilation error

* Per #2880, revert skip_times back to vector<bool> since I wasn't postive the casting (int *) to (bool *) would actually work in the way I expect. This is safer.

* Per #2880, rename the -qc command line option as -goes_qc, but still quietly support -qc

* Per #2880, based on guidance from @hsoh, reset the var_cell_mapping vector for each loop iteration.
  • Loading branch information
JohnHalleyGotway authored Oct 3, 2024
1 parent a0ce82f commit b8a355c
Show file tree
Hide file tree
Showing 16 changed files with 467 additions and 586 deletions.
11 changes: 4 additions & 7 deletions data/config/Point2GridConfig_default
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,12 @@ obs_window = {

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


//
// Observation message type
// Point observation filtering options
//
message_type = [];
message_type = [];
obs_quality_inc = [];
obs_quality_exc = [];

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

Expand Down Expand Up @@ -72,10 +73,6 @@ var_name_map = [

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

quality_mark_thresh = 2;

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

tmp_dir = "/tmp";
version = "V12.0.0";

Expand Down
431 changes: 169 additions & 262 deletions docs/Users_Guide/reformat_point.rst

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions internal/test_unit/config/Point2GridConfig_WINDS
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
obs_quality_inc = [ "2" ];
obs_quality_exc = [ "1" ];
11 changes: 4 additions & 7 deletions internal/test_unit/config/Point2GridConfig_valid_time
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,12 @@ valid_time = "20201022_173000";

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


//
// Observation message type
// Point observation filtering options
//
//message_type = [];
message_type = [];
obs_quality_inc = [];
obs_quality_exc = [];

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

Expand Down Expand Up @@ -72,10 +73,6 @@ valid_time = "20201022_173000";

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

//quality_mark_thresh = 2;

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

tmp_dir = "/tmp";
version = "V12.0.0";

Expand Down
28 changes: 23 additions & 5 deletions internal/test_unit/xml/unit_point2grid.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,23 @@
</output>
</test>

<test name="point2grid_pb2nc_WINDS">
<exec>&MET_BIN;/point2grid</exec>
<param> \
&OUTPUT_DIR;/pb2nc/ndas.20120409.t12z.prepbufr.tm00.nc \
G212 \
&OUTPUT_DIR;/point2grid/pb2nc_WINDS.nc \
-field 'name="UGRD"; level="*";' \
-field 'name="VGRD"; level="*";' \
-name UWIND,VWIND \
-config &CONFIG_DIR;/Point2GridConfig_WINDS \
-v 3
</param>
<output>
<grid_nc>&OUTPUT_DIR;/point2grid/pb2nc_WINDS.nc</grid_nc>
</output>
</test>

<test name="point2grid_pb2nc_TMP">
<exec>&MET_BIN;/point2grid</exec>
<param> \
Expand Down Expand Up @@ -130,7 +147,7 @@
G212 \
&OUTPUT_DIR;/point2grid/point2grid_GOES_16_AOD_TO_G212_compute.nc \
-field 'name="AOD"; level="(*,*)";' \
-qc 0,1 -method MAX \
-goes_qc 0,1 -method MAX \
-v 1
</param>
<output>
Expand Down Expand Up @@ -167,7 +184,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 0,1 -method MAX \
-goes_qc 0,1 -method MAX \
-v 1
</param>
<output>
Expand All @@ -185,7 +202,7 @@
G212 \
&OUTPUT_DIR;/point2grid/point2grid_GOES_16_AOD_TO_G212_grid_map.nc \
-field 'name="AOD"; level="(*,*)";' \
-qc 0,1,2 -method MAX \
-goes_qc 0,1,2 -method MAX \
-v 1
</param>
<output>
Expand All @@ -205,7 +222,7 @@
G212 \
&OUTPUT_DIR;/point2grid/point2grid_GOES_16_AOD_TO_G212.nc \
-field 'name="AOD"; level="(*,*)";' \
-qc 0,1,2 -method MAX \
-goes_qc 0,1,2 -method MAX \
-v 1
</param>
<output>
Expand All @@ -224,7 +241,7 @@
&OUTPUT_DIR;/point2grid/point2grid_GOES_16_ADP_Enterprise_high.nc \
-field 'name="AOD_Smoke"; level="(*,*)";' \
-adp &DATA_DIR_MODEL;/goes_16/OR_ABI-L2-ADPC-M6_G16_s20241100001171_e20241100003544_c20241100006361.nc \
-qc 0,1 -method MAX \
-goes_qc 0,1 -method MAX \
-v 1
</param>
<output>
Expand Down Expand Up @@ -319,6 +336,7 @@
</output>
</test>

<!-- Use the old -qc option to test backward compatibility -->
<test name="point2grid_GOES_16_AOD_TO_G212_unsigned">
<exec>&MET_BIN;/point2grid</exec>
<env>
Expand Down
1 change: 0 additions & 1 deletion src/basic/vx_util/crc_array.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#include <vector>

#include "num_array.h"
#include "int_array.h"
#include "is_bad_data.h"
#include "nint.h"
#include "vx_cal.h"
Expand Down
8 changes: 6 additions & 2 deletions src/basic/vx_util/int_array.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@

#include <iostream>

#include "num_array.h"

#include "crc_array.h"


Expand All @@ -34,6 +32,12 @@ typedef CRC_Array<int> IntArray;
////////////////////////////////////////////////////////////////////////


extern ConcatString write_css(const IntArray &);


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


#endif /* __INT_ARRAY_H__ */


Expand Down
20 changes: 20 additions & 0 deletions src/basic/vx_util/num_array.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

#include "num_array.h"

#include "int_array.h"
#include "is_bad_data.h"
#include "ptile.h"
#include "nint.h"
Expand Down Expand Up @@ -1382,3 +1383,22 @@ ConcatString write_css_hhmmss(const NumArray &na)


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


ConcatString write_css(const IntArray &ia)

{

ConcatString css;

for ( int i=0; i<ia.n(); ++i ) {
css << (i == 0 ? "" : ",") << ia[i];
}

return css;

}


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

Loading

0 comments on commit b8a355c

Please sign in to comment.