Bugfix: Fix MTD to run on any MET-supported grid projection
Closed this issue · 2 comments
Describe the Problem
This issue arose via this dtcenter/METplus#2691 GitHub discussion.
Currently the MTD tool utilizes a specialized code to create output netCDFs (the write_nc_grid function). During the code creation, support was only given to a small subset of grid projections ( lat/lon, lambert conformal, and polar stereographic).
As a result, passing in any of the other MET-supported grid projections (for example, rotated lat/lon) and requesting output in those same projections results in an error:
ERROR :
ERROR : bool write_nc_grid(NcFile &, const Grid &) -> unsupported projection type
ERROR :
Expected Behavior
Because MET and METplus as a whole support more grid projections than what write_nc_grid supports, users should be able to pass any of the supported grid projections and receive output in their desired (and supported) grid projections.
We should update MTD's logic to use the common library code write_netcdf_proj function which would fix this issue (ie support all METplus supported projections).
This bugfix should be applied to the develop branch, as well as a 11.1 bugfix patch.
Environment
Describe your runtime environment:
*1. Machine: Seneca
*2. OS: Linux
*3. MET-12.0 NB09232024
To Reproduce
Describe the steps to reproduce the behavior:
*1. Use input data not in one of the 3 listed projections: lat/lon, lambert conformal, or polar stereographic
*2. Call the MTD tool
Note: @j-opatz can provide testing data and configuration file as needed.
Relevant Deadlines
List relevant project deadlines here or state NONE.
Funding Source
2782544 (NOAA Base FY24)
Define the Metadata
Assignee
- Select engineer(s) or no engineer required
- Select scientist(s) or no scientist required
Labels
- Review default alert labels
- Select component(s)
- Select priority
- Select requestor(s)
Milestone and Projects
- Select Milestone as the next bugfix version
- Select Coordinated METplus-X.Y Support project for support of the current coordinated release
- Select MET-X.Y.Z Development project for development toward the next official release
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 Development issue
Select: Milestone as the next bugfix version
Select: Coordinated METplus-X.Y Support project for support of the current coordinated release - 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 Development issue
Select: Milestone as the next official version
Select: MET-X.Y.Z Development project for development toward the next official release - Close this issue.
@j-opatz, the change from using MTD-specific code for reading/writing grid information to/from NetCDF files to calling common library functionality was very easy and quick.
Please see the code compiled for this bugfix branch:
seneca:/d1/personal/johnhg/MET/MET_development/MET-bugfix_2979_develop_mtd_grid
Can you please test that version of MTD with the test data to see if the behavior has changed?
I manually tested as described below to confirm that this set of changes works as expected.
- Adapted the existing
mtd_basic
unit test inunit_mtd.xml
. - Ran regrid_data_plane to regrid the input files to NCEP Grid 1 which is Mercator:
for file in `ls -1 *.grb`; do ../../../bin/regrid_data_plane $file G001 `echo $file | sed 's/grb/nc/g'` -field 'name="APCP"; level="A1";' ; done
- Modified the
MTDConfig_simple
file to handle the NetCDF inputs:
field = {
name = "APCP_01";
level = "(*,*)";
};
- Ran the modified configuration to use last night's build of the
develop
branch to produce:
cd /d1/personal/johnhg/MET/MET_development/MET-bugfix_2979_develop_mtd_grid/internal/test_unit
./unit_mtd_basic_develop.sh
Errors out with:
ERROR : bool write_nc_grid(NcFile &, const Grid &) -> unsupported projection type
- Rerun using mtd from this bugfix branch:
./unit_mtd_basic_bugfix.sh
And it runs fine without error.