Skip to content

Fix NetCDF library code to process scale_factor and add_offset attributes independently. #2187

@JohnHalleyGotway

Description

@JohnHalleyGotway

Describe the Problem

This issue arose via METplus Discussion #1640. Please see this discussion comment for details. The scale_factor and add_offset variable attributes are only processed when both are present in CF-compliant NetCDF files. Instead they should be processed independently. While the problem is obvious in the vx_data2d_nccf library, be sure to check for the same issue in the other vx_data2d libraries.

Expected Behavior

If specified, the add_offset and scale_factor attributes should be applied after reading the data.

Environment

Describe your runtime environment:
Not machine-specific

To Reproduce

Describe the steps to reproduce the behavior:
1. Pull cheyenne:/glade/scratch/barlage/getd/sample_data/GETDL3_DAL_CONUS_2021182_1.0.nc
2. Run plot_data_plane:

MET-main_v10.1/met/bin/plot_data_plane GETDL3_DAL_CONUS_2021182_1.0.nc plot.ps 'name="HDAY"; level="(*,*)";' -v 4

3. Note the reported data range:

DEBUG 4:    plane min: -30620
DEBUG 4:    plane max: 215363

Those numbers should be divided by 1000.

Relevant Deadlines

List relevant project deadlines here or state NONE.

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: none required

Labels

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

Projects and Milestone

  • Select Organization level Project for support of the current coordinated release
  • Select Repository level Project for development toward the next official release or add alert: NEED PROJECT ASSIGNMENT label
  • Select Milestone as the next 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) and Linked issues
    Select: Organization level software support Project for the current coordinated release
    Select: Milestone as the next bugfix version
  • 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>
    Select: Reviewer(s) and Linked issues
    Select: Repository level development cycle Project for the next official release
    Select: Milestone as the next official version
  • Close this issue.

Metadata

Metadata

Type

No type

Projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions