Skip to content

Commit

Permalink
Per #2979, remove nc_grid.h/.cc and replace it with calls to the read…
Browse files Browse the repository at this point in the history
…_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.
  • Loading branch information
JohnHalleyGotway committed Sep 25, 2024
1 parent 5248377 commit d298957
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 739 deletions.
1 change: 0 additions & 1 deletion src/tools/other/mode_time_domain/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
34 changes: 8 additions & 26 deletions src/tools/other/mode_time_domain/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -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) \
Expand Down Expand Up @@ -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@)
Expand Down Expand Up @@ -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 \
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 \
Expand Down Expand Up @@ -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
Expand Down
10 changes: 7 additions & 3 deletions src/tools/other/mode_time_domain/mtd_file_base.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -433,7 +434,7 @@ Nt = GET_NC_SIZE(dim);

G = new Grid;

read_nc_grid(f, *G);
read_netcdf_grid(&f, *G);

// timestamp info

Expand Down Expand Up @@ -488,7 +489,10 @@ add_dim(&f, nt_dim_name, Nt);

// Grid

write_nc_grid(f, *G);
NcDim lat_dim = get_nc_dim(&f, ny_dim_name);
NcDim lon_dim = get_nc_dim(&f, nx_dim_name);

write_netcdf_proj(&f, *G, lat_dim, lon_dim);

// timestamp info

Expand Down
4 changes: 2 additions & 2 deletions src/tools/other/mode_time_domain/mtd_nc_output.cc
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,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
Expand Down Expand Up @@ -164,7 +164,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
Expand Down
1 change: 0 additions & 1 deletion src/tools/other/mode_time_domain/mtd_nc_output.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@


#include "mtd_nc_defs.h"
#include "nc_grid.h"
#include "nc_utils_local.h"

#include "mtd_file_float.h"
Expand Down
Loading

0 comments on commit d298957

Please sign in to comment.