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

NaN values of attributes get converted to 0.0 when passed through opendap #420

Open
samoylovfp opened this issue Oct 5, 2020 · 10 comments
Assignees
Labels

Comments

@samoylovfp
Copy link

samoylovfp commented Oct 5, 2020

I have a .nc file with a variable with an attribute missing_value = NaNf. When I download this file from opendap in netcdf3 or netcdf4 format I get missing_value = 0.0f in the resulting file.

I expect to get the same NaNf as in the original file

Here's a script to reproduce the issue (requires bash, docker, wget and ncdump)
https://gist.github.com/samoylovfp/ba1df8ef41f27c44ddeed9f2d4076fc9

I suspect that istringstream is the culprit in these places

https://github.com/OPENDAP/bes/blob/6724e44/modules/fileout_netcdf/FONcAttributes.cc#L389
https://github.com/OPENDAP/bes/blob/6724e44/modules/fileout_netcdf/FONcAttributes.cc#L1030

Because it cannot parse NaN:

https://ideone.com/bhTntI
https://stackoverflow.com/questions/11420263/is-it-possible-to-read-infinity-or-nan-values-using-input-streams

@ndp-opendap
Copy link
Contributor

Can you provide a link to the original file?

@samoylovfp
Copy link
Author

Here's a link to a file with attributes being NaN
https://github.com/samoylovfp/binaries/blob/main/with_nan.nc

@jgallagher59701
Copy link
Member

jgallagher59701 commented Oct 6, 2020 via email

@jgallagher59701 jgallagher59701 self-assigned this Oct 6, 2020
@samoylovfp
Copy link
Author

Is there anything I can do to help get this done?

@samoylovfp
Copy link
Author

Hello!
The reply message said that this will be worked on ASAP but there is no update for over a month.
Just checking that this didn't fall through cracks.

I've tried to fix this on my own but I failed to correctly build the BES service, I had a number of problems with finding correct versions of dependency libraries. Is it possible to share the hyrax-dependencies-build.tar.gz and libdap-build.tar.gz that are used in the travis job?

@ndp-opendap
Copy link
Contributor

@samoylovfp We are working on this issue in our sprint beginning today.

If you are still wishing to build the server you might want to review this set of instructions:

https://docs.opendap.org/index.php?title=Hyrax_GitHub_Source_Build

Which will explain how to deal with the hyrax-dependencies.

@sawer297 sawer297 self-assigned this Dec 10, 2020
@sawer297
Copy link
Contributor

@samoylovfp
@ndp-opendap and I found the issue within the code causing the issue.
So we will be implementing a fix for this, which should be complete by the end of next week.
Sorry for the delay but we are experiencing some unwanted throttling in our software testing process which is slowing the releasing of code fixes.

@larstiq
Copy link

larstiq commented Dec 14, 2020

@sawer297 thanks! If you have a branch we can build from we could hopefully do some testing with our data as well.

@sawer297
Copy link
Contributor

@larstiq @samoylovfp
the fix has been applied, new regression tests added, and has been merged to the master branch
go ahead and pull the master branch and test using that
let us know if anymore bugs pop up

@samoylovfp
Copy link
Author

samoylovfp commented Jan 8, 2021

The issue is fixed in Hyrax 1.16.3, thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants