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

Errors when converting NEXRAD composites (GINI) to netCDF3/netCDF4 #480

Closed
1riggs opened this issue Sep 15, 2020 · 5 comments · Fixed by #488
Closed

Errors when converting NEXRAD composites (GINI) to netCDF3/netCDF4 #480

1riggs opened this issue Sep 15, 2020 · 5 comments · Fixed by #488
Assignees

Comments

@1riggs
Copy link

1riggs commented Sep 15, 2020

When writing a NEXRAD composite GINI file to netCDF the resulting file has incorrect values. I have attached a zip file with the original GINI file as well as the netCDF which resulted from using toolsUI to convert the file to netCDF. Note that the same error occurs when using IDV, or Weather and Climate Toolkit, which all rely on netcdf-java.

nexrad-gini-samples.zip

The original file is sourced from a public google cloud storage bucket, and the netCDF was inspected using gdalinfo -stats using GDAL versions 3.1 & 3.0.

System Info

  • netcdf-java version: v5.3.3
  • toolsUI version: v5.3.3
  • OS: PopOS 20.04
  • Java version: OpenJDK 14.0.1
  • Python version: Python 3.8.2
@1riggs 1riggs changed the title Errors when converting GINI to netCDF3/netCDF4 Errors when converting NEXRAD composites (GINI) to netCDF3/netCDF4 Sep 15, 2020
@lesserwhirls lesserwhirls self-assigned this Sep 21, 2020
lesserwhirls added a commit to lesserwhirls/netcdf-java that referenced this issue Sep 22, 2020
GINI calibration values can be negative (for the data value range), and
GEMPAK uses the left most bit of the stored integer to deignate the
signedness. Fixes Unidata#480
lesserwhirls added a commit to lesserwhirls/netcdf-java that referenced this issue Sep 22, 2020
GINI calibration values can be negative (for the data value range), and
GEMPAK uses the left most bit of the stored integer to deignate the
signedness. Fixes Unidata#480

Minor addition - since the long_name attribute was there and so close,
go ahead an add the standard_name attribute to the x and y coordinate
variables.
lesserwhirls added a commit to lesserwhirls/netcdf-java that referenced this issue Sep 22, 2020
GINI calibration values can be negative (for the data value range), and
GEMPAK uses the left most bit of the stored integer to designate the
signedness. Fixes Unidata#480

Minor addition - since the long_name attribute was there and so close,
go ahead an add the standard_name attribute to the x and y coordinate
variables.
lesserwhirls added a commit to lesserwhirls/netcdf-java that referenced this issue Sep 22, 2020
GINI calibration values can be negative (for the data value range), and
GEMPAK uses the left most bit of the stored integer to designate the
signedness. Fixes Unidata#480

Minor addition - since the long_name attribute was there and so close,
go ahead an add the standard_name attribute to the x and y coordinate
variables.
@dopplershift dopplershift linked a pull request Sep 22, 2020 that will close this issue
@1riggs
Copy link
Author

1riggs commented Sep 22, 2020

Happy to see this addressed so quickly! Is there a better way to start using netCDF-java with this fix than building based on the maint-5.x.x branch?

@lesserwhirls
Copy link
Collaborator

@dopplershift and I paired up and were able to knock it out somewhat quickly once we got in the same room, although we had to dig through some GEMPAK code to see how these GINI files were actually encoded (as far as we can tell, the way these coefficients are encoded isn't documented outside of the GEMPAK source code). I just pushed a snapshot version of toolsUI that has the fix if you'd like to give it a spin - https://artifacts.unidata.ucar.edu/repository/unidata-all/edu/ucar/toolsUI/5.4.0-SNAPSHOT/toolsUI-5.4.0-20200922.213306-5.jar

@1riggs
Copy link
Author

1riggs commented Sep 22, 2020

I very much appreciate the effort and thanks for the link!

I converted the sample data I included in the initial issue to netCDF4 and things are looking good for the most part. The statistics are in the expected range but the no data value still seems suspect. According to GDAL the no data value is 9.96920996838686905e+36, I admit I'm new to this radar data stuff, but I'm concerned that the value is the result of a bug in the conversion process.

I'm running the conversion on the command line using: java -classpath toolsUI-5.4.0-20200922.213306-5.jar ucar.nc2.FileWriter2 -in radar_file -out output.nc -netcdf4. The result is the same with and without the -netcdf4 flag.

@lesserwhirls
Copy link
Collaborator

I can certainly see why that no data value would raise an eyebrow! In this case, there isn't an explicit attribute being set on the variable Reflectivity to indicate missing or invalid data. Software will often interpret the _FillValue of a netCDF variable to represent missing data, and the default _FillValue used for a variable of type float is 9.96920996838686905e+36.

@1riggs
Copy link
Author

1riggs commented Sep 23, 2020

Ah that makes sense. Thank you very much for the insight and the bug fix!

@1riggs 1riggs closed this as completed Sep 23, 2020
lesserwhirls added a commit to lesserwhirls/thredds that referenced this issue Oct 8, 2020
Backport of Unidata/netcdf-java#488

GINI calibration values can be negative (for the data value range), and
GEMPAK uses the left most bit of the stored integer to designate the
signedness. Fixes Unidata/netcdf-java#480.

Minor addition - since the `long_name` attribute was there and so close,
go ahead an add the `standard_name` attribute to the `x` and `y`
coordinate variables.
lesserwhirls added a commit to lesserwhirls/netcdf-java that referenced this issue Dec 2, 2020
GINI calibration values can be negative (for the data value range), and
GEMPAK uses the left most bit of the stored integer to designate the
signedness. Fixes Unidata#480

Minor addition - since the long_name attribute was there and so close,
go ahead an add the standard_name attribute to the x and y coordinate
variables.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants