API reference

OceanDataset

OceanDataset(dataset)

OceanDataset combines a xarray.Dataset with other objects used by OceanSpy (e.g., xgcm.Grid).

Import

OceanDataset.shift_averages([averageList])

Shift average variables to time_midp.

OceanDataset.manipulate_coords([fillna, ...])

Manipulate coordinates to make them compatible with OceanSpy.

Attributes

OceanDataset.name

Name of the OceanDataset.

OceanDataset.description

Description of the OceanDataset.

OceanDataset.dataset

xarray.Dataset: A multi-dimensional, in memory, array database.

OceanDataset.grid

xgcm.Grid: A collection of axes, which is a group of coordinates that all lie along the same physical dimension but describe different positions relative to a grid cell.

OceanDataset.parameters

A dictionary defining model parameters that are used by OceanSpy.

OceanDataset.aliases

A dictionary to connect custom variable names to OceanSpy reference names.

OceanDataset.grid_coords

Grid coordinates used by xgcm.Grid.

OceanDataset.grid_periodic

List of xgcm.Grid axes that are periodic.

OceanDataset.projection

Cartopy projection of the OceanDataset.

Set

OceanDataset.set_name(name[, overwrite])

Set name of the OceanDataset.

OceanDataset.set_description(description[, ...])

Set description of the OceanDataset.

OceanDataset.set_parameters(parameters)

Set model parameters used by OceanSpy.

OceanDataset.set_aliases(aliases[, overwrite])

Set aliases to connect custom variables names to OceanSpy reference names.

OceanDataset.set_grid_coords(grid_coords[, ...])

Set grid coordinates used by xgcm.Grid.

OceanDataset.set_grid_periodic(grid_periodic)

Set grid axes that will be treated as periodic by xgcm.Grid.

OceanDataset.set_projection(projection, **kwargs)

Set Cartopy projection of the OceanDataset.

Methods

OceanDataset.merge_into_oceandataset(obj[, ...])

Merge a Dataset or DataArray into the OceanDataset.

OceanDataset.to_netcdf(path, **kwargs)

Write contents to a netCDF file.

OceanDataset.to_zarr(path, **kwargs)

Write contents to a zarr group.

OceanDataset.create_tree([grid_pos])

Create a scipy.spatial.cKDTree for quick nearest-neighbor lookup.

Shortcuts

OceanDataset.subsample

Access oceanspy.subsample functions.

OceanDataset.compute

Access oceanspy.compute functions, and merge the computed Dataset into the OceanDataset.

OceanDataset.plot

Access oceanspy.plot functions.

OceanDataset.animate

Access oceanspy.animate functions.

Opening

open_oceandataset

Open OceanDataset objects.

open_oceandataset.from_netcdf(path, **kwargs)

Load an OceanDataset from a netcdf file.

open_oceandataset.from_zarr(path, **kwargs)

Load an OceanDataset from a Zarr store.

open_oceandataset.from_catalog(name[, ...])

Import oceandataset using a yaml catalog.

Subsampling

subsample

Subsample OceanDataset objects.

Functions

subsample.cutout(od[, varList, YRange, ...])

Cutout the original dataset in space and time preserving the original grid structure.

subsample.mooring_array(od, Ymoor, Xmoor[, ...])

Extract a mooring array section following the grid.

subsample.survey_stations(od, Ysurv, Xsurv)

Extract survey stations.

subsample.particle_properties(od, times, ...)

Extract Eulerian properties of particles using nearest-neighbor interpolation.

Computing

compute

Create new variables using OceanDataset objects.

Smart-name

Computed variables are dynamically named. Names depend on input and operation.

compute.gradient(od[, varNameList, ...])

Compute gradient along specified axes, returning all terms (not summed).

compute.divergence(od[, iName, jName, ...])

Compute divergence of a vector field.

compute.curl(od[, iName, jName, kName, aliased])

Compute curl of a vector field.

