Skip to content

Commit

Permalink
Update main_v11.1-ref after #2653 (#2656)
Browse files Browse the repository at this point in the history
Co-authored-by: John Halley Gotway <[email protected]>
Co-authored-by: Seth Linden <[email protected]>
Co-authored-by: jprestop <[email protected]>
Co-authored-by: Daniel Adriaansen <[email protected]>
Co-authored-by: John and Cindy <[email protected]>
Co-authored-by: Howard Soh <[email protected]>
Co-authored-by: George McCabe <[email protected]>
Co-authored-by: hsoh-u <[email protected]>
Co-authored-by: MET Tools Test Account <[email protected]>
Co-authored-by: Seth Linden <[email protected]>
Co-authored-by: lisagoodrich <[email protected]>
Co-authored-by: davidalbo <[email protected]>
Co-authored-by: Lisa Goodrich <[email protected]>
Co-authored-by: metplus-bot <[email protected]>
Co-authored-by: j-opatz <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Jonathan Vigh <[email protected]>
Co-authored-by: David Albo <[email protected]>
Co-authored-by: Tracy Hertneky <[email protected]>
Co-authored-by: Dan Adriaansen <[email protected]>
Fix Python environment issue (#2407)
fix definitions of G172 and G220 based on comments in NOAA-EMC/NCEPLIBS-w3emc#157. (#2406)
fix #2380 develop override (#2382)
fix #2408 develop empty config (#2410)
fix #2390 develop compile zlib (#2404)
fix #2412 develop climo (#2422)
fix #2437 develop convert (#2439)
fix for develop, for #2437, forgot one reference to the search_parent for a dictionary lookup.
fix #2452 develop airnow (#2454)
fix #2449 develop pdf (#2464)
fix #2402 develop sonarqube (#2468)
fix #2426 develop buoy (#2475)
fix 2518 dtypes appf docs (#2519)
fix 2531 compilation errors (#2533)
fix #2531 compilation_errors_configure (#2535)
fix 2596 main v11.1 rpath compilation (#2614)
fix #2514 main_v11.1 clang (#2628)
fix #2644 main_v11.1 percentile (#2646)
  • Loading branch information
JohnHalleyGotway authored Aug 21, 2023
1 parent ca66893 commit adfe398
Show file tree
Hide file tree
Showing 8 changed files with 85 additions and 26 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,13 @@ jobs:
needs: [job_control]
if: ${{ needs.job_control.outputs.run_unit_tests == 'true' }}
steps:
- uses: dtcenter/metplus-action-data-update@v2
- uses: dtcenter/metplus-action-data-update@v3
with:
docker_name: ${{ secrets.DOCKER_USERNAME }}
docker_pass: ${{ secrets.DOCKER_PASSWORD }}
repo_name: ${{ github.repository }}
data_prefix: unit_test
branch_name: ${{ needs.job_control.outputs.branch_name }}
branch_name: ${{ needs.job_control.outputs.truth_data_version }}
docker_data_dir: /data/input/MET_test_data
data_repo_dev: met-data-dev

Expand Down
4 changes: 0 additions & 4 deletions docs/Users_Guide/appendixB.rst
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,6 @@ The NCEP verification regions that are implemented in MET as lat/lon polylines a

* NAK.poly for Northern Alaska

* NAO.poly for Northern Atlantic Ocean

* NEC.poly for the Northern East Coast

* NMT.poly for the Northern Mountain Region
Expand All @@ -162,8 +160,6 @@ The NCEP verification regions that are implemented in MET as lat/lon polylines a

* SPL.poly for the Southern Plains

* SPO.poly for the Southern Pacific Ocean

* SWC.poly for the Southern West Coast

* SWD.poly for the Southwest Desert
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module reset
module use /apps/ops/para/libs/modulefiles/compiler/intel/19.1.3.304
export HPC_OPT=/apps/ops/para/libs
module use /apps/dev/modulefiles/
module load ve/evs/1.0
module load ve/evs/2.0
module load netcdf/4.7.4
module load hdf5/1.10.6
module load bufr/11.6.0
Expand All @@ -12,13 +12,13 @@ module load libpng/1.6.37
module load gsl/2.7
module load g2c/1.6.4

#export TEST_BASE=/apps/ops/para/libs/intel/19.1.3.304/met/11.1.0-rc1
#export TEST_BASE=/apps/ops/para/libs/intel/19.1.3.304/met/11.1.0
export TEST_BASE=$(pwd)
export LIB_DIR=${TEST_BASE}/external_libs
export BIN_DIR_PATH=${TEST_BASE}/bin
export COMPILER=intel_19.1.3.304
export MET_SUBDIR=${TEST_BASE}
export MET_TARBALL=v11.1.0-rc1.tar.gz
export MET_TARBALL=v11.1.0.tar.gz
export USE_MODULES=TRUE
export ADDTL_DIR=/apps/spack/gettext/0.21/intel/19.1.3.304/at2kdo4edvuhyzrt5g6zhwrdb7bdui4s/lib64
export PYTHON_MODULE=python_3.10.4
Expand Down
14 changes: 14 additions & 0 deletions internal/test_unit/xml/unit_plot_data_plane.xml
Original file line number Diff line number Diff line change
Expand Up @@ -564,4 +564,18 @@
</output>
</test>

<test name="plot_data_plane_NCCF_not_standard_vertical_levels">
<exec>&MET_BIN;/plot_data_plane</exec>
<param> \
&DATA_DIR_MODEL;/nccf/percentile_extract_20230729T1200Z-B20230725T0030Z-visibility_at_screen_level.nc \
&OUTPUT_DIR;/plot_data_plane/visibility_in_air_by_percentile.ps \
'name="visibility_in_air"; level="(6,*,*)";' \
-title "Visibility in air" \
-v 1
</param>
<output>
<ps>&OUTPUT_DIR;/plot_data_plane/visibility_in_air_by_percentile.ps</ps>
</output>
</test>

</met_test>
49 changes: 44 additions & 5 deletions src/basic/vx_math/ptile.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ using namespace std;
#include "is_bad_data.h"

#include "nint.h"
#include "vx_log.h"


///////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -63,10 +64,31 @@ int index;
double delta;
double p = bad_data_double;

// Range check
if ( t < 0.0 || t > 1.0 ) {

mlog << Error << "\npercentile() -> "
<< "requested percentile value (" << t
<< ") must be between 0 and 1!\n\n";

exit ( 1 );

}

if ( n > 0 ) {

index = nint(floor((n - 1)*t));
delta = (n-1)*t - index;
p = (1 - delta)*ordered_array[index] + delta*ordered_array[index+1];

// Use the last value
if ( index == (n - 1) ) {
p = ordered_array[index];
}
// Interpolate linearly between two values
else if ( index >= 0 && index < (n - 1) ) {
delta = (n - 1)*t - index;
p = (1 - delta)*ordered_array[index] + delta*ordered_array[index + 1];
}

}

return ( p );
Expand Down Expand Up @@ -101,13 +123,30 @@ int index;
float delta;
float p = bad_data_float;

// Range check
if ( t < 0.0 || t > 1.0 ) {

mlog << Error << "\npercentile_f() -> "
<< "requested percentile value (" << t
<< ") must be between 0 and 1!\n\n";

exit ( 1 );

}

if ( n > 0 ) {

index = nint(floor((n - 1)*t));

delta = (n - 1)*t - index;

p = (1 - delta)*(ordered_array[index]) + delta*(ordered_array[index + 1]);
// Use the last value
if ( index == (n - 1) ) {
p = ordered_array[index];
}
// Interpolate linearly between two values
else if ( index >= 0 && index < (n - 1) ) {
delta = (n - 1)*t - index;
p = (1 - delta)*ordered_array[index] + delta*ordered_array[index + 1];
}

}

Expand Down
23 changes: 13 additions & 10 deletions src/libcode/vx_data2d_nccf/data2d_nccf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -227,15 +227,19 @@ bool MetNcCFDataFile::data_plane(VarInfo &vinfo, DataPlane &plane)
}
else {
long z_cnt = (long)_file->vlevels.n();
if (z_cnt > 0) {

zdim_slot = idx;
// Checks if the data veriable has a vertical dimension
if (0 <= data_var->z_slot) {
org_z_offset = dim_offset;
long z_offset = dim_offset;
string z_dim_name;

zdim_slot = idx;
if (0 <= data_var->z_slot) {
NcDim z_dim = get_nc_dim(data_var->var, data_var->z_slot);
if (IS_VALID_NC(z_dim)) z_dim_name = GET_NC_NAME(z_dim);
if (IS_VALID_NC(z_dim)) {
z_dim_name = GET_NC_NAME(z_dim);
z_cnt = get_dim_size(&z_dim); // override the virtical level count
}
}
if (!is_offset[idx]) {
// convert the value to index for slicing
Expand Down Expand Up @@ -663,12 +667,11 @@ long MetNcCFDataFile::convert_value_to_offset(double z_value, string z_dim_name)
}
}

if (!found && 0 < z_dim_name.length()) {
NcVarInfo *var_info = find_var_info_by_dim_name(_file->Var, z_dim_name, _file->Nvars);
if (var_info) {
long new_offset = get_index_at_nc_data(var_info->var, z_value, z_dim_name);
if (new_offset != bad_data_int) z_offset = new_offset;
}
// Overrides if the variable specific vertical dimension exists
NcVarInfo *var_info = find_var_info_by_dim_name(_file->Var, z_dim_name, _file->Nvars);
if (var_info) {
long new_offset = get_index_at_nc_data(var_info->var, z_value, z_dim_name);
z_offset = new_offset;
}

return z_offset;
Expand Down
11 changes: 9 additions & 2 deletions src/libcode/vx_data2d_nccf/nccf_file.cc
Original file line number Diff line number Diff line change
Expand Up @@ -257,9 +257,9 @@ bool NcCfFile::open(const char * filepath)
else if( "latitude" == att_value ) _latVar = Var[j].var;
else if( "longitude" == att_value ) _lonVar = Var[j].var;
else if( ("air_pressure" == att_value || "height" == att_value)
&& (0 == z_var) ) z_var = Var[j].var;
&& (nullptr==z_var && 1==get_dim_count(Var[j].var))) z_var = Var[j].var;
}
if ( Var[j].name == "time" && (valid_time_var == 0)) {
if ( Var[j].name == "time" && (valid_time_var == nullptr)) {
valid_time_var = Var[j].var;
_time_var_info = &Var[j];
}
Expand Down Expand Up @@ -490,6 +490,13 @@ bool NcCfFile::open(const char * filepath)
if (info) z_var = info->var;
}

mlog << Debug(5) << method_name << "coordinate variables:"
<< " x=" << (IS_VALID_NC_P(_xCoordVar) ? GET_NC_NAME_P(_xCoordVar) : "N/A")
<< ", y=" << (IS_VALID_NC_P(_yCoordVar) ? GET_NC_NAME_P(_yCoordVar) : "N/A")
<< ", z=" << (IS_VALID_NC_P(z_var) ? GET_NC_NAME_P(z_var) : "N/A")
<< ", t=" << (IS_VALID_NC_P(valid_time_var) ? GET_NC_NAME_P(valid_time_var) : "N/A")
<< "\n";

// Pull out the vertical levels
if (IS_VALID_NC_P(z_var)) {

Expand Down
Binary file removed src/libcode/vx_grid/.find_grid_by_name.h.swp
Binary file not shown.

0 comments on commit adfe398

Please sign in to comment.