From 49b4540b368b2785b8315d5276213f829a7ad245 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 26 Sep 2024 13:46:57 -0600 Subject: [PATCH] Update main_v11.1-ref after dtcenter/MET#2980 (#2982) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add user execute permissions to compile script - main_v11.1 (#2740) * Changing -j to "-j 5" as the recommended value for MAKE_ARGS * Per #2761, update the MET development environment after upgrading seneca to debian bookworm. * Per #2761, define runtime python version for testing rather than using the default version which no longer exists in /usr/local * Per #2761, fix setting ci-skip-all * Per #2761, patching test_util.R to use the -C command line option for ncdiff. * #2652 Added find_var_by_standard_name and separated common codes to find_xy_vars * #2757 The SonarQube token and URL are replaced with the pre-defined strings, SONAR_TOKEN_VALUE and SONAR_SERVER_URL * #2757 Get the email list from the environment variable MET_CRON_EMAIL_LIST__MET (or MET_CRON_EMAIL_LIST) * #2757 The SonarQube token and URL are replaced by using the environment variable SONAR_TOKEN_VALUE and SONAR_SERVER_URL * Bugfix #2760 main_v11.1 --enable-python (#2767) * #2755 Added a header count and checking header count instead of using header id (hid) * Bugfix #2782 main_v11.1 MASSDEN (#2784) * Per #2782, update the multiple matching records warning message to include the table number for each record. * Per #2782, update read_grib2_record_list() to parse the level values and aerosol information correctly for table 4.48. * Per #2782 tweak variable naming convention. * Removing ${MAKE_ARGS} in some locations Removing ${MAKE_ARGS} from "make install" and "make test" for MET. Removing "met" prefix from met.configure.log because we really need config.log for any detail. It is confusing to have met.configure.log when that does not contain useful information. * Adding -lnetcdf -lm to configure_lib_args for NetCDF-CXX * Feature #2796 main_v11.1 gha node20 (#2798) * Per #2796, update versions of actions to fix the node 16 to 20 warning message. * Per #2796, port fixes for artifact name handling over from the develop branch to the main_v11.1 testing workflow. Also add the compilation_options.yml workflow since the workflows are being updated. * Create 11.1.0_casper * Recent changes to branch protection rules for the main_vX.Y branches have broken the logic of the update_truth.yml GHA workflow. Instead of submitting a PR to merge main_vX.Y into main_vX.Y-ref directly, use an intermediate update_truth_for_main_vX.Y branch. * Update the pull request template to include a question about expected impacts to existing METplus Use Cases. * Bugfix #2833 main_v11.1 azimuth (#2834) * Per #2833, fix n-1 bug when defining the azimuth delta for range/azimuth grids. * Per #2833, port fixes over from the bugfix_2833_develop_azimuth branch over to the main_v11.1 branch. --------- Co-authored-by: MET Tools Test Account * Feature #2379 main_v11.1 sonarqube GHA (#2848) * Per #2379, migrating largely the same changes for #2379 into the main_v11.1 branch. The difference is that --enable-all is not used since that is not a valid configuration option for MET version 11.1.0. * Hotfix related to #2379. The sonar.newCode.referenceBranch and sonar.branch.name cannot be set to the same string! Only add the newCode definition when they differ. * Feature #2379 main_v11.1 sonarqube updates (#2851) * Feature #2379 main_v11.1 single_sq_project (#2866) * Bugfix 2867 point2grid qc flag main v11.1 (#2874) * #2867 Added point2grid_GOES_16_ADP_Enterprise_high and changed qc flags for ADP * #2867 Added get_nc_att_values_ * #2867 Added get_nc_att_values * #2867 Get the ADP QC flag values from the varibale attributes (support GOES16 Enterprise allgorithm) and apply them for QC Flags. Adjusted the ADP QC flags based on the variable QC values --------- Co-authored-by: Howard Soh * Bugfix 2867 point2grid qc flag main v11.1 (#2878) * #2867 Added point2grid_GOES_16_ADP_Enterprise_high and changed qc flags for ADP * #2867 Added get_nc_att_values_ * #2867 Added get_nc_att_values * #2867 Get the ADP QC flag values from the varibale attributes (support GOES16 Enterprise allgorithm) and apply them for QC Flags. Adjusted the ADP QC flags based on the variable QC values * #2867 Added adjusted confidnece counts * #2867 Corretced indent * #2867 Corretced indent --------- Co-authored-by: Howard Soh * #2884 No filtering by QC flags without -qc option (#2885) Co-authored-by: Howard Soh * Per #2659, making updates as proposed at the 20240516 MET Eng. Mtg. (#2896) * Bugfix #2897 main_v11.1 python_valid_time (#2898) * Per #2897, fix typos in 3 log messages. Also fix the bug in storing the valid time strings. The time string in vld_array should exactly correspond to the numeric unixtime values in vld_num_array. Therefore they need to be updated inside the same if block. The bug is that we were storing only the unique unixtime values but storing ALL of the valid time string, not just the unique ones. * Per #2897, don’t waste time searching, just set vld_odd to n-1 * #2687 Saved the PBL input into the vector (#2903) * #2904 Changed R path to R-4.4.0 (#2909) Co-authored-by: Howard Soh * Bugfix #2856 main_v11.1 ens_climo (#2917) * Per #2856, reinitialize the climo cdf info pointer. * Per #2856, update the testing.yml workflow dispatch option to let the comparison branch be manually defined. * Revert "Per #2856, reinitialize the climo cdf info pointer." This reverts commit 99b6bb346c95c3964e3ef6680aae54932faf10ae. * Per #2856, reinitialize the climo cdf info pointer. * Revert "Per #2856, update the testing.yml workflow dispatch option to let the comparison branch be manually defined." This reverts commit 0ae224faf940d406f4a6e507289d08d63d6d0256. * Per #2856, update the truth_data_version and input_data_version if main_vX.Y is not present in the branch name. * Update set_job_controls.sh * Update set_job_controls.sh * Per #2856, update logic for counting the maximum number of PCT, PRC, PJC, and PSTD lines. Need to multiply by the number of climo cdf bins. * Per #2856, add more error checking to avoid writing nan to .stat output files * Bugfix #2841 main_v11.1 tang_rad_winds (#2920) * Per #2841, unrelated, just removing a spurious character from a log message. * Per #2841, work in progress. Mostly just modifying whitespace and log messages so far * Per #2841, running tc_rmw with only UGRD input causes the tool to hang. Adding break statements to prevent the hang. * Per #2841, add new has_pressure_level() utility function and update tc_rmw to use it to deteremine whether or not the pressure dimension should be written the output rather than basing that off the number of levels being > 1. * Per #1849, fix to radial and tangential winds. * Per #2841, just changing a code comment about the longitude swap * Per #2841, update variable names for consistency and understanding. * Per #2841, the substantive bug fixed here is how we index into the U and V data in wind_ne_to_rt() using i_rev instead of i. Also, update the variable names for consistency and clarity.. * Per #2841, patch apparent copy/paste bug in tcrmw_grid.cc code. * Per #2841, only changing whitespace. * Per #2841, update logic in EarthRotation::set_tcrmw() to change the rotation of TCRMW grids from pointing north to pointing east. * Per #2841, fix warning message * Replace tab with spaces * Per #2841, correct the units for the azimuth netcdf output variable * Per #2841, reverse the x dimension of the rotated latlon grid to effectively switch from counterclockwise rotation to clockwise. * Feature #2855 v11.1.1 (#2923) * Per #2855, add v11.1.1 release notes. * Per #2841, fix bold formatting of release notes. * Update conf.py with actual 11.1.1 release date * bugfix #2936 point2grid for tripolar GFS input (#2945) * #2936 Support 1D lat/lon values * #2936 Change obs_type to TYPE_NCCF if FileType_NcCF is given from the config file --------- Co-authored-by: Howard Soh * Bugfix #2958 main_v11.1 BAGSS SEDI CI (#2960) * Bugfix #2958 main_v11.1 ORSS (#2972) Co-authored-by: MET Tools Test Account * Bugfix #2979 main_v11.1 MTD Grid (#2980) * Per #2979, remove nc_grid.h/.cc and replace it with calls to the read_netcdf_grid(...) and write_netcdf_proj(...) library utility functions. Note that these changes do compile but I haven't tested whether they actually fix the underlying problem. Also note that nc_utils_local.h/.cc can also likely be replaced with calls to common library functions. * Per #2979, remove references to nc_grid.o from the MTD test code. * Per #2979, the write_netcdf_proj(...) utility function adds the lat and lon dimensions. Update mtd to NOT define those dimensions prior to calling write_netcdf_proj(...). * Per #2979, add this issue to the revision history. --------- Co-authored-by: George McCabe <23407799+georgemccabe@users.noreply.github.com> Co-authored-by: Julie Prestopnik Co-authored-by: John Halley Gotway Co-authored-by: MET Tools Test Account Co-authored-by: Howard Soh Co-authored-by: Howard Soh Co-authored-by: metplus-bot <97135045+metplus-bot@users.noreply.github.com> --- .../tools/other/mode_time_domain/Makefile.am | 1 - .../tools/other/mode_time_domain/Makefile.in | 2 - src/tools/other/mode_time_domain/Makefile.am | 1 - src/tools/other/mode_time_domain/Makefile.in | 34 +- src/tools/other/mode_time_domain/mtd.cc | 1 + .../other/mode_time_domain/mtd_file_base.cc | 14 +- .../other/mode_time_domain/mtd_nc_output.cc | 12 +- .../other/mode_time_domain/mtd_nc_output.h | 1 - src/tools/other/mode_time_domain/nc_grid.cc | 665 ------------------ src/tools/other/mode_time_domain/nc_grid.h | 41 -- 10 files changed, 21 insertions(+), 751 deletions(-) delete mode 100644 src/tools/other/mode_time_domain/nc_grid.cc delete mode 100644 src/tools/other/mode_time_domain/nc_grid.h diff --git a/internal/test_util/tools/other/mode_time_domain/Makefile.am b/internal/test_util/tools/other/mode_time_domain/Makefile.am index 3dc14e906c..c1204dcfc4 100644 --- a/internal/test_util/tools/other/mode_time_domain/Makefile.am +++ b/internal/test_util/tools/other/mode_time_domain/Makefile.am @@ -38,7 +38,6 @@ test_velocity_LDADD = \ ${top_builddir}/src/tools/other/mode_time_domain/mtd-mtd_partition.o \ ${top_builddir}/src/tools/other/mode_time_domain/mtd-mtd_read_data.o \ ${top_builddir}/src/tools/other/mode_time_domain/mtd-mtd_txt_output.o \ - ${top_builddir}/src/tools/other/mode_time_domain/mtd-nc_grid.o \ ${top_builddir}/src/tools/other/mode_time_domain/mtd-nc_utils_local.o \ -lvx_pxm \ -lvx_plot_util \ diff --git a/internal/test_util/tools/other/mode_time_domain/Makefile.in b/internal/test_util/tools/other/mode_time_domain/Makefile.in index 334d885de7..01d9419636 100644 --- a/internal/test_util/tools/other/mode_time_domain/Makefile.in +++ b/internal/test_util/tools/other/mode_time_domain/Makefile.in @@ -125,7 +125,6 @@ test_velocity_DEPENDENCIES = ${top_builddir}/src/tools/other/mode_time_domain/mt ${top_builddir}/src/tools/other/mode_time_domain/mtd-mtd_partition.o \ ${top_builddir}/src/tools/other/mode_time_domain/mtd-mtd_read_data.o \ ${top_builddir}/src/tools/other/mode_time_domain/mtd-mtd_txt_output.o \ - ${top_builddir}/src/tools/other/mode_time_domain/mtd-nc_grid.o \ ${top_builddir}/src/tools/other/mode_time_domain/mtd-nc_utils_local.o \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) test_velocity_LINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \ @@ -362,7 +361,6 @@ test_velocity_LDADD = \ ${top_builddir}/src/tools/other/mode_time_domain/mtd-mtd_partition.o \ ${top_builddir}/src/tools/other/mode_time_domain/mtd-mtd_read_data.o \ ${top_builddir}/src/tools/other/mode_time_domain/mtd-mtd_txt_output.o \ - ${top_builddir}/src/tools/other/mode_time_domain/mtd-nc_grid.o \ ${top_builddir}/src/tools/other/mode_time_domain/mtd-nc_utils_local.o \ -lvx_pxm \ -lvx_plot_util \ diff --git a/src/tools/other/mode_time_domain/Makefile.am b/src/tools/other/mode_time_domain/Makefile.am index 44cdb1d48c..f365943e88 100644 --- a/src/tools/other/mode_time_domain/Makefile.am +++ b/src/tools/other/mode_time_domain/Makefile.am @@ -13,7 +13,6 @@ bin_PROGRAMS = mtd mtd_SOURCES = mtd.cc \ mtdfiletype_to_string.cc mtdfiletype_to_string.h \ nc_utils_local.cc nc_utils_local.h \ - nc_grid.cc nc_grid.h \ 3d_moments.cc 3d_moments.h \ 2d_moments.cc 2d_moments.h \ fo_node.cc fo_node.h \ diff --git a/src/tools/other/mode_time_domain/Makefile.in b/src/tools/other/mode_time_domain/Makefile.in index 150fee1f33..309eaf9162 100644 --- a/src/tools/other/mode_time_domain/Makefile.in +++ b/src/tools/other/mode_time_domain/Makefile.in @@ -102,13 +102,13 @@ CONFIG_CLEAN_VPATH_FILES = am__installdirs = "$(DESTDIR)$(bindir)" PROGRAMS = $(bin_PROGRAMS) am_mtd_OBJECTS = mtd-mtd.$(OBJEXT) mtd-mtdfiletype_to_string.$(OBJEXT) \ - mtd-nc_utils_local.$(OBJEXT) mtd-nc_grid.$(OBJEXT) \ - mtd-3d_moments.$(OBJEXT) mtd-2d_moments.$(OBJEXT) \ - mtd-fo_node.$(OBJEXT) mtd-fo_node_array.$(OBJEXT) \ - mtd-fo_graph.$(OBJEXT) mtd-mtd_config_info.$(OBJEXT) \ - mtd-mtd_file_base.$(OBJEXT) mtd-mtd_file_float.$(OBJEXT) \ - mtd-mtd_file_int.$(OBJEXT) mtd-mtd_read_data.$(OBJEXT) \ - mtd-3d_att.$(OBJEXT) mtd-3d_att_single_array.$(OBJEXT) \ + mtd-nc_utils_local.$(OBJEXT) mtd-3d_moments.$(OBJEXT) \ + mtd-2d_moments.$(OBJEXT) mtd-fo_node.$(OBJEXT) \ + mtd-fo_node_array.$(OBJEXT) mtd-fo_graph.$(OBJEXT) \ + mtd-mtd_config_info.$(OBJEXT) mtd-mtd_file_base.$(OBJEXT) \ + mtd-mtd_file_float.$(OBJEXT) mtd-mtd_file_int.$(OBJEXT) \ + mtd-mtd_read_data.$(OBJEXT) mtd-3d_att.$(OBJEXT) \ + mtd-3d_att_single_array.$(OBJEXT) \ mtd-3d_att_pair_array.$(OBJEXT) mtd-2d_att.$(OBJEXT) \ mtd-2d_att_array.$(OBJEXT) mtd-3d_conv.$(OBJEXT) \ mtd-mtd_txt_output.$(OBJEXT) mtd-mtd_nc_output.$(OBJEXT) \ @@ -151,7 +151,7 @@ am__depfiles_remade = ./$(DEPDIR)/mtd-2d_att.Po \ ./$(DEPDIR)/mtd-mtd_read_data.Po \ ./$(DEPDIR)/mtd-mtd_txt_output.Po \ ./$(DEPDIR)/mtd-mtdfiletype_to_string.Po \ - ./$(DEPDIR)/mtd-nc_grid.Po ./$(DEPDIR)/mtd-nc_utils_local.Po + ./$(DEPDIR)/mtd-nc_utils_local.Po am__mv = mv -f AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) @@ -357,7 +357,6 @@ MAINTAINERCLEANFILES = Makefile.in mtd_SOURCES = mtd.cc \ mtdfiletype_to_string.cc mtdfiletype_to_string.h \ nc_utils_local.cc nc_utils_local.h \ - nc_grid.cc nc_grid.h \ 3d_moments.cc 3d_moments.h \ 2d_moments.cc 2d_moments.h \ fo_node.cc fo_node.h \ @@ -525,7 +524,6 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mtd-mtd_read_data.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mtd-mtd_txt_output.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mtd-mtdfiletype_to_string.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mtd-nc_grid.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mtd-nc_utils_local.Po@am__quote@ # am--include-marker $(am__depfiles_remade): @@ -590,20 +588,6 @@ mtd-nc_utils_local.obj: nc_utils_local.cc @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mtd_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o mtd-nc_utils_local.obj `if test -f 'nc_utils_local.cc'; then $(CYGPATH_W) 'nc_utils_local.cc'; else $(CYGPATH_W) '$(srcdir)/nc_utils_local.cc'; fi` -mtd-nc_grid.o: nc_grid.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mtd_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT mtd-nc_grid.o -MD -MP -MF $(DEPDIR)/mtd-nc_grid.Tpo -c -o mtd-nc_grid.o `test -f 'nc_grid.cc' || echo '$(srcdir)/'`nc_grid.cc -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/mtd-nc_grid.Tpo $(DEPDIR)/mtd-nc_grid.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='nc_grid.cc' object='mtd-nc_grid.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mtd_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o mtd-nc_grid.o `test -f 'nc_grid.cc' || echo '$(srcdir)/'`nc_grid.cc - -mtd-nc_grid.obj: nc_grid.cc -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mtd_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT mtd-nc_grid.obj -MD -MP -MF $(DEPDIR)/mtd-nc_grid.Tpo -c -o mtd-nc_grid.obj `if test -f 'nc_grid.cc'; then $(CYGPATH_W) 'nc_grid.cc'; else $(CYGPATH_W) '$(srcdir)/nc_grid.cc'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/mtd-nc_grid.Tpo $(DEPDIR)/mtd-nc_grid.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='nc_grid.cc' object='mtd-nc_grid.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mtd_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o mtd-nc_grid.obj `if test -f 'nc_grid.cc'; then $(CYGPATH_W) 'nc_grid.cc'; else $(CYGPATH_W) '$(srcdir)/nc_grid.cc'; fi` - mtd-3d_moments.o: 3d_moments.cc @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mtd_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT mtd-3d_moments.o -MD -MP -MF $(DEPDIR)/mtd-3d_moments.Tpo -c -o mtd-3d_moments.o `test -f '3d_moments.cc' || echo '$(srcdir)/'`3d_moments.cc @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/mtd-3d_moments.Tpo $(DEPDIR)/mtd-3d_moments.Po @@ -1048,7 +1032,6 @@ distclean: distclean-am -rm -f ./$(DEPDIR)/mtd-mtd_read_data.Po -rm -f ./$(DEPDIR)/mtd-mtd_txt_output.Po -rm -f ./$(DEPDIR)/mtd-mtdfiletype_to_string.Po - -rm -f ./$(DEPDIR)/mtd-nc_grid.Po -rm -f ./$(DEPDIR)/mtd-nc_utils_local.Po -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ @@ -1118,7 +1101,6 @@ maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/mtd-mtd_read_data.Po -rm -f ./$(DEPDIR)/mtd-mtd_txt_output.Po -rm -f ./$(DEPDIR)/mtd-mtdfiletype_to_string.Po - -rm -f ./$(DEPDIR)/mtd-nc_grid.Po -rm -f ./$(DEPDIR)/mtd-nc_utils_local.Po -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic diff --git a/src/tools/other/mode_time_domain/mtd.cc b/src/tools/other/mode_time_domain/mtd.cc index 6c73beca85..227f8e0842 100644 --- a/src/tools/other/mode_time_domain/mtd.cc +++ b/src/tools/other/mode_time_domain/mtd.cc @@ -22,6 +22,7 @@ // 004 07-06-22 Howard Soh METplus-Internal #19 Rename main to met_main // 005 08-01-22 Albo MET #1971 Differing time steps // 006 10-03-22 Prestopnik MET #2227 Remove using namespace std from header files +// 007 09-25-24 Halley Gotway MET #2979 Fix for all supported projections // //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/mode_time_domain/mtd_file_base.cc b/src/tools/other/mode_time_domain/mtd_file_base.cc index 3f2ae5a5ce..e79decba08 100644 --- a/src/tools/other/mode_time_domain/mtd_file_base.cc +++ b/src/tools/other/mode_time_domain/mtd_file_base.cc @@ -26,9 +26,10 @@ using namespace netCDF; #include "mtd_file.h" #include "mtd_partition.h" #include "mtd_nc_defs.h" -#include "nc_grid.h" #include "nc_utils_local.h" #include "mtdfiletype_to_string.h" +#include "get_met_grid.h" +#include "write_netcdf.h" #include "vx_math.h" @@ -433,7 +434,7 @@ Nt = GET_NC_SIZE(dim); G = new Grid; -read_nc_grid(f, *G); +read_netcdf_grid(&f, *G); // timestamp info @@ -480,15 +481,16 @@ void MtdFileBase::write(NcFile & f) const char junk[256]; ConcatString s; - // Nx, Ny, Nt + // Add the time dimension -add_dim(&f, nx_dim_name, Nx); -add_dim(&f, ny_dim_name, Ny); add_dim(&f, nt_dim_name, Nt); // Grid -write_nc_grid(f, *G); +NcDim ny_dim; +NcDim nx_dim; + +write_netcdf_proj(&f, *G, ny_dim, nx_dim); // timestamp info diff --git a/src/tools/other/mode_time_domain/mtd_nc_output.cc b/src/tools/other/mode_time_domain/mtd_nc_output.cc index 7d831c3909..1b3cda7655 100644 --- a/src/tools/other/mode_time_domain/mtd_nc_output.cc +++ b/src/tools/other/mode_time_domain/mtd_nc_output.cc @@ -68,11 +68,9 @@ const bool have_pairs = (fcst_obj.n_objects() != 0) && ( obs_obj.n_objects() != 0); // - // dimensions + // add time dimension // -nx_dim = add_dim(&out, nx_dim_name, fcst_raw.nx()); -ny_dim = add_dim(&out, ny_dim_name, fcst_raw.ny()); nt_dim = add_dim(&out, nt_dim_name, fcst_raw.nt()); // @@ -82,7 +80,7 @@ nt_dim = add_dim(&out, nt_dim_name, fcst_raw.nt()); write_netcdf_global(&out, output_filename, "MTD", config.model.c_str(), config.obtype.c_str(), config.desc.c_str()); -write_nc_grid(out, fcst_raw.grid()); +write_netcdf_proj(&out, fcst_raw.grid(), ny_dim, nx_dim); // // variables @@ -150,11 +148,9 @@ if ( IS_INVALID_NC(out) ) { } // - // dimensions + // add time dimension // -nx_dim = add_dim(&out, nx_dim_name, raw.nx()); -ny_dim = add_dim(&out, ny_dim_name, raw.ny()); nt_dim = add_dim(&out, nt_dim_name, raw.nt()); // @@ -164,7 +160,7 @@ nt_dim = add_dim(&out, nt_dim_name, raw.nt()); write_netcdf_global(&out, output_filename, "MTD", config.model.c_str(), config.obtype.c_str(), config.desc.c_str()); -write_nc_grid(out, raw.grid()); +write_netcdf_proj(&out, raw.grid(), ny_dim, nx_dim); // // variables diff --git a/src/tools/other/mode_time_domain/mtd_nc_output.h b/src/tools/other/mode_time_domain/mtd_nc_output.h index 4ed161ee84..f0677e95ae 100644 --- a/src/tools/other/mode_time_domain/mtd_nc_output.h +++ b/src/tools/other/mode_time_domain/mtd_nc_output.h @@ -19,7 +19,6 @@ #include "mtd_nc_defs.h" -#include "nc_grid.h" #include "nc_utils_local.h" #include "mtd_file_float.h" diff --git a/src/tools/other/mode_time_domain/nc_grid.cc b/src/tools/other/mode_time_domain/nc_grid.cc deleted file mode 100644 index 00fab4f150..0000000000 --- a/src/tools/other/mode_time_domain/nc_grid.cc +++ /dev/null @@ -1,665 +0,0 @@ -// *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* -// ** Copyright UCAR (c) 1992 - 2023 -// ** University Corporation for Atmospheric Research (UCAR) -// ** National Center for Atmospheric Research (NCAR) -// ** Research Applications Lab (RAL) -// ** P.O.Box 3000, Boulder, Colorado, 80307-3000, USA -// *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* - - - -//////////////////////////////////////////////////////////////////////// - - -using namespace std; - -#include -#include -#include -#include -#include -#include - -#include -using namespace netCDF; - -#include "nc_utils_local.h" -#include "nc_grid.h" - - -//////////////////////////////////////////////////////////////////////// - - -static bool read_nc_st_grid (NcFile &, Grid &); -static bool read_nc_lc_grid (NcFile &, Grid &); -static bool read_nc_latlon_grid (NcFile &, Grid &); - -static void write_nc_st_grid (NcFile &, const StereographicData &); -static void write_nc_lc_grid (NcFile &, const LambertData &); -static void write_nc_latlon_grid (NcFile &, const LatLonData &); - - -//////////////////////////////////////////////////////////////////////// - - -bool read_nc_grid(NcFile & f, Grid & g) - -{ - - bool status = false; - ConcatString proj; - //const ConcatString proj = string_att(f, "Projection"); - get_att_value_string(&f, (string)"Projection", proj); - - - g.clear(); - - - if ( proj == "Polar Stereographic" ) { - - status = read_nc_st_grid(f, g); - - } else if ( proj == "Lambert Conformal" ) { - - status = read_nc_lc_grid(f, g); - - } else if ( proj == "LatLon" ) { - - status = read_nc_latlon_grid(f, g); - - } else { - - mlog << Error << "\n\n read_nc_grid() -> haven't written code to parse \"" << proj << "\" grids yet!\n\n"; - - return ( false ); - - } - - - // - // done - // - -return ( status ); - -} - - -//////////////////////////////////////////////////////////////////////// - - -bool write_nc_grid(NcFile & f, const Grid & g) - -{ - -GridInfo info = g.info(); - -if ( !(info.ok()) ) { - - mlog << Error << "\n\n write_nc_grid(NcFile &, const Grid &) -> can't get information from grid!\n\n"; - - exit ( 1 ); - -} - - if ( info.st ) write_nc_st_grid (f, *(info.st)); -else if ( info.lc ) write_nc_lc_grid (f, *(info.lc)); -else if ( info.ll ) write_nc_latlon_grid (f, *(info.ll)); -else { - - mlog << Error << "\n\n bool write_nc_grid(NcFile &, const Grid &) -> unsupported projection type\n\n"; - - exit ( 1 ); - -} - - // - // done - // - -return ( false ); - -} - - -//////////////////////////////////////////////////////////////////////// - - -bool read_nc_st_grid(NcFile & f, Grid & g) - -{ - - StereographicData data; - ConcatString c; - - // - // name - // - - data.name = "Unknown stereographic"; - - // - // hemisphere - // - - //c = string_att(f, "hemisphere"); - get_att_value_string(&f, (string)"hemisphere", c); - -data.hemisphere = c[0]; - - // - // scale latitude - // - -data.scale_lat = string_att_as_double(f, "scale_lat"); - - // - // lat/lon pin - // - -data.lat_pin = string_att_as_double(f, "lat_pin"); -data.lon_pin = string_att_as_double(f, "lon_pin"); - -data.lon_pin *= -1.0; - - // - // x/y pin - // - -data.x_pin = string_att_as_double(f, "x_pin"); -data.y_pin = string_att_as_double(f, "y_pin"); - - // - // orientation longitude - // - -data.lon_orient = string_att_as_double(f, "lon_orient"); - -data.lon_orient *= -1.0; - - // - // D, R - // - -data.d_km = string_att_as_double(f, "d_km"); -data.r_km = string_att_as_double(f, "r_km"); - - // - // Nx, Ny - // - -data.nx = string_att_as_int(f, "nx"); -data.ny = string_att_as_int(f, "ny"); - -data.eccentricity = 0.; -data.false_east = 0.; -data.false_north = 0.; -data.scale_factor = 1.0; -data.dy_km = data.d_km; - - // - // done - // - -g.set(data); - -return ( true ); - -} - - -//////////////////////////////////////////////////////////////////////// - - -bool read_nc_lc_grid(NcFile & f, Grid & g) - -{ - -LambertData data; -g.clear(); - - // - // name - // - -data.name = "Unknown lambert"; - - // - // scale latitudes - // - -data.scale_lat_1 = string_att_as_double(f, "scale_lat_1"); -data.scale_lat_2 = string_att_as_double(f, "scale_lat_2"); - - // - // lat/lon pin - // - -data.lat_pin = string_att_as_double(f, "lat_pin"); -data.lon_pin = string_att_as_double(f, "lon_pin"); - -data.lon_pin *= -1.0; - - // - // x/y pin - // - -data.x_pin = string_att_as_double(f, "x_pin"); -data.y_pin = string_att_as_double(f, "y_pin"); - - // - // orientation longitude - // - -data.lon_orient = string_att_as_double(f, "lon_orient"); - -data.lon_orient *= -1.0; - - // - // D, R - // - -data.d_km = string_att_as_double(f, "d_km"); -data.r_km = string_att_as_double(f, "r_km"); - - // - // Nx, Ny - // - -data.nx = string_att_as_int(f, "nx"); -data.ny = string_att_as_int(f, "ny"); - - // - // Rotation angle - // - -data.so2_angle = 0.0; - - // - // done - // - -g.set(data); - -return ( true ); - -} - - -//////////////////////////////////////////////////////////////////////// - - -bool read_nc_latlon_grid(NcFile & f, Grid & g) - -{ - -LatLonData data; - -g.clear(); - - // - // name - // - -data.name = "Unknown latlon"; - - // - // lower-left lat/lon - // - -data.lat_ll = string_att_as_double(f, "lat_ll"); -data.lon_ll = string_att_as_double(f, "lon_ll"); - -data.lon_ll = -(data.lon_ll); - - // - // lat/lon deltas - // - -data.delta_lat = string_att_as_double(f, "delta_lat"); -data.delta_lon = string_att_as_double(f, "delta_lon"); - - // - // grid size - // - -data.Nlat = string_att_as_int(f, "Nlat"); -data.Nlon = string_att_as_int(f, "Nlon"); - - - // - // done - // - -g.set(data); - -return ( true ); - -} - - -//////////////////////////////////////////////////////////////////////// - - -void write_nc_st_grid(NcFile & f, const StereographicData & data) - -{ - -ConcatString junk; -ConcatString j2; - - // - // name - // - -add_att(&f, "Projection", "Polar Stereographic"); - - // - // hemisphere - // - -junk = data.hemisphere; - -add_att(&f, "hemisphere", junk); - - // - // scale latitude - // - - j2.format("%.5f", data.scale_lat); - -fix_float(j2); - - junk.format("%s degrees_north", j2.c_str()); - -add_att(&f, "scale_lat", junk); - - // - // lat/lon pin point - // - -junk.format("%.5f", data.lat_pin); - -fix_float(junk); - -add_att(&f, "lat_pin", junk); - - - junk.format("%.5f", -(data.lon_pin)); - -fix_float(junk); - -add_att(&f, "lon_pin", junk); - - // - // x/y pin point - // - - junk.format("%.5f", data.x_pin); - -fix_float(junk); - -add_att(&f, "x_pin", junk); - - - junk.format("%.5f", data.y_pin); - -fix_float(junk); - -add_att(&f, "y_pin", junk); - - // - // orientation longitude - // - - junk.format("%.5f", -(data.lon_orient)); - -fix_float(junk); - -add_att(&f, "lon_orient", junk); - - // - // D and R - // - - j2.format("%.5f", data.d_km); - -fix_float(j2); - - junk.format("%s km", j2.c_str()); - -add_att(&f, "d_km", junk); - - - j2.format("%.5f", data.r_km); - -fix_float(j2); - - junk.format("%s km", j2.c_str()); - -add_att(&f, "r_km", junk); - - // - // nx and ny - // - - junk.format("%d", data.nx); - -add_att(&f, "nx", junk); - - - junk.format("%d", data.ny); - -add_att(&f, "ny", junk); - - - // - // done - // - -return; - -} - - -//////////////////////////////////////////////////////////////////////// - - -void write_nc_lc_grid(NcFile & f, const LambertData & data) - -{ - -ConcatString junk; -ConcatString j2; - - // - // name - // - -add_att(&f, "Projection", "Lambert Conformal"); - - // - // scale latitudes - // - - junk.format("%.5f", data.scale_lat_1); - -fix_float(junk); - -add_att(&f, "scale_lat_1", junk); - - - junk.format("%.5f", data.scale_lat_2); - -fix_float(junk); - -add_att(&f, "scale_lat_2", junk); - - // - // lat/lon pin point - // - - junk.format("%.5f", data.lat_pin); - -fix_float(junk); - -add_att(&f, "lat_pin", junk); - - - junk.format("%.5f", -(data.lon_pin)); - -fix_float(junk); - -add_att(&f, "lon_pin", junk); - - // - // x/y pin point - // - - junk.format("%.5f", data.x_pin); - -fix_float(junk); - -add_att(&f, "x_pin", junk); - - - junk.format("%.5f", data.y_pin); - -fix_float(junk); - -add_att(&f, "y_pin", junk); - - // - // orientation longitude - // - - junk.format("%.5f", -(data.lon_orient)); - -fix_float(junk); - -add_att(&f, "lon_orient", junk); - - // - // D and R - // - - j2.format("%.5f", data.d_km); - -fix_float(j2); - - junk.format("%s km", j2.c_str()); - -add_att(&f, "d_km", junk); - - - j2.format("%.5f", data.r_km); - -fix_float(j2); - - junk.format("%s km", j2.c_str()); - -add_att(&f, "r_km", junk); - - // - // nx and ny - // - - junk.format("%d", data.nx); - -add_att(&f, "nx", junk); - - - junk.format("%d", data.ny); - -add_att(&f, "ny", junk); - - - // - // done - // - -return; - -} - - -//////////////////////////////////////////////////////////////////////// - - -void write_nc_latlon_grid (NcFile & f, const LatLonData & data) - -{ - -ConcatString junk; - - - // - // name - // - -add_att(&f, "Projection", "LatLon"); - - // - // lower left point - // - - junk.format("%.5f", data.lat_ll); - -fix_float(junk); - -add_att(&f, "lat_ll", junk); - - - junk.format("%.5f", -(data.lon_ll)); - -fix_float(junk); - -add_att(&f, "lon_ll", junk); - - // - // lat/lon deltas - // - - junk.format("%.5f", data.delta_lat); - -fix_float(junk); - -add_att(&f, "delta_lat", junk); - - - junk.format("%.5f", data.delta_lon); - -fix_float(junk); - -add_att(&f, "delta_lon", junk); - - // - // grid size - // - - junk.format("%d", data.Nlat); - -fix_float(junk); - -add_att(&f, "Nlat", junk); - - - junk.format("%d", data.Nlon); - -fix_float(junk); - -add_att(&f, "Nlon", junk); - - - // - // done - // - -return; - -} - - -//////////////////////////////////////////////////////////////////////// - - diff --git a/src/tools/other/mode_time_domain/nc_grid.h b/src/tools/other/mode_time_domain/nc_grid.h deleted file mode 100644 index f3e111039c..0000000000 --- a/src/tools/other/mode_time_domain/nc_grid.h +++ /dev/null @@ -1,41 +0,0 @@ -// *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* -// ** Copyright UCAR (c) 1992 - 2023 -// ** University Corporation for Atmospheric Research (UCAR) -// ** National Center for Atmospheric Research (NCAR) -// ** Research Applications Lab (RAL) -// ** P.O.Box 3000, Boulder, Colorado, 80307-3000, USA -// *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* - - - -//////////////////////////////////////////////////////////////////////// - - -#ifndef __NETCDF_GRIDS_H__ -#define __NETCDF_GRIDS_H__ - - -//////////////////////////////////////////////////////////////////////// - - -#include "nc_utils.h" -#include "vx_grid.h" - - -//////////////////////////////////////////////////////////////////////// - - -extern bool read_nc_grid(netCDF::NcFile &, Grid &); - -extern bool write_nc_grid(netCDF::NcFile &, const Grid &); - - -//////////////////////////////////////////////////////////////////////// - - -#endif /* __NETCDF_GRIDS_H__ */ - - -//////////////////////////////////////////////////////////////////////// - -