compute.laplacian(od[, varNameList, ...])

Compute laplacian along specified axis

compute.integral(od[, varNameList, ...])

Compute integrals along specified axes (simple discretization).

compute.weighted_mean(od[, varNameList, ...])

Compute weighted means using volumes, surfaces, or distances.

Fixed-name

Computed variables have a hard-coded name.

compute.potential_density_anomaly(od)

Compute potential density anomaly.

compute.Brunt_Vaisala_frequency(od)

Compute Brunt-Väisälä Frequency.

compute.velocity_magnitude(od)

Compute velocity magnitude.

compute.horizontal_velocity_magnitude(od)

Compute magnitude of horizontal velocity.

compute.vertical_relative_vorticity(od)

Compute vertical component of relative vorticity.

compute.relative_vorticity(od)

Compute relative vorticity.

compute.kinetic_energy(od)

Compute kinetic energy.

compute.eddy_kinetic_energy(od)

Compute eddy kinetic energy.

compute.horizontal_divergence_velocity(od)

Compute horizontal divergence of the velocity field.

compute.shear_strain(od)

Compute shear component of strain.

compute.normal_strain(od)

Compute normal component of strain.

compute.Okubo_Weiss_parameter(od)

Compute Okubo-Weiss parameter.

compute.Ertel_potential_vorticity(od[, full])

Compute Ertel Potential Vorticity.

compute.mooring_volume_transport(od)

Compute horizontal volume flux through a mooring array section (in/outflow).

compute.heat_budget(od)

Compute terms to close heat budget as explained by [R6f0e4d5c55c6-Pie17].

compute.salt_budget(od)

Compute terms to close salt budget as explained by [R8275cee51d73-Pie17].

compute.geographical_aligned_velocities(od)

Compute zonal and meridional velocities from U and V on orthogonal curvilinear grid.

compute.survey_aligned_velocities(od)

Compute horizontal velocities orthogonal and tangential to a survey.

compute.missing_horizontal_spacing(od)

Compute missing horizontal spacing.

Plotting

plot

Plot using OceanDataset objects.

Functions

plot.TS_diagram(od[, Tlim, Slim, dens, ...])

Plot temperature-salinity diagram.

plot.time_series(od, varName[, meanAxes, ...])

Plot time series.

plot.horizontal_section(od, varName[, ...])

Plot horizontal section.

plot.vertical_section(od, varName[, ...])

Plot vertical section.

Animating

animate

Animate using oceanspy plot functions.

Functions

animate.TS_diagram(od[, display, ...])

Animate TS diagrams.

animate.horizontal_section(od[, display, ...])

Animate horizontal section plots.

animate.vertical_section(od[, display, ...])

Animate vertical section plots.

Utilities

utils

OceanSpy utilities that don't need OceanDataset objects.

Functions

utils.spherical2cartesian(Y, X[, R])

Convert spherical coordinates to cartesian.

utils.great_circle_path(lat1, lon1, lat2, lon2)

Generate a great circle trajectory specifying the distance resolution.

utils.cartesian_path(x1, y1, x2, y2[, delta])

Generate a trajectory specifying the distance resolution.

utils.densjmd95(s, t, p)

Density of Sea Water using Jackett and McDougall 1995 (JAOT 12) polynomial (modified UNESCO polynomial) [R5a812deaf4b9-JaMc95].

utils.densmdjwf(s, t, p)

Density of Sea Water using McDougall et al. 2003 (JAOT 20) polynomial (Gibbs Potential) [Re2d133f292dd-McJa03].

utils.Coriolis_parameter(Y[, omega])

Compute Coriolis parameter (both vertical and horizontal components).

LLC-transformation

llc_rearrange

OceanSpy functionality that transforms a dataset with LLC geometry characterized by 13 faces (or tiles), into one with simple geometry.

Class

llc_rearrange.LLCtransformation()

A class containing the transformation types of LLCgrids.