Spatial computation and analysis: xyTools

Spatial computation package

xyTools.ddx(val, dx=1, axis=-1)[source]

Compute the first derivative along the x axis

xyTools.ddy(val, dy=1, axis=-2)[source]

Compute the first derivative along the y axis

xyTools.detrend(x, y, var)[source]

Fit a 2D linear surface from the input field in least-square sense and return the detrended field

xyTools.global_av(var, e1=1, e2=1)[source]

Compute the spatial mean of a variable using a non-uniform grid to weight by surface

xyTools.hgrad(var, e1, e2)[source]

Compute the horizontal gradient

xyTools.interpolate(x, y, var, interp=None, kind='linear')[source]

Interpolate a 2D field on a regular grid

Parameters:

var : 2D array_like

The values of the variable to interpolate at the data points.

y, x : 1D or 2D array_like

The y and x coordinates on which the variable is evaluated.

interp : {None, ‘basemap’, ‘scipy’}, optional

The algorithm to use for the interpolation.

kind : {‘linear’, ‘cubic’, ‘quintic’}

The kind of spline interpolation to use. Default is ‘linear’.

Returns:

var_reg : 2D array_like

The values of the variable evaluated on the regular grid

y_reg, x_reg : 2D array_like

The y and x coordinates of the new grid

xyTools.lat2dy(lat)[source]

Compute dy on a regular grid

xyTools.lat2f(lat)[source]

Return the coriolis parameter computed from the latitude

xyTools.latlon2dydx(lat, lon, n_lat, n_lon)[source]

Define wavenumber vectors according to the latitude and longitude arrays

xyTools.latlon2lk(lat, lon, n_l, n_k)[source]

Define wavenumber vectors according to the latitude and longitude arrays

xyTools.latlon2yx(lat, lon)[source]

Convert latitude and longitude arrays to y and x arrays in km

xyTools.lon2dx(lat, lon)[source]

Compute dx on a regular grid

xyTools.vect_mod(var_x, var_y, mode='same')[source]

Compute the modulus of a 2D vector from its x-y components calculated on a C grid

xyTools.zogeo(ssh, lat, dy=None, axis=-1)[source]

Compute the zonal surface geostrophy current from a sea level field

xyTools.zomean(var, lat, lat_ref, mask, dx=1, dy=1)[source]

Compute the spatial mean of a variable using: - e1,e2: non-uniform gridto weight by surface - lat_ref: a vector of referenced latitude to decompose the zonal mean into bands

xyTools.zonal_corr(var1, var2, lat, lat_ref, e1=1, e2=1)[source]

Compute the spatial correlation of two variables over zonal bands: - e1,e2: non-uniform gridto weight by surface - lat_ref: a vector of referenced latitude to decompose the zonal mean into bands

Previous topic

Calculation

Next topic

Timeseries computation and analysis: tsTools

This Page