Unidata / netcdf-java

The Unidata netcdf-java library
https://docs.unidata.ucar.edu/netcdf-java/current/userguide/index.html
BSD 3-Clause "New" or "Revised" License
142 stars 69 forks source link

cdm-radial: Parsing issues with radar files from IDEAM Colombia #1292

Closed michaeldiener closed 5 months ago

michaeldiener commented 7 months ago

Versions impacted by the bug

5.3 and onwards

What went wrong?

Loading Sigmet/IRIS files from IDEAM Colombia fail due to various ArrayIndexOutOfBoundsExceptions in ucar.nc2.iosp.sigmet.SigmetVolumeScan.

Attached is an example file from the Barrancabermeja radar station (License CC BY 4.0).

I have already investigated the source of the bug. The main issue is in ucar.nc2.iosp.sigmet.SigmetIOServiceProvider.readRecordsHdr(...). The variable nparams is not complete. I will prepare a Pull Request as well with the needed fixes.

BAR230510062107.RAW2XYJ.zip

Relevant stack trace

java.lang.ArrayIndexOutOfBoundsException: Index -8252 out of bounds for length 6
    at ucar.nc2.iosp.sigmet.SigmetVolumeScan.<init>(SigmetVolumeScan.java:222)
    at ucar.nc2.iosp.sigmet.SigmetIOServiceProvider.open(SigmetIOServiceProvider.java:132)
    at ucar.nc2.NetcdfFile.<init>(NetcdfFile.java:1610)
    at ucar.nc2.NetcdfFiles.open(NetcdfFiles.java:750)
    at ucar.nc2.NetcdfFiles.openInMemory(NetcdfFiles.java:698)

Relevant log messages

No response

If you have an example file that you can share, please attach it to this issue.

If so, may we include it in our test datasets to help ensure the bug does not return once fixed? Note: the test datasets are publicly accessible without restriction.

Yes

Code of Conduct

michaeldiener commented 7 months ago

There are more issues with files from other Colombian stations and so I'm still investigating and preparing a PR. Seems to be different bugs this time and so I'll probably file another or more reports. Might take a few days until I get to the bottom of this.

tdrwenski commented 7 months ago

Thank you for reporting and investigating this! Let us know if you need any assistance from us.

michaeldiener commented 7 months ago

In the end it was not only the readRecordsHdr method but also missing support for all data types instead of just 5. PR uploaded.

michaeldiener commented 5 months ago

My fixes have been merged: https://github.com/Unidata/netcdf-java/pull/1295