Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature 1627 plot_point_obs #1628

Merged
merged 3 commits into from
Jan 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions met/data/config/PlotPointObsConfig_default
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,21 @@ grid_data = {

field = [];

regrid = {
to_grid = NONE;
method = NEAREST;
width = 1;
vld_thresh = 0.5;
shape = SQUARE;
}

grid_plot_info = {
color_table = "MET_BASE/colortables/met_default.ctable";
plot_min = 0.0;
plot_max = 0.0;
colorbar_flag = TRUE;
}

}

////////////////////////////////////////////////////////////////////////////////
Expand Down
10 changes: 10 additions & 0 deletions met/docs/Users_Guide/plotting.rst
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,14 @@ ______________________

field = [];

regrid = {
to_grid = NONE;
method = NEAREST;
width = 1;
vld_thresh = 0.5;
shape = SQUARE;
}

grid_plot_info = {
color_table = "MET_BASE/colortables/met_default.ctable";
plot_min = 0.0;
Expand All @@ -91,6 +99,8 @@ ______________________

The **grid_data** dictionary defines a gridded field of data to be plotted as a base image prior to plotting point locations on top of it. The data to be plotted is specified by the **field** array. If **field** is empty, no base image will be plotted. If **field** has length one, the requested data will be read from the input file specified by the **-plot_grid** command line argument.

The **to_grid** entry in the **regrid** dictionary specifies if and how the requested gridded data should be regridded prior to plotting. Please see :numref:`config_options` for a description of the **regrid** dictionary options.

The **grid_plot_info** dictionary inside **grid_data** specifies the options for for plotting the gridded data. The options within **grid_plot_info** are described in :numref:`config_options`.

______________________
Expand Down
15 changes: 15 additions & 0 deletions met/src/tools/other/plot_point_obs/plot_point_obs_conf_info.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ using namespace std;
#include "vx_config.h"
#include "vx_data2d.h"
#include "vx_data2d_factory.h"
#include "vx_regrid.h"
#include "vx_statistics.h"

#include "plot_point_obs_conf_info.h"

Expand Down Expand Up @@ -487,6 +489,19 @@ void PlotPointObsConfInfo::process_config(
exit(1);
}

// Regrid, if requested
if(grid_data_info->regrid().enable) {
mlog << Debug(1) << "Regridding field "
<< grid_data_info->magic_str() << ".\n";
Grid to_grid(parse_vx_grid(grid_data_info->regrid(),
&grid, &grid));
grid_data = met_regrid(grid_data, grid, to_grid,
grid_data_info->regrid());

// Store the new grid definition
grid = to_grid;
}

// Conf: grid_plot_info
grid_plot_info = parse_conf_plot_info(
dict->lookup_dictionary(
Expand Down
8 changes: 8 additions & 0 deletions test/config/PlotPointObsConfig
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ grid_data = {

field = [ { name = "RH"; level = "P500"; } ];

regrid = {
to_grid = ${TO_GRID};
method = NEAREST;
width = 1;
vld_thresh = 0.5;
shape = SQUARE;
}

grid_plot_info = {
color_table = "MET_BASE/colortables/NCL_colortables/BlueGreen14.ctable";
plot_min = 0.0;
Expand Down
22 changes: 22 additions & 0 deletions test/xml/unit_plot_point_obs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@

<test name="plot_point_obs_CONFIG">
<exec>&MET_BIN;/plot_point_obs</exec>
<env>
<pair><name>TO_GRID</name> <value>NONE</value></pair>
</env>
<param> \
&OUTPUT_DIR;/pb2nc/ndas.20120409.t12z.prepbufr.tm00.nc \
&OUTPUT_DIR;/plot_point_obs/nam_and_ndas.20120409.t12z.prepbufr_CONFIG.ps \
Expand All @@ -62,4 +65,23 @@
</output>
</test>

<test name="plot_point_obs_CONFIG_REGRID">
<exec>&MET_BIN;/plot_point_obs</exec>
<env>
<pair><name>TO_GRID</name> <value>"latlon 80 100 25 -105 0.25 0.25"</value></pair>
</env>
<param> \
&OUTPUT_DIR;/pb2nc/ndas.20120409.t12z.prepbufr.tm00.nc \
&OUTPUT_DIR;/plot_point_obs/nam_and_ndas.20120409.t12z.prepbufr_CONFIG_REGRID.ps \
-point_obs &OUTPUT_DIR;/ascii2nc/trmm_2012040912_3hr.nc \
-plot_grid &DATA_DIR_MODEL;/grib2/nam/nam_2012040900_F012.grib2 \
-config &CONFIG_DIR;/PlotPointObsConfig \
-title "NAM 2012040900 F12 vs NDAS 500mb RH and TRMM 3h > 0" \
-v 3
</param>
<output>
<ps>&OUTPUT_DIR;/plot_point_obs/nam_and_ndas.20120409.t12z.prepbufr_CONFIG_REGRID.ps</ps>
</output>
</test>

</met_test>