bradyrx / esmtools

:octopus: a toolbox for Earth System Model analysis :octopus:
https://esmtools.readthedocs.io/en/latest/
MIT License
27 stars 4 forks source link

Stats func accessor 59 #99

Closed lukegre closed 3 years ago

lukegre commented 4 years ago

Description

Added xarray accessors for the stats functions. Added accessor as stats to xr.DataArray (and not xr.Dataset). Includes: corr, linear_slope, linregress, polyfit, rm_poly, rm_trend

Did not change the API of these functions as I originally intended - I didn't realise how extensive the tests were and this would all have to be changed 😵

Type of change

Please delete options that are not relevant.

How Has This Been Tested?

Manually. Not a complicated implementation of xarray accessors.

Checklist (while developing)

lukegre commented 4 years ago

Travis tests are failing on stats.rm_poly for the dask arrays when called with x and y. When y is forced to load(), the tests pass. Not sure why the docs build is failing. I have not made any changes to stats functions.

aaronspring commented 4 years ago

please raise a PR on the failing stats functions. new versions of xr and/or dask likely the reason

bradyrx commented 3 years ago

please raise a PR on the failing stats functions. new versions of xr and/or dask likely the reason

@aaronspring I feel like we recently dealt with this in climpred? There was some break due to the new versions and I can't remember what we had to change. I think you were working on it.

bradyrx commented 3 years ago

@luke-gregor, if you rebase this onto master the bug should be fixed and you should be good to go to proceed with this.

bradyrx commented 3 years ago

This will be fixed from https://github.com/bradyrx/esmtools/pull/105. You can rebase once I merge it when the RTD tests pass and so on. Sorry this little implementation has been such a headache! But you found a few holes with recent upstream changes. :)

bradyrx commented 3 years ago

Okay @luke-gregor, another rebase onto master should do the trick here!

lukegre commented 3 years ago

All passed! I'll update the docs accordingly.

bradyrx commented 3 years ago

Thanks @luke-gregor! Sorry for the delay here. In the final stretch of writing, so haven't kept too close of an eye on Github. Merging now!