-
Notifications
You must be signed in to change notification settings - Fork 12
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
[Feature]: skipna parameter for averager #582
Comments
Thanks for this feature suggestion Jiwoo. I agree, we should have a
This sounds similar to the Can you provide some pseudo-code? Better yet, a prototype Python implementation would be great. |
I think an alternative solution to |
I'm wondering if this would work. If we were dealing with time series:
I think dropping the NaN would also drop the time point, which would create problems for a lot of applications. If I instead had a
I'm not sure how this would work. What would the Or am I thinking about this the wrong way? |
@tomvothecoder @pochedls sorry that I haven't fully followed this, but just wondering if there to be any chance to follow upon this as Celine reached out for the same issue -- she wants to operate a spatial average while the data has NaN included. |
@lee1043 – I don't think I can work on this soon. This could be an easy PR (or "dev day" issue) depending on the complexity of the implementation. There might also be work arounds using |
If you or somebody else can provide pseudo-code or a prototype Python implementation it can help speed up the implementation process for whenever @pochedls or I (or somebody else) has time. My dev time for new xCDAT features will be limited for the next few months because of conferences and other priorities. |
Is your feature request related to a problem?
skipna=None
parameter is being used in xarray's mean function to allow user to decide whether skipNaN
values in averaging (thus average will be calculated using non-NaN values) or just returnNaN
for average when there are anyNaN
values used.https://docs.xarray.dev/en/stable/generated/xarray.DataArray.mean.html
Describe the solution you'd like
Convey
skipna
key to here:xcdat/xcdat/spatial.py
Line 737 in 6238148
Similar to temporal average functions when
.mean
being used.Describe alternatives you've considered
No response
Additional context
It would be even more helpful if users could set some criteria. For example, letting the user decide the fraction of NaN values.
Let's say, I have 10 values, which include 2 NaNs. I want to get an average with skipna=True. But when having 3 NaN values, I want to average to be NaN.
This is going to help the obs4MIPs process when handling with time-varying NaN values due to missed observation points.
The text was updated successfully, but these errors were encountered: