6

Detrend xarray DataArrays using polyfit

 2 years ago
source link: https://gist.github.com/rabernat/1ea82bb067c3273a6166d1b1f77d490f
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Detrend xarray DataArrays using polyfit · GitHub

Instantly share code, notes, and snippets.

Detrend xarray DataArrays using polyfit

Hey! This was a useful snippet of code for easy detrending, but I just wanted to say that it doesn't work as it is — when you pass 'dim' to xarray.polyval, it only reads a string, but it needs a coordinate type. I made it work by changing line 6 to:

fit = xr.polyval(da[dim], p.polyfit_coefficients)

Thanks for sharing!


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK