-
Notifications
You must be signed in to change notification settings - Fork 4
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
Add xr.apply_ufunc wrapper to fit_gev #58
Conversation
Codecov ReportAttention:
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## master #58 +/- ##
==========================================
+ Coverage 31.97% 38.13% +6.15%
==========================================
Files 18 19 +1
Lines 1720 1820 +100
==========================================
+ Hits 550 694 +144
+ Misses 1170 1126 -44 ☔ View full report in Codecov by Sentry. |
In terms of the order of dimensions, if the time dimension doesn't literally need to be last you could just get the axis number and use it: time_index = data.dims.index('time') If you do need time to be the last dimension then you could transpose? dim_order = list(da.dims)
dim_order.remove('time')
dim_order.append('time')
data = data.transpose(*dim_order) |
In terms of the setup, our extreme value analysis code in the With respect to finding the docstring, we'd want users to be able to run the following to get the detailed docstring: from unseen import eva
help(eva.fit_gev) Does everything need to be within the |
Yeah, I think it might be a good idea to separate the eva functions. There won't be much left in The function just needed the name of the time dimension, so I added that as a keyword in case it isn't Yeah, the function doesn't need to be within the I also separated and vectorized the |
I'm having some issues with
But, if I do add it (in
Any ideas why? The input function just returns a 1d array (e.g., np.array([shape, loc, scale]). |
For scipy.stats.goodness_of_fit
Add some tests for fit_gev
Update apply_ufunc kw to dask="allowed". Add pvalue alpha to check_gev_fit.
Add non stationary gev fit tests
I seem to have fixed the previous
The input data has dimensions (time, lat, lon) and the output should be (lat, lon, theta). The |
The
fit_gev
function is now wrapped withxr.apply_ufunc
, so fitting data to a distribution (normal or non-stationary version) should work for multi-dim input.If the input data is a 1D timerseries, the output will just be the expected values of the parameters:
Otherwise, the output will be a data array:
The function assumes that the input data has time on the last axis (e.g., dims=(ensemble, lat, lon, time)) and infers the dimension name from that. However, I'm not sure if that is a common way of ordering dimensions.
Do you think it will be better to have a
time_dim='time'
input argument and infer the axis position from that or something?Also, the overall function setup probably isn't great and it might be hard to find the actual docstring:
where
ns_genextreme_gen().fit
is just a wrapper for the actual fitting function,ns_genextreme_gen()._fit
.@DamienIrving and @dougiesquire any suggestions for improvements?