The

Analysis of global wind fields is common in meteorology and climate science. Often we want to examine not just the vector wind field, but more complex derived quantities that allow deeper insight into the properties of the flow such as rotation and convergence/divergence. These properties of the flow are often expressed as derivatives or integrals of the vector wind. For example vorticity, a measure of rotation in a fluid, is computed as the curl of the wind field, and the corresponding streamfunction is the inverse Laplacian of vorticity. The derivative quantities could be computed via finite difference approximations, although care needs to be taken to correctly account for spherical geometry. However, the integral quantities can be much more difficult to compute.

One way to approach the problem of computing complex derivatives and integrals over the sphere is to use a spectral representation, where a field over the surface of a sphere is represented as the summation of a finite series of basis functions. The appropriate basis functions on the sphere are the spherical harmonics [

Computations using the spectral method require a spherical harmonic transform, a procedure that takes a field defined on a regular global grid and transforms it into its spectral representation in terms of spherical harmonic coefficients. An inverse spherical harmonic transform procedure is also required in order to return a field represented in terms of spherical harmonic coefficients back to a regular grid. Finally, procedures to compute derivatives and integrals of the fields in spectral form are required. These are not trivial to implement, and doing so is out of scope for most researchers simply wishing to analyse global atmospheric circulation. However, these transforms and calculus operations are commonly used in atmospheric modelling, and well tested and optimized implementations of the required algorithms already exist. The

Of the existing software packages for computing with spherical harmonics, many are intended as low-level building blocks for implementing computational models [

The

Examples of quantities computed with windspharm. a) Wind speed (colours) and direction (arrows) on the 500 hPa pressure surface from the ECMWF analysis valid at 00:00 UTC on the 27^{th} January 2016. b) Relative vorticity, and c) streamfunction, both computed from the wind field using

The solver is built on top of the

On top of the core solver are several interfaces that can work with data structures that contain structured metadata as well as data values. Currently there are metadata interfaces that understand the data structures from iris [

The

The

Linux, OSX

Python 2.7 or Python > = 3.3

setuptools > = 0.7.2

numpy > = 1.6

pyspharm > = 1.8

The metadata interfaces are optional, and must be supported by additional optional dependencies. It is not expected that any one user would require all the available metadata interfaces, only needing the dependency for their interface(s) of choice from the list below:

iris > = 1.2 (for the iris metadata interface)

cdms2 (for the cdms2 metadata interface)

xarray (for the xarray metadata interface)

Running the provided test suite also requires additional optional dependencies that are not required for normal use of

nose

pep8

English

The software is documented on-line at

The author thanks Jeff Whitaker for providing

The author declares that they have no competing interests.