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

Request: implement unsigned integer type for xarray resample skipna #1562

Closed
mmartini-usgs opened this issue Sep 8, 2017 · 2 comments
Closed

Comments

@mmartini-usgs
Copy link

mmartini-usgs commented Sep 8, 2017

I would like to be able to use the skipna switch with unsigned integer types in netCDF4 files I'm processing with xarray.

Currently it appears to be unsupported:

    184                 raise NotImplementedError(
    185                     'skipna=True not yet implemented for %s with dtype %s'
--> 186                     % (name, values.dtype))
    187             nanname = 'nan' + name
    188             if (isinstance(axis, tuple) or not values.dtype.isnative or

NotImplementedError: skipna=True not yet implemented for mean with dtype uint32

Thanks,
Marinna

@fujiisoup
Copy link
Member

I first thought skipna=True does not make sense for uint array because NaN is a float, but I just noticed it would be inconvenient for Dataset containing float and uint.
Sent a PR.

@mmartini-usgs
Copy link
Author

I'm generating netCDF4 files that have a variety of variables that have values representing things that are integer in nature and can't physically be negative. So to save space and provide as much bandwidth in the variable, I was careful to use float, int, unit types as appropriate. And then could not use resample with skipna because uint was not supported. I have gone back and made the uints into ints, skipna now works on my data, and I might now need to use 64 bit instead of 32 which defeats my efforts to keep the files as small as possible. It seems to me that if skipna is implemented for one or two types it should work for all of them.
It's also quite possible I've mistaken something - I'm an experienced programmer in C and MATLAB and very new to python and have learned the lard way that what's obvious in C or C++ is not so in python.

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