How do I deal with NaNs (not a number) in my data?
import numpy as N var1 = N.where(N.isnan(var[:]),var._FillValue[0],var[:]) • I’m trying to set the _FillValue attribute for my data, but getting an error message. If you are trying to set a _FillValue attribute for your data, and getting the error message: ncendef: ncid 65536: NetCDF: Not a valid data type or _FillValue type mismatch then this means you are using a value that is of the wrong type for your data variable. NetCDF requires the _FillValue type to be the same type as the variable it is attached to (for good reason). Furthermore, PyNIO treats an assignment to a _FillValue just like any other attribute assignment, meaning that it does not try to convert the type it is handed. If your data variable is a “float” in NetCDF, you must assign the _FillValue as a “numpy.float32”. If you assign it with the literal value “-999”, it will become an integer, which will not work. Unfortunately, even if you use the value “-999.0”, it will not work, because the default float type in Python (
Related Questions
- I am employed to deal with classifying, labelling and safety data sheet issues and Id like to make contact with fellow professionals. How can I do this?
- How does OR mapping deal with cases where data is not fully committed to the database? How would rollback take place on complex queries?
- How do I deal with NaNs (not a number) in my data?