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

Bugfix 3056 ugrid forecast reference time #3061

Merged
merged 13 commits into from
Jan 24, 2025

Conversation

hsoh-u
Copy link
Collaborator

@hsoh-u hsoh-u commented Jan 24, 2025

Expected Differences

InitTime was from the actual time variable before. It's changed to set from the forecast_reference_time variable if exists.

  • Do these changes introduce new tools, command line arguments, or configuration file options? [No]

    If yes, please describe:

  • Do these changes modify the structure of existing or add new output data types (e.g. statistic line types or NetCDF variables)? [No]

    If yes, please describe:

Pull Request Testing

  • Describe testing already performed for these changes:

Added an unit test.

Here is a command example:

export BEG_DS='-180000'
export CONFIG_DIR='${MET_TEST_BASE}/config'
export END_DS='180000'
export OUTPUT_PREFIX='UGRID_LFRIC2'
/d1/personal/hsoh/git/bugfixes/bugfix_3056_ugrid_forecast_reference_time/MET/share/met/../../bin/point_stat \
      /d1/projects/MET/MET_test_data/unit_test/ugrid_data/lfric/lfric_2012-04-09_00.00.00.nc \
      /d1/personal/hsoh/MET/test_output/bugfix_3056_ugrid_forecast_reference_time/pb2nc/gdas1.20120409.t12z.prepbufr.nc \
      /d1/personal/hsoh/git/bugfixes/bugfix_3056_ugrid_forecast_reference_time/MET/internal/test_unit/config/PointStatConfig_ugrid_lfric2 \
      -ugrid_config /d1/personal/hsoh/git/bugfixes/bugfix_3056_ugrid_forecast_reference_time/MET/share/met/config/UGridConfig_lfric2 \
      -outdir /d1/personal/hsoh/MET/test_output/bugfix_3056_ugrid_forecast_reference_time/point_stat_ugrid -v 4
unset BEG_DS
unset CONFIG_DIR
unset END_DS
unset OUTPUT_PREFIX

  • Recommend testing for the reviewer(s) to perform, including the location of input datasets, and any additional instructions:

N/A or run point_stat with LFRic data which has forecast_reference_time variable

  • Do these changes include sufficient documentation updates, ensuring that no errors or warnings exist in the build of the documentation? [No]

  • Do these changes include sufficient testing updates? [Yes]

An unittest is added.

  • Will this PR result in changes to the MET test suite? [Yes]

    If yes, describe the new output and/or changes to the existing output:

Two more new outputs

  • point_stat_ugrid/point_stat_UGRID_LFRIC2_180000L_20120409_180000V.stat

  • point_stat_ugrid/point_stat_UGRID_LFRIC2_180000L_20120409_180000V_mpr.txt

  • Will this PR result in changes to existing METplus Use Cases? [No]

    If yes, create a new Update Truth METplus issue to describe them.

  • Do these changes introduce new SonarQube findings? [No]

    If yes, please describe:

  • Please complete this pull request review by [Fill in date].

Pull Request Checklist

See the METplus Workflow for details.

  • Review the source issue metadata (required labels, projects, and milestone).
  • Complete the PR definition above.
  • Ensure the PR title matches the feature or bugfix branch name.
  • Define the PR metadata, as permissions allow.
    Select: Reviewer(s) and Development issue
    Select: Milestone as the version that will include these changes
    Select: Coordinated METplus-X.Y Support project for bugfix releases or MET-X.Y.Z Development project for official releases
  • After submitting the PR, select the ⚙️ icon in the Development section of the right hand sidebar. Search for the issue that this PR will close and select it, if it is not already selected.
  • After the PR is approved, merge your changes. If permissions do not allow this, request that the reviewer do the merge.
  • Close the linked issue and delete your feature or bugfix branch from GitHub.

@hsoh-u hsoh-u added requestor: UK Met Office United Kingdom Met Office MET: UGRID Issues related to unstructured grid (UGRID) support in MET pull request: MODIFIES OUTPUT FORMAT Adds new or modifies existing output file formats labels Jan 24, 2025
@hsoh-u hsoh-u added this to the MET-12.1.0 milestone Jan 24, 2025
@JohnHalleyGotway JohnHalleyGotway added pull request: MODIFIES OUTPUT DATA Modifies existing output data values and removed requestor: UK Met Office United Kingdom Met Office MET: UGRID Issues related to unstructured grid (UGRID) support in MET pull request: MODIFIES OUTPUT FORMAT Adds new or modifies existing output file formats labels Jan 24, 2025
@JohnHalleyGotway
Copy link
Collaborator

Note that I switched the label from pull request: MODIFIES OUTPUT FORMAT to pull request: MODIFIES OUTPUT DATA. This PR won't change the format of the output, but for those running with LFRic inputs, the output data values (namely the timestamps) will change, which we're flagging with the "MODIFIES OUTPUT DATA" label.

MET Tools Test Account added 3 commits January 24, 2025 17:03
…oughout to more clearly indicate that this configuration is for lfric data that's been interpolated in the vertical to pressure levels.
…ore realistic comparisons at 2 pressure levels and don't write .stat and _mpr.txt because the data is duplicated.
Copy link
Collaborator

@JohnHalleyGotway JohnHalleyGotway left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I approve of these changes.

Thanks @hsoh-u for all your work on this. Note that I made the following changes:

  • Renamed ugrid_lfric2 to ugrid_pressure_levels throughout.
  • Tweaked comments in UGrid config files for consistency and clarity.
  • Refined the newly added UGrid unit test to make more reasonable comparisons.

New new unit test confirms that the forecast_reference_time value is used to now being used, as intended:

DEBUG 4: get_init_time(NcFile *, string &) -> get InitTime (20120409_000000) from "forecast_reference_time" variable (value=0).

Along the way, I found two suggestions for improvement:

  1. MET does not support verifying a range of UGrid pressure levels. Configuring with level="(21-24,*)"; produces:
ERROR  : 
ERROR  : VarInfoUGrid::set_dict() -> Multiple vertical levels ((21-24,*)) for UGrid are not supported
ERROR  :

Recommend adding support for this in future versions.
2. The @value notation does not work. Configuring with level="(@500,*)"; produces:

ERROR  : 
ERROR  : UGridFile::getData(NcVar *, const LongArray &, DataPlane &) -> bad arguments:
Nelements = 2
Nalloc    = 2
AllocInc  = 10
Element # 0 = -123456
Element # 1 = -12345

Recommend adding support for the @value notation for UGrid inputs in future versions.

While the SonarQube run did flag new code smells, these changes reduce the overall number of code smells from 17,927 in develop down to 17,907.

@hsoh-u hsoh-u merged commit 2e8a62b into develop Jan 24, 2025
24 of 25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pull request: MODIFIES OUTPUT DATA Modifies existing output data values
Projects
Status: 🏁 Done
Development

Successfully merging this pull request may close these issues.

Enhance the unstructured grid library to correctly parse the LFRic model initialization time
2 participants