Replace italics below with details for this issue.
Describe the Problem
Provide a clear and concise description of the bug here.
MET reads latitude and longitude variables as double-precision values regardless of their original data type, converting float values to double precision during processing. Converting radian values as latitude values from float to double precision can introduce rounding errors, potentially resulting in values exceeding 90.0° or dropping below −90.0° when processing MPAS files.
Below is an example error message
DEBUG 6: get_nc_data(NcVar *, double *) lonCell data_size=41943042, is_unsigned_value: 0
DEBUG 6: UGridFile::read_netcdf_grid() -> convert rad to degree for lat
DEBUG 6: UGridFile::read_netcdf_grid() -> convert rad to degree for lon
DEBUG 9: UnstructuredData::set_points(int, double *, double *) first (-89.95510084, -58.29018675) and last (20.91506741, -0.01718597825) from (-89.95510084, -58.29018675) and (20.91506741, -0.01718597825)
PRE-MAIN-ERROR Exception: BadValue: Invalid latitude -90.000002504478161 (/glade/work/dtcrt/METplus/casper/components/MET/installations/12.2.0/external_libs/eckit/eckit-1.24.4/src/eckit/geometry/CoordinateHelpers.cc +49 assert_latitude_range)
terminate called after throwing an instance of 'eckit::BadValue'
what(): BadValue: Invalid latitude -90.000002504478161
FATAL: Received Signal Abort. Exiting 6
The sample files and scripts are prepared at (/glade/u/home/johnhg/work/METplus/discussions/falko_20260422, casper or derecho) by @JohnHalleyGotway.
The coordinate NetCDF file ens_1/init.nc contains float data type radian values for lat and lon variables.
float latCell(nCells) ;
latCell:units = "rad" ;
latCell:long_name = "Latitude of cells" ;
float lonCell(nCells) ;
lonCell:units = "rad" ;
lonCell:long_name = "Longitude of cells" ;
Here are max and min radian values in the NetCDF file:
ncdump -v latCell ens_1/[init.nc](http://init.nc/) | grep "1\.57079"
-0.9446307, -1.570237, -1.570796, -1.570183, -1.569678, -1.569795,
0.9437245, 0.944019, 0.9440414, 0.9443362, 0.9446307, 1.570237, 1.570796,
float data type minimum radian -1.570796 == -89.999981276
float data type maximum radian 1.570796 == 89.999981276
double data type minimum radian -1.570796371 == -90.000002532989
double data type maximum radian 1.570796371 == 90.000002532989
Expected Behavior
Provide a clear and concise description of what you expected to happen here.
The converted latitude values (from the radian unit) should be adjusted to remain within the −90.0° to 90.0° range.
Environment
Describe your runtime environment:
- casper or derecho
- OS: (e.g. RedHat Linux, MacOS)
- MET12.2.0 and MET13.0.0
To Reproduce
Describe the steps to reproduce the behavior:
- login to casper or derecho
- change directory to /glade/u/home/johnhg/work/METplus/discussions/falko_20260422
- ./run_ps.sh
Relevant Deadlines
List relevant project deadlines here or state NONE.
Funding Source
NCAR base 2702701
Define the Metadata
Assignee
Labels
Milestone and Projects
Define Related Issue(s)
Consider the impact to the other METplus components.
Bugfix Checklist
See the METplus Workflow for details.
Replace italics below with details for this issue.
Describe the Problem
Provide a clear and concise description of the bug here.
MET reads latitude and longitude variables as double-precision values regardless of their original data type, converting float values to double precision during processing. Converting radian values as latitude values from float to double precision can introduce rounding errors, potentially resulting in values exceeding 90.0° or dropping below −90.0° when processing MPAS files.
Below is an example error message
The sample files and scripts are prepared at (/glade/u/home/johnhg/work/METplus/discussions/falko_20260422, casper or derecho) by @JohnHalleyGotway.
The coordinate NetCDF file ens_1/init.nc contains float data type radian values for lat and lon variables.
Here are max and min radian values in the NetCDF file:
float data type minimum radian -1.570796 == -89.999981276
float data type maximum radian 1.570796 == 89.999981276
double data type minimum radian -1.570796371 == -90.000002532989
double data type maximum radian 1.570796371 == 90.000002532989
Expected Behavior
Provide a clear and concise description of what you expected to happen here.
The converted latitude values (from the radian unit) should be adjusted to remain within the −90.0° to 90.0° range.
Environment
Describe your runtime environment:
To Reproduce
Describe the steps to reproduce the behavior:
Relevant Deadlines
List relevant project deadlines here or state NONE.
Funding Source
NCAR base 2702701
Define the Metadata
Assignee
Labels
Milestone and Projects
Define Related Issue(s)
Consider the impact to the other METplus components.
Bugfix Checklist
See the METplus Workflow for details.
Branch name:
bugfix_<Issue Number>_main_<Version>_<Description>Pull request:
bugfix <Issue Number> main_<Version> <Description>Select: Reviewer(s) and Development issue
Select: Milestone as the next bugfix version
Select: METplus-X.Y Support project for support of the current coordinated release
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 Development project for development toward the next coordinated release