Skip to content

Commit

Permalink
Update develop-ref after #1990, #1992, and #1994 (#1995)
Browse files Browse the repository at this point in the history
Co-authored-by: Julie Prestopnik <jpresto@seneca.rap.ucar.edu>
Co-authored-by: johnhg <johnhg@ucar.edu>
Co-authored-by: Seth Linden <linden@kiowa.rap.ucar.edu>
Co-authored-by: John Halley Gotway <johnhg@ucar.edu>
Co-authored-by: j-opatz <59586397+j-opatz@users.noreply.github.com>
Co-authored-by: Howard Soh <hsoh@kiowa.rap.ucar.edu>
Co-authored-by: jprestop <jpresto@ucar.edu>
Co-authored-by: Seth Linden <linden@ucar.edu>
Co-authored-by: hsoh-u <hsoh@ucar.edu>
  • Loading branch information
8 people committed Dec 14, 2021
1 parent d446382 commit fa61672
Show file tree
Hide file tree
Showing 7 changed files with 112 additions and 29 deletions.
2 changes: 1 addition & 1 deletion met/data/table_files/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ tablefiles_DATA = \
grib1_ncep_141_7.txt \
grib1_ncep_2_7.txt \
grib1_lidar2nc.txt \
grib2_af_gpp.txt \
grib2_all.txt \
grib2_bom.txt \
grib2_gpp_af.txt \
grib2_mrms.txt \
grib2_ndfd.txt

