-
Notifications
You must be signed in to change notification settings - Fork 39
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
Implementation of an invalid value, similar to numpy's "NaT"? #145
Comments
I'm open to suggestions on how to handle missing values in the |
I believe what I was thinking of is something like pandas' new The same way pandas implements this over numpy's types using "object" arrays, this could also be managed directly in xarray. However, I think cftime would gain from this, keeping its symmetry with Maybe a way would be to have one instance of a NAdatetime class that has similar properties than |
Sure, a pull request would be welcome. I'm not sure we can reuse np.datetime64 for the same reason we can't use python datetime - it only supports one calendar. It certainly seems feasible to check for np.nan or np.nat in the |
With cftime 1.1.0 on Linux (Ubuntu, 64 bit)
I am using cftime through xarray and one my computation returns an array where the values are dates. I want to get the number of days between these dates and a reference date. Some of the pixels of the input array are masked and set to
np.nan
and when doing the subtraction, it raises an errorTypeError: unsupported operand type(s) for -: 'float' and 'cftime._cftime_Datetime360Day
.I was wondering if there is recommended way to handle invalid values with cftime, or a plan to support this? Maybe
cftime.datetime
could returnnumpy.NaT
when the other object is eithernumpy.nan
ornumpy.NaT
?The text was updated successfully, but these errors were encountered: