Reference

The vast majority of the functionality provided by PyGeode is available within the top level namespace of the module pygeode, along with the fundamental classes Var, Axis, and Dataset. The contents of this top level namespace is summarized here. Several submodules with further functionality are also included.

pygeode

The top level pygeode namespace

File Input and Output

open(filename[, format, value_override, ...])

Returns a Dataset containing variables defined in a single file or a dict of Dataset for a netcdf4 file containing groups.

openall(files[, format, opener])

Returns a Dataset containing variables merged across multiple files.

open_multi(files[, format, opener, pattern, ...])

Returns a Dataset containing variables merged across many files.

save(filename, dataset[, format, cfmeta])

Saves a Var or Dataset to file.

Fundamental Classes

Var(axes[, dtype, name, values, atts, plotatts])

The base class of all data objects in PyGeode.

Axis(values[, name, atts, plotatts, rtol])

An object that describes a single dimension of a Var object.

Dataset(vars[, atts, print_warnings])

Container class for Var objects.

Axis Types

NamedAxis(values, name, **kwargs)

Generic axis object identified by its name.

Lon(values[, name, atts, plotatts, rtol])

Longitude axis.

Lat(values[, weights])

Latitude axis.

Height(values[, name, atts, plotatts, rtol])

Geometric height axis.

Pres(values[, name, atts, plotatts, rtol])

Pressure height axis.

Hybrid(values, A, B, **kwargs)

Hybridized vertical coordinate axis.

StandardTime([values, datefmt, units, startdate])

Time axis describing the standard Gregorian calendar.

ModelTime365([values, datefmt, units, startdate])

Time axis describing a model 365-day calendar.

ModelTime360([values, datefmt, units, startdate])

Time axis describing a model 360-day calendar.

Yearless(*args, **kwargs)

Time axis describing a calendar with no months or years.

NonCoordinateAxis(*args, **kwargs)

Non-coordinate axis (disables nearest-neighbour value matching, etc.)

Axis helper functions

regularlon(n[, origin, order, repeat_origin])

Constructs a regularly spaced Lon axis with n longitudes.

rotatelon(v, origin[, duplicate])

Rotates longitude axis to start at a new origin.

regularlat(n[, order, inc_poles])

Constructs a regularly spaced Lat axis with n latitudes.

gausslat(n[, order, axis_dict])

Constructs a Gaussian Lat axis with n latitudes.

standardtimerange(start, end[, step, units, ...])

Creates a StandardTime axis for the period from start to end.

standardtimen(start, n[, step, units, ref])

Creates a StandardTime axis of length n.

modeltime365range(start, end[, step, units, ...])

Creates a ModelTime365 axis for the period from start to end.

modeltime365n(start, n[, step, units, ref])

Creates a ModelTime365 axis of length n.

modeltime360range(start, end[, step, units, ...])

Creates a ModelTime360 axis for the period from start to end.

modeltime360n(start, n[, step, units, ref])

Creates a ModelTime360 axis of length n.

yearlessn(n[, start, step, units])

Creates a Yearless axis of length n.

General Operations

asdataset(vars[, copy, print_warnings])

Tries to convert a collection of objects into a single dataset.

concatenate(*items, **kwargs)

Concatenates multiple Var or Dataset objects together.

ensemble(*varlists)

Creates an ensemble out of a set of similar variables.

vprod(*args)

Multiplies an arbitrary number of variables together

vsum(*args)

Adds an arbitrary number of variables together

Element-wise math

sign(x)

Sign (+1 = positive, -1 = negative).

exp(x)

Natural exponent.

log(x)

Natural logarithm.

log10(x)

Base-10 logarithm.

cos(x)

Cosine of angle (in radians).

sin(x)

Sine of angle (in radians).

tan(x)

Tangent of angle (in radians).

cosd(x)

Cosine of angle (in degrees)

sind(x)

Sine of angle (in degrees)

tand(x)

Tangent of angle (in degrees)

sinh(x)

Hyperbolic sine.

cosh(x)

Hyperbolic cosine.

tanh(x)

Hyperbolic tangent.

arcsin(x)

Inverse sine (in radians).

arccos(x)

Inverse cosine (in radians).

arctan(x)

Inverse tangent (in radians).

arctan2(x, y)

Inverse tangent.

arcsind(x)

Inverse sine (in degrees).

arccosd(x)

Inverse cosine (in degrees).

arctand(x)

Inverse tangent (in degrees).

arctand2(x, y)

Inverse tangent.

arcsinh(x)

Inverse hyperbolic sine.

arccosh(x)

Inverse hyperbolic cosine.

arctanh(x)

Inverse hyperbolic tangent.

sqrt(x)

Square root.

absolute(x)

Absolute value.

nan_to_num(x)

Replace nan with zero and inf with finite numbers.

minimum(x, y)

Element-wise minimum of the two given arguments.

maximum(x, y)

Element-wise maximum of the two given arguments.

real(x)

Real part of a complex array.

imag(x)