Expand Down
File renamed without changes.
12 changes: 11 additions & 1 deletion met/src/basic/vx_util/get_filenames.cc
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,14 @@ struct stat sbuf;
if ( S_ISDIR(sbuf.st_mode) ) {

//
// process directory
// get filenames from the directory and sort them
// to make the order consistent across platforms
//

b = get_filenames_from_dir(search_dir.c_str(), prefix, suffix);

b.sort();

a.add(b);

b.clear();
Expand Down Expand Up @@ -198,10 +201,17 @@ while ( (entry = readdir(directory)) != NULL ) {

}

//
// get filenames from the directory and sort them
// to make the order consistent across platforms
//

if ( S_ISDIR(sbuf.st_mode) ) {

b = get_filenames_from_dir(entry_path, prefix, suffix);

b.sort();

a.add(b);

b.clear();
Expand Down
30 changes: 18 additions & 12 deletions met/src/tools/core/grid_stat/grid_stat.cc
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,7 @@
// output line types.
// 034 05/10/16 Halley Gotway Add grid weighting.
// 035 05/20/16 Prestopnik J Removed -version (now in command_line.cc)
// 036 02/14/17 Win MET-621 enhancement support- additional
// nc_pairs_flag 'apply_mask'
// 036 02/14/17 Win MET#621 Add nc_pairs_flag.apply_mask
// 037 05/15/17 Prestopnik P Add shape for regrid, nbrhd and interp
// 038 06/26/17 Halley Gotway Add ECLV line type.
// 039 08/18/17 Halley Gotway Add fourier decomposition.
Expand All @@ -109,6 +108,7 @@
// 051 03/28/21 Halley Gotway Add mpr_column and mpr_thresh
// filtering options.
// 052 05/28/21 Halley Gotway Add MCTS HSS_EC output.
// 053 12/11/21 Halley Gotway MET #1991 Fix VCNT output.
//
////////////////////////////////////////////////////////////////////////

Expand Down Expand Up @@ -930,12 +930,13 @@ void process_scores() {
do_cnt_sl1l2(conf_info.vx_opt[i], &pd);
}

// Compute VL1L2 and VAL1L2 partial sums for UGRD,VGRD
// Compute VL1L2 and VAL1L2 partial sums for UGRD and VGRD
if(!conf_info.vx_opt[i].fcst_info->is_prob() &&
conf_info.vx_opt[i].fcst_info->is_v_wind() &&
conf_info.vx_opt[i].fcst_info->uv_index() >= 0 &&
(conf_info.vx_opt[i].output_flag[i_vl1l2] != STATOutputType_None ||
conf_info.vx_opt[i].output_flag[i_val1l2] != STATOutputType_None) ) {
conf_info.vx_opt[i].output_flag[i_val1l2] != STATOutputType_None ||
conf_info.vx_opt[i].output_flag[i_vcnt] != STATOutputType_None)) {

// Store the forecast variable name
shc.set_fcst_var(ugrd_vgrd_abbr_str);
Expand Down Expand Up @@ -1006,7 +1007,6 @@ void process_scores() {
// Write out VL1L2
if(conf_info.vx_opt[i].output_flag[i_vl1l2] != STATOutputType_None &&
vl1l2_info[m].vcount > 0) {

write_vl1l2_row(shc, vl1l2_info[m],
conf_info.vx_opt[i].output_flag[i_vl1l2],
stat_at, i_stat_row,
Expand All @@ -1016,18 +1016,15 @@ void process_scores() {
// Write out VAL1L2
if(conf_info.vx_opt[i].output_flag[i_val1l2] != STATOutputType_None &&
vl1l2_info[m].vacount > 0) {

write_val1l2_row(shc, vl1l2_info[m],
conf_info.vx_opt[i].output_flag[i_val1l2],
stat_at, i_stat_row,
txt_at[i_val1l2], i_txt_row[i_val1l2]);
}


// Write out VCNT
if(conf_info.vx_opt[i].output_flag[i_vcnt] != STATOutputType_None &&
vl1l2_info[m].vcount > 0) {

write_vcnt_row(shc, vl1l2_info[m],
conf_info.vx_opt[i].output_flag[i_vcnt],
stat_at, i_stat_row,
Expand Down Expand Up @@ -1677,12 +1674,13 @@ void process_scores() {
do_cnt_sl1l2(conf_info.vx_opt[i], &pd);
}

// Compute VL1L2 and VAL1L2 partial sums for UGRD,VGRD
// Compute VL1L2 and VAL1L2 partial sums for UGRD and VGRD
if(!conf_info.vx_opt[i].fcst_info->is_prob() &&
conf_info.vx_opt[i].fcst_info->is_v_wind() &&
conf_info.vx_opt[i].fcst_info->uv_index() >= 0 &&
(conf_info.vx_opt[i].output_flag[i_vl1l2] != STATOutputType_None ||
conf_info.vx_opt[i].output_flag[i_val1l2] != STATOutputType_None) ) {
conf_info.vx_opt[i].output_flag[i_val1l2] != STATOutputType_None ||
conf_info.vx_opt[i].output_flag[i_vcnt] != STATOutputType_None)) {

// Store the forecast variable name
shc.set_fcst_var(ugrd_vgrd_abbr_str);
Expand Down Expand Up @@ -1754,7 +1752,6 @@ void process_scores() {
// Write out VL1L2
if(conf_info.vx_opt[i].output_flag[i_vl1l2] != STATOutputType_None &&
vl1l2_info[m].vcount > 0) {

write_vl1l2_row(shc, vl1l2_info[m],
conf_info.vx_opt[i].output_flag[i_vl1l2],
stat_at, i_stat_row,
Expand All @@ -1764,12 +1761,21 @@ void process_scores() {
// Write out VAL1L2
if(conf_info.vx_opt[i].output_flag[i_val1l2] != STATOutputType_None &&
vl1l2_info[m].vacount > 0) {

write_val1l2_row(shc, vl1l2_info[m],
conf_info.vx_opt[i].output_flag[i_val1l2],
stat_at, i_stat_row,
txt_at[i_val1l2], i_txt_row[i_val1l2]);
}

// Write out VCNT
if(conf_info.vx_opt[i].output_flag[i_vcnt] != STATOutputType_None &&
vl1l2_info[m].vcount > 0) {
write_vcnt_row(shc, vl1l2_info[m],
conf_info.vx_opt[i].output_flag[i_vcnt],
stat_at, i_stat_row,
txt_at[i_vcnt], i_txt_row[i_vcnt]);
}

} // end for m

// Reset the forecast variable name
Expand Down
10 changes: 5 additions & 5 deletions met/src/tools/core/point_stat/point_stat.cc
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@
// 047 08/23/21 Seth Linden Add ORANK line type for HiRA.
// 048 09/13/21 Seth Linden Changed obs_qty to obs_qty_inc.
// Added code for obs_qty_exc.
// 049 12/11/21 Halley Gotway MET#1991 Fix VCNT output.
//
////////////////////////////////////////////////////////////////////////

Expand Down Expand Up @@ -1055,12 +1056,13 @@ void process_scores() {
do_cnt_sl1l2(conf_info.vx_opt[i], pd_ptr);
}

// Compute VL1L2 and VAL1L2 partial sums for UGRD,VGRD
// Compute VL1L2 and VAL1L2 partial sums for UGRD and VGRD
if(!conf_info.vx_opt[i].vx_pd.fcst_info->is_prob() &&
conf_info.vx_opt[i].vx_pd.fcst_info->is_v_wind() &&
conf_info.vx_opt[i].vx_pd.fcst_info->uv_index() >= 0 &&
(conf_info.vx_opt[i].output_flag[i_vl1l2] != STATOutputType_None ||
conf_info.vx_opt[i].output_flag[i_val1l2] != STATOutputType_None) ) {
conf_info.vx_opt[i].output_flag[i_val1l2] != STATOutputType_None ||
conf_info.vx_opt[i].output_flag[i_vcnt] != STATOutputType_None)) {

// Store the forecast variable name
shc.set_fcst_var(ugrd_vgrd_abbr_str);
Expand Down Expand Up @@ -1117,8 +1119,7 @@ void process_scores() {
txt_at[i_val1l2], i_txt_row[i_val1l2]);
}


// Write out VCNT
// Write out VCNT
if(conf_info.vx_opt[i].output_flag[i_vcnt] != STATOutputType_None &&
vl1l2_info[m].vcount > 0) {
write_vcnt_row(shc, vl1l2_info[m],
Expand All @@ -1127,7 +1128,6 @@ void process_scores() {
txt_at[i_vcnt], i_txt_row[i_vcnt]);
}


} // end for m

// Reset the forecast variable name
Expand Down
52 changes: 42 additions & 10 deletions met/src/tools/other/gen_vx_mask/gen_vx_mask.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
// 007 04/08/19 Halley Gotway Add percentile thresholds.
// 008 04/06/20 Halley Gotway Generalize input_grid option.
// 009 06/01/21 Seth Linden Change -type from optional to required.
// 010 08/30/21 Halley Gotway MET #1891 fix input and mask fields.
// 010 08/30/21 Halley Gotway MET#1891 Fix input and mask fields.
// 011 12/13/21 Halley Gotway MET#1993 Fix -type grid.
//
////////////////////////////////////////////////////////////////////////

Expand Down Expand Up @@ -163,26 +164,26 @@ void process_command_line(int argc, char **argv) {

void process_input_grid(DataPlane &dp) {

// Parse info.name as a white-space separated string
// Parse the input grid as a white-space separated string
StringArray sa;
sa.parse_wsss(input_gridname);

// Search for a named grid
if(sa.n() == 1 && find_grid_by_name(sa[0].c_str(), grid)) {
mlog << Debug(3)
<< "Use the grid named \"" << input_gridname << "\".\n";
<< "Use input grid named \"" << input_gridname << "\".\n";
}
// Parse grid definition
else if(sa.n() > 1 && parse_grid_def(sa, grid)) {
mlog << Debug(3)
<< "Use the grid defined by string \"" << input_gridname
<< "Use input grid defined by string \"" << input_gridname
<< "\".\n";
}
// Extract the grid from a gridded data file
else {

mlog << Debug(3)
<< "Use the grid defined by file \"" << input_gridname
<< "Use input grid defined by file \"" << input_gridname
<< "\".\n";

// Read the input grid and data plane, if requested
Expand Down Expand Up @@ -249,13 +250,44 @@ void process_mask_file(DataPlane &dp) {
mask_type == MaskType_Lon) {
}

// Otherwise, process the mask file as a gridded data file
// Otherwise, process the mask file as a named grid, grid specification
// string or gridded data file
else {

// Read the mask grid and data plane, if requested
get_data_plane(mask_filename, mask_field_str,
mask_type == MaskType_Data,
dp, grid_mask);
// For the grid mask type, support named grids and grid
// specification strings
if(mask_type == MaskType_Grid) {

// Parse the mask file as a white-space separated string
StringArray sa;
sa.parse_wsss(mask_filename);

// Search for a named grid
if(sa.n() == 1 && find_grid_by_name(sa[0].c_str(), grid_mask)) {
mlog << Debug(3)
<< "Use mask grid named \"" << mask_filename << "\".\n";
}
// Parse grid definition
else if(sa.n() > 1 && parse_grid_def(sa, grid_mask)) {
mlog << Debug(3)
<< "Use mask grid defined by string \"" << mask_filename
<< "\".\n";
}
}

// Parse as a gridded data file if not already set
if(grid_mask.nxy() == 0) {

// Extract the grid from a gridded data file
mlog << Debug(3)
<< "Use mask grid defined by file \"" << mask_filename
<< "\".\n";

// Read the mask grid and data plane, if requested
get_data_plane(mask_filename, mask_field_str,
mask_type == MaskType_Data,
dp, grid_mask);
}

mlog << Debug(2)
<< "Parsed Mask Grid:\t" << grid_mask.name()
Expand Down
35 changes: 35 additions & 0 deletions test/xml/unit_gen_vx_mask.xml
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,41 @@
</output>
</test>

<!-- -->
<!-- GRID: named grids -->
<!-- -->

<test name="gen_vx_mask_GRID_NAMED_GRIDS">
<exec>&MET_BIN;/gen_vx_mask</exec>
<param> \
G004 G130 \
&OUTPUT_DIR;/gen_vx_mask/GRID_NAMED_GRIDS_mask.nc \
-type grid -name G130_grid \
-v 1
</param>
<output>
<grid_nc>&OUTPUT_DIR;/gen_vx_mask/GRID_NAMED_GRIDS_mask.nc</grid_nc>
</output>
</test>

<!-- -->
<!-- GRID: grid specification strings -->
<!-- -->

<test name="gen_vx_mask_GRID_SPEC_STRINGS">
<exec>&MET_BIN;/gen_vx_mask</exec>
<param> \
"latlon 720 361 -90 0 0.5 0.5" \
"latlon 200 100 -40 -50 0.5 0.5" \
&OUTPUT_DIR;/gen_vx_mask/GRID_SPEC_STRINGS_mask.nc \
-type grid -name grid_spec \
-v 1
</param>
<output>
<grid_nc>&OUTPUT_DIR;/gen_vx_mask/GRID_SPEC_STRINGS_mask.nc</grid_nc>
</output>
</test>

<!-- -->
<!-- CIRCLE: compute minimum distances rather than a mask -->
<!-- -->
Expand Down

0 comments on commit fa61672

Please sign in to comment.