Frequently used functions under geodat.nc

The following functions are shortcuts for applying frequently used functions from the other modules (such as monthly and math) on Variable instances.

Manipulation along time axis

climatology(var[, appendname, ...])
anomaly(var[, appendname, clim, ...])
running_climatology(var, appendname, ...[, ...]) Calculate the running climatology, with anomaly
clim2long(clim, target)
TimeSlices(var, lower, upper, toggle[, ...]) Return a time segment of the variable according to the lower (inclusive)
time_input_to_datetime(time, calendar, units) Return a datetime.datetime object given time as string
time_array_to_dim(time_array, calendar, ...) Return a geodat.nc.Dimension object given a time array
create_monthly(calendar, units, time0[, ...]) Return a generator that return a scalar time value with the specified calendar and unit.
create_climatology_dimension(calendar, units) Create a monthly dimension for climatology time axis :param calendar: e.g.
create_monthly_dimension(calendar, units, ...)
create_monthly_dimension2([ref_dim])

Map regridding

pyferret_regrid(var[, ref_var, axis, nlon, ...]) Use pyferret to perform regridding.
regrid(var, nlon, nlat[, verbose]) Use spherical harmonic for regridding
conform_regrid(*args, **kwargs) Given a list of variable

Mathematical functions

nc_cal(func) A decorator that returns a variable object
div(u, v[, varname, long_name]) Compute wind divergence by central difference
gradient(var, axis[, mask_boundary]) Compute the gradient of a variable taking into account the convergence
integrate(var, axis[, varname, versatile]) Integrate variable along one or more axes

Statistical analysis and signal processing

wgt_ave(var[, axis, lat_weighted]) A more general routine for averaging
wgt_sum(var[, axis]) A more general routine for sum
gaus_filter(var, gausize) Filter a variable spatially (i.e.
spatial_corr(var1, var2)
regress(var1, var2)

Indexing and Slicing

concatenate(variables[, axis]) Concatenate a list of variables similar to numpy.concatenate
ensemble(variables[, new_axis, new_axis_unit]) Given a list of variables, perform numpy.concatenate()
conform_region(*args) Return a dictionary with the common lat-lon region

File I/O

getvar(filename, varname, *args, **kwargs) Short hand for retrieving variable from a netcdf file
savefile(filename, listofvar[, overwrite, ...]) filename - a string that specifies the filename,

Visualisation

contour(variable, *args, **kwargs) Use mpl_toolkits.basemap.Basemap to plot
contourf(variable, *args, **kwargs) Use mpl_toolkits.basemap.Basemap to plot
quiver(variable, *args, **kwargs) Use mpl_toolkits.basemap.Basemap to plot
plot_vs_axis(var, axis, *args, **kwargs)

Working with PyFerret

var2fer(var[, name]) Given a geodat.nc.Variable, return a dictionary
fer2var(var) Convert the dictionary returned by pyferret.getdata into a
Fork me on GitHub