Imaginary part of a complex array.

angle(x)

Angles (arguments) of a complex array.

conj(x)

Complex conjugate of a complex array.

clip(*args)

Clips values to given interval.

Climat module

dailymean(var)

Computes an average value for each day.

monthlymean(var)

Averages over each month.

seasonalmean(var)

Averages over each season.

yearlymean(var)

Averages over each year.

diurnalmean(var)

Computes an average value for each time of day (averages over all years, months, days).

climatology(var)

Computes a climatological mean.

dailynanmean(var)

Computes a nan-aware average value for each day.

dailystdev(var)

Computes daily standard deviation.

dailynanstdev(var)

Computes nan-aware daily standard deviation.

dailycount(var)

Counts number of non-nan data points contributing to daily mean.

climtrend(var)

For each month, day, hour, etc., compute a least-squares fit to a linear trend over all years.

from_trend(taxis[, coef, A, B])

Reconstructs linear timeseries from a given trend.

… and other similar routines; see Climat module

Timeutils module

timeutils.conform_values(taxis1, taxis2)

Given two time axes, return new axes such that their values are comparable.

timeutils.date_diff(taxis, dt1, dt2[, units])

Returns time interval between two dates.

timeutils.delta(taxis[, units, allow_multiple])

Returns the interval between values of a given time axis.

timeutils.jointimeaxes(var[, yaxis, daxis])

Convert a variable with a 2D time axis into one with a 1D time axis.

timeutils.modify(taxis[, resolution, ...])

Modifies the auxiliary arrays associated with a time axis.

timeutils.reltime(taxis[, startdate, units])

Returns time axis values relative to a given reference date.

timeutils.removeleapyears(data[, ...])

Removes leap day(s) from data on a standard calendar.

timeutils.splittimeaxis(var[, iaxis])

Convert a variable with a 1D time axis into one with a 2D time axis.

timeutils.wrapdate(taxis, dt[, allfields])

Returns a modified date dictionary such that all fields lie within standard values.

Stats module

correlate(X, Y[, axes, output, pbar])

Computes Pearson correlation coefficient between variables X and Y.

regress(X, Y[, axes, N_fac, output, pbar])

Computes least-squares linear regression of Y against X.

multiple_regress(Xs, Y[, axes, N_fac, ...])

Computes least-squares multiple regression of Y against variables Xs.

difference(X, Y[, axes, alpha, Nx_fac, ...])

Computes the mean value and statistics of X - Y.

paired_difference(X, Y[, axes, alpha, ...])

Computes the mean value and statistics of X - Y, assuming that individual elements of X and Y can be directly paired.

isnonzero(X[, axes, alpha, N_fac, output, pbar])

Computes the mean value of X and statistics relevant for a test against the hypothesis that it is 0.

EOF Analysis

EOF(x[, num, iaxis, weight, out])

Computes the leading Empirical Orthogonal Function(s) for the given variable.

SVD(var1, var2[, num, subspace, iaxis, ...])

Finds coupled EOFs of two fields.

Plot module

showvar(var, *args, **kwargs)

Plot variable, showing a contour plot for 2d variables or a line plot for 1d variables.

showgrid(vf[, vl, ncol, size, lbl])

Create grid of contour plots of multiple variables.

showlines(vs[, fmts, labels, size, lblx, lbly])

Produce line plots of a list of 1D variables on a single figure.

vcontour(var[, clevs, clines, axes, lblx, ...])

Create a contour plot (lines, filled, or both) from a variable.

vplot(var[, fmt, axes, transpose, lblx, lbly])

Create a line plot of a variable.

vscatter(varx, vary[, axes, lblx, lbly])

Create a scatter plot from two variables with the same shape.

vquiver(varu, varv[, varc, axes, lblx, ...])

Create a quiver plot from two variables.

vstreamplot(varu, varv[, axes, lblx, lbly, ...])

Create a streamplot from two variables.

vsigmask(pval, axes[, mjsig, mnsig, mjsigp, ...])

Add significance shading to a contour plot from a variable.

vhist(var[, axes, lblx, lbly])

Create a histogram of values taken by a variable.

clfdict(cdelt[, min, mid, nf, nl, ndiv, ...])

Returns kwargs to showvar() for a filled contour plot.

cldict(cdelt[, range, min, mid, cidelt, nozero])

Returns kwargs to showvar() for a line contour plot.

log1sdict(cmin[, cdelt, nf, nl, ndiv])

Returns kwargs to showvar() for a one-sided logarithmically-spaced contour plot.

log2sdict(cmin[, cdelt, nf, nl, ndiv, nozero])

Returns kwargs to showvar() for a two-sided logarithmically-spaced contour plot.

External Interfaces

ext_xarray.to_xarray(dataset)

Converts a PyGeode Dataset into an xarray Dataset.

ext_xarray.from_xarray(dataset)

Converts an xarray Dataset into a PyGeode Dataset.

Under the hood

View module

A helper class for mapping subsets of variables