spencerahill / animal-spharm

(DEPRECATED) xarray-based wrapper around pyspharm & windspharm for spherical harmonics climate/meteorological data analysis
Apache License 2.0
3 stars 2 forks source link

Decorators that automatically convert between xarray and spharm-suitable formats #1

Open spencerahill opened 8 years ago

spencerahill commented 8 years ago

The ideal scenario would be having each of the Spharmt and windspharm methods callable, but with xray.DataArrays passed in of arbitrary shape. There would be wrappers (potentially implemented as decorators? Don't understand the latter well enough to be sure) that would convert from xray to the needed (lat north-to-south, lon, num_records) etc. format required by those classes, and then back to the original xray format and shape.

These conversion methods have already been implemented, but I still need a general way to wrap them around the Spharmt/windspharm methods. Right now they have to be called manually before and after.

A bonus would be, for those methods that within Spharmt return spectral coefficients, a kwarg that specifies whether or not to do the conversion to gridpoint values. And for all methods, another kwarg that specifies whether or not to do the final conversion back into xray format.

If successfully implemented, this would make using the Spharmt/windspharm methods as easy to use as numpy and xray methods.

spencerahill commented 8 years ago

Windspharm has just implemented an interface for xarray, which should be leveraged.