From 76d12c49a74f603ec67631d32a1afe3094dc6cf1 Mon Sep 17 00:00:00 2001 From: johnhg Date: Tue, 7 Jun 2022 14:59:06 -0600 Subject: [PATCH] Bugfix #2173 develop shift_data_plane (#2175) --- internal/test_unit/xml/unit_python.xml | 28 +++++++++++++++++++ .../shift_data_plane/shift_data_plane.cc | 22 ++++++++------- 2 files changed, 40 insertions(+), 10 deletions(-) diff --git a/internal/test_unit/xml/unit_python.xml b/internal/test_unit/xml/unit_python.xml index b2b1dad44b..4f17952155 100644 --- a/internal/test_unit/xml/unit_python.xml +++ b/internal/test_unit/xml/unit_python.xml @@ -274,6 +274,34 @@ + + &MET_BIN;/shift_data_plane + \ + PYTHON_NUMPY \ + &OUTPUT_DIR;/python/shift_data_plane.nc \ + 'name="&MET_BASE;/python/read_ascii_numpy.py &DATA_DIR_PYTHON;/fcst.txt FCST";' \ + -from 30 -110 -to 35 -115 \ + -v 1 + + + &OUTPUT_DIR;/python/shift_data_plane.nc + + + + + &MET_BIN;/shift_data_plane + \ + &DATA_DIR_PYTHON;/fcst.txt \ + &OUTPUT_DIR;/python/shift_data_plane_input_arg.nc \ + 'name="&MET_BASE;/python/read_ascii_numpy.py MET_PYTHON_INPUT_ARG FCST"; file_type=PYTHON_NUMPY;' \ + -from 30 -110 -to 35 -115 \ + -v 1 + + + &OUTPUT_DIR;/python/shift_data_plane_input_arg.nc + + + &MET_BIN;/series_analysis diff --git a/src/tools/other/shift_data_plane/shift_data_plane.cc b/src/tools/other/shift_data_plane/shift_data_plane.cc index d7e85612df..bf05003341 100644 --- a/src/tools/other/shift_data_plane/shift_data_plane.cc +++ b/src/tools/other/shift_data_plane/shift_data_plane.cc @@ -20,6 +20,7 @@ // Mod# Date Name Description // ---- ---- ---- ----------- // 000 11-12-14 Halley Gotway New +// 001 06-07-22 Halley Gotway MET #2173 Fix python embedding // //////////////////////////////////////////////////////////////////////// @@ -50,6 +51,10 @@ using namespace std; #include "vx_cal.h" #include "vx_math.h" +#ifdef WITH_PYTHON +#include "data2d_python.h" +#endif + //////////////////////////////////////////////////////////////////////// static ConcatString program_name; @@ -200,17 +205,11 @@ void process_data_file() { // Populate the VarInfo object using config vinfo->set_dict(config); - // Open the input file - if(!mtddf->open(InputFilename.c_str())) { - mlog << Error << "\nprocess_data_file() -> can't open file \"" - << InputFilename << "\"\n\n"; - exit(1); - } - // Get the data plane from the file for this VarInfo object if(!mtddf->data_plane(*vinfo, dp_in)) { - mlog << Error << "\nprocess_data_file() -> trouble getting field \"" - << FieldString << "\" from file \"" << InputFilename << "\"\n\n"; + mlog << Error << "\nprocess_data_file() -> " + << "trouble getting field \"" << FieldString + << "\" from file \"" << InputFilename << "\"\n\n"; exit(1); } @@ -253,7 +252,6 @@ void process_data_file() { mlog << Debug(2) << shift_cs << "\n"; // Shift the data - dp_shift = dp_in; for(x=0; x