Skip to content

Fix user python embedding to handle the fill value correctly #1753

@JohnHalleyGotway

Description

@JohnHalleyGotway

Describe the Problem

This is an issue @j-opatz ran into when trying to use python embedding to pass data into MET for NOAA/CPC. These scripts worked fine in met-10.0.0_beta3 but was broken by PR #1720 which merged changes for MET issues #1319. The python embedding script works fine when MET_PYTHON_EXE is NOT set, but produces different output when it is set. The issue is that the temporary NetCDF output created by write_tmp_dataplane.py does no encode the bad data value correctly.

Expected Behavior

If python embedding works without MET_PYTHON_EXE set, rerunning with it set should produce the same result.

Environment

Describe your runtime environment:
1. Machine: NCAR Linux project machine kiowa
2. OS: (e.g. RedHat Linux, MacOS)
3. Software version number(s): issue appears after PR #1720

To Reproduce

Describe the steps to reproduce the behavior:
1. On kiowa, run the following commands:

sh
PDP=/d1/projects/MET/MET_regression/develop/NB`date +%Y%m%d`/MET-develop/met/bin/plot_data_plane 
export fcst_file=/d1/projects/CPC_data/input/precip_poe_fcsts/2019/08/07/gefs-legacy-00z_rfcst-cal_precip_20190807_week2.nc
$PDP PYTHON_NUMPY plot_met_python.ps 'name="./poe_fcst_embedded.py ${fcst_file}:33";' -v 4
export MET_PYTHON_EXE=/usr/local/python3/bin/python3
$PDP PYTHON_NUMPY plot_user_python.ps 'name="./poe_fcst_embedded.py ${fcst_file}:33";' -v 4

2. Note the difference in max values listed in the log messages:

DEBUG 4: Data plane information:
DEBUG 4:       plane min: 0.364983
DEBUG 4:       plane max: 0.814893
...
DEBUG 4: Data plane information:
DEBUG 4:       plane min: 0.364983
DEBUG 4:       plane max: 9.96921e+36

3. Look at the plots below and note that the range of valid data values differ:
plot_met_python
plot_user_python

Relevant Deadlines

Fix for met-10.0.0_beta5

Funding Source

Define the source of funding and account keys here or state NONE.

Define the Metadata

Assignee

  • Select engineer(s) or no engineer required
  • Select scientist(s) or no scientist required

Labels

  • Select component(s)
  • Select priority
  • Select requestor(s)

Projects and Milestone

  • Review projects and select relevant Repository and Organization ones or add "alert:NEED PROJECT ASSIGNMENT" label
  • Select milestone to relevant bugfix version

Define Related Issue(s)

Consider the impact to the other METplus components.

Bugfix Checklist

See the METplus Workflow for details.

  • Complete the issue definition above, including the Time Estimate and Funding Source.
  • Fork this repository or create a branch of main_<Version>.
    Branch name: bugfix_<Issue Number>_main_<Version>_<Description>
  • Fix the bug and test your changes.
  • Add/update log messages for easier debugging.
  • Add/update unit tests.
  • Add/update documentation.
  • Push local changes to GitHub.
  • Submit a pull request to merge into main_<Version>.
    Pull request: bugfix <Issue Number> main_<Version> <Description>
  • Define the pull request metadata, as permissions allow.
    Select: Reviewer(s), Project(s), Milestone, and Linked issues
  • Iterate until the reviewer(s) accept and merge your changes.
  • Delete your fork or branch.
  • Complete the steps above to fix the bug on the develop branch.
    Branch name: bugfix_<Issue Number>_develop_<Description>
    Pull request: bugfix <Issue Number> develop <Description>
  • Close this issue.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions