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

Setting _FillValue attribute #47

Open
jlumsden-mts opened this issue Oct 13, 2023 · 2 comments
Open

Setting _FillValue attribute #47

jlumsden-mts opened this issue Oct 13, 2023 · 2 comments

Comments

@jlumsden-mts
Copy link

First of all thanks for this library. We have been using it for some time to read NetCDF files but have just started writing them.

I'm trying to set the _FillValue attribute as per CF conventions (https://cfconventions.org/Data/cf-conventions/cf-conventions-1.7/build/ch02s05.html)

However, when setting this via the MetadataDictionary variable.Metadata["_FillValue"] = 99999.0 it just results in an empty string ("") for _FillValue when examining the output using ncdump -h and causes errors (fails to open) when trying to open the file in a viewer like Panoply - I believe due to it not matching the datatype of the variable.

I think the issue stems from the fact that _FillValue is used internally by the NetCDF library and it wants it set prior to any data being put into the variable.

Despite trying a few different permutations I could not get it to be set correctly using SDSLite. It would either not appear at all or be set to an empty string ("") rather than the double value I was expecting.

@vassilyl
Copy link
Contributor

Did you try to set the MissingValue property on the variable instead?

@jlumsden-mts
Copy link
Author

Yes, that works fine (setting "MissingValue" or "missing_value" attributes) but unfortunately would not be compliant with CF conventions - at least they consider it a deprecated attribute compared to _FillValue - see https://cfconventions.org/Data/cf-conventions/cf-conventions-1.7/build/ch02s05.html

For context I am trying to match the convention used by these oceanographic glider data NetCDF files:
http://imos-data.s3-website-ap-southeast-2.amazonaws.com/?prefix=IMOS/ANFOG/slocum_glider/ScottReef320230424/
Sourced from https://portal.aodn.org.au/

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

No branches or pull requests

2 participants