diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 7a9a1f28dc..40c22d80e9 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -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 diff --git a/docs/Users_Guide/appendixB.rst b/docs/Users_Guide/appendixB.rst index a4d155a04f..c817e54a89 100644 --- a/docs/Users_Guide/appendixB.rst +++ b/docs/Users_Guide/appendixB.rst @@ -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 @@ -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 diff --git a/internal/scripts/installation/config/install_met_env.wcoss2_py3.10 b/internal/scripts/installation/config/install_met_env.wcoss2_py3.10 index ea9589e838..20244d34a1 100644 --- a/internal/scripts/installation/config/install_met_env.wcoss2_py3.10 +++ b/internal/scripts/installation/config/install_met_env.wcoss2_py3.10 @@ -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 @@ -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 diff --git a/internal/test_unit/xml/unit_plot_data_plane.xml b/internal/test_unit/xml/unit_plot_data_plane.xml index e9e5ae965f..298b68c7b3 100644 --- a/internal/test_unit/xml/unit_plot_data_plane.xml +++ b/internal/test_unit/xml/unit_plot_data_plane.xml @@ -564,4 +564,18 @@ + + &MET_BIN;/plot_data_plane + \ + &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 + + + &OUTPUT_DIR;/plot_data_plane/visibility_in_air_by_percentile.ps + + + diff --git a/src/basic/vx_math/ptile.cc b/src/basic/vx_math/ptile.cc index 6bf84ce5e0..9812403a84 100644 --- a/src/basic/vx_math/ptile.cc +++ b/src/basic/vx_math/ptile.cc @@ -23,6 +23,7 @@ using namespace std; #include "is_bad_data.h" #include "nint.h" +#include "vx_log.h" /////////////////////////////////////////////////////////////////////////////// @@ -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 ); @@ -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]; + } } diff --git a/src/libcode/vx_data2d_nccf/data2d_nccf.cc b/src/libcode/vx_data2d_nccf/data2d_nccf.cc index f8b251c6d1..d0fcb98dcf 100644 --- a/src/libcode/vx_data2d_nccf/data2d_nccf.cc +++ b/src/libcode/vx_data2d_nccf/data2d_nccf.cc @@ -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 @@ -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; diff --git a/src/libcode/vx_data2d_nccf/nccf_file.cc b/src/libcode/vx_data2d_nccf/nccf_file.cc index 9c562bb74f..7ac0c9fdf0 100644 --- a/src/libcode/vx_data2d_nccf/nccf_file.cc +++ b/src/libcode/vx_data2d_nccf/nccf_file.cc @@ -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]; } @@ -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)) { diff --git a/src/libcode/vx_grid/.find_grid_by_name.h.swp b/src/libcode/vx_grid/.find_grid_by_name.h.swp deleted file mode 100644 index 92793bd4ea..0000000000 Binary files a/src/libcode/vx_grid/.find_grid_by_name.h.swp and /dev/null differ