-
Notifications
You must be signed in to change notification settings - Fork 26
Description
Describe the Problem
Please see Discussion dtcenter/METplus#2935, which includes a reproducer.
The MET NetCDF library code currently segfaults with an unhelpful error message when reading data from a 5-dimensional variable.
The issues are:
- A 5D netCDF variable causes a segmentation fault.
- A 5D netCDF variable causes MET tools to emit an unhelpful, ungrammatical error message.
- The requirement for < 5D netCDF variables does not seem to be well documented.
An example exhibiting issues 1 and 2:
$ plot_data_plane 2t-heightAboveGround-0002.nc a.ps 'name="T2M"; level="(0,0,0,*,*)";'
DEBUG 1: Start plot_data_plane by maddenp(1000) at 2025-03-20 03:24:20Z cmd: plot_data_plane 2t-heightAboveGround-0002.nc a.ps name="T2M"; level="(0,0,0,*,*)";
DEBUG 1: Opening data file: 2t-heightAboveGround-0002.nc
ERROR :
ERROR : get_nc_att(NcVar) -> can't read attribute "grid_mapping" from because variable is invalid.
ERROR :
FATAL ERROR (SEGFAULT): Process 41632 got signal 11 @ local time = 2025-03-20 03:24:20Z
FATAL ERROR (SEGFAULT): Look for a core file in /home/maddenp/Desktop
FATAL ERROR (SEGFAULT): Process command line: plot_data_plane 2t-heightAboveGround-0002.nc a.ps name="T2M"; level="(0,0,0,*,*)";
Segmentation fault (core dumped)
Expected Behavior
Ideally, the 5D variable should be supported and processed. In weather applications, 5D data (dimensions: initialization time, forecast lead time, level, y/lat, x/lon) is common. A requirement to discard a dimension to work with MET could lead to information loss in otherwise self-describing netCDF.
If supporting >4D netCDF variables isn't feasible in the near term, I think a helpful improvement would be:
- Detect the issue and exit gracefully, avoiding a segmentation fault.
- Emit an precise message about the nature of the problem.
- State the requirements for netCDF variable dimensionality prominently in the MET User's Guide, ideally in section 4, MET Data I/O, in the subsections about netCDF. (It's possible that this is already documented and that I just missed it.)
Environment
I can reproduce the issue on NOAA's Hera, and on my own system running Ubuntu 22.04, and with my own build of MET V11.0.3, as well as the published V11.0.3 and latest V12 OCI container images.
To Reproduce
See plot_data_plane
command and data file in the linked-to discussion.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status