API reference

This page provides an auto-generated summary of oocgcm’s API.

General purpose utilities and data-structures

Parameters

parameters.physicalparameters.coriolis_parameter(...) Return Coriolis parameter for a given latitude.
parameters.physicalparameters.beta_parameter(...) Return planetary beta parameter.

Data-structures

core.grids.VectorField2d(vx, vy[, ...]) Minimal data structure for manupulating 2d vector fields on a grid.
core.grids.VectorField3d(vx, vy, vz[, ...]) Minimal data structure for manupulating 3d vector fields on a grid.
core.grids.Tensor2d(axx, axy, ayx, ayy[, ...]) Minimal data structure for manupulating 2d tensors on a grid.

I/O tools

core.io.return_xarray_dataset(filename[, chunks]) Return an xarray dataset corresponding to filename.
core.io.return_xarray_dataarray(filename, ...) Return a xarray dataarray corresponding to varname in filename.
oceanmodels.nemo.io.return_xarray_dataset(...) Wrapper for core.io.return_xarray_dataset.
oceanmodels.nemo.io.return_xarray_dataarray(...) Wrapper for core.io.return_xarray_dataarray.

Miscellaneous

core.utils.is_numpy(array) Return True if array is a numpy array
core.utils.is_xarray(array) Return True if array is a xarray.DataArray
core.utils.is_daskarray(array) Return True if array is a dask array
core.utils.has_chunks(array) Return True if array is a xarray or a daskarray with chunks.
core.utils.map_apply(func, scalararray) Return a xarray dataarray with value func(scalararray.data)

Two-dimensional grid descriptor objects

Two-dimensional grid descriptors hold all the information required for defining operations on xarray dataarray that require information on the underlying grid of the model.

Generic two-dimensional model-agnostic grid descriptor

core.grids.generic_2d_grid([arrays, parameters]) Model agnostic grid object, two dimensional version.

Creating grids descriptor from arrays

griddeddata.grids.variables_holder_for_2d_grid_from_latlon_arrays([...]) This class create the dictionnary of variables to be used for creating a oocgcm.core.grids.generic_2d_grid from arrays of latitude and longitude.
griddeddata.grids.latlon_2d_grid([...]) Return a generic 2d grid build from arrays of lat,lon.
griddeddata.grids.variables_holder_for_2d_grid_from_plane_coordinate_arrays([...]) This class create the dictionnary of variables to be used for creating a oocgcm.core.grids.generic_2d_grid from arrays of plane coordinates.
griddeddata.grids.plane_2d_grid([xcoord, ...]) Return a generic 2d grid build from arrays of coordinate.

Creating grids descriptors from model output

oceanmodels.nemo.grids.variables_holder_for_2d_grid_from_nemo_ogcm([...]) This class create the dictionnary of variables used for creating a oocgcm.core.grids.generic_2d_grid from NEMO output files.
oceanmodels.nemo.grids.nemo_2d_grid([...]) Return a generic 2d grid from nemo coordinate and mask files.

Attributes

core.grids.generic_2d_grid.dims Dimensions of the xarray dataarrays describing the grid.
core.grids.generic_2d_grid.ndims Number of dimensions of the dataarrays describing the grid.
core.grids.generic_2d_grid.shape Shape of the xarray dataarrays describing the grid.
core.grids.generic_2d_grid.chunks Chunks of the xarray dataarrays describing the grid.

Manipulating grids

generic_2d_grid implement the mapping interface with keys given by variable names and values given by DataArray objects.

core.grids.generic_2d_grid.__getitem__(item) The behavior of this function depends on the type of item.
core.grids.generic_2d_grid.__contains__(key) The ‘in’ operator will return true or false depending on whether ‘key’ is an array in the dataset or not.
core.grids.generic_2d_grid.__iter__()
core.grids.generic_2d_grid.chunk([chunks]) Rechunk all the variables defining the grid.
core.grids.generic_2d_grid.get_projection_coordinates([...]) Return (x,y) the coordinate arrays (in m) at grid location.

Changing the grid location of arrays

core.grids.generic_2d_grid.change_grid_location_t_to_u(...) Return a xarray corresponding to scalararray averaged at a new grid location.
core.grids.generic_2d_grid.change_grid_location_u_to_t(...) Return a xarray corresponding to scalararray averaged at a new grid location.
core.grids.generic_2d_grid.change_grid_location_t_to_v(...) Return a xarray corresponding to scalararray averaged at a new grid location.
core.grids.generic_2d_grid.change_grid_location_v_to_t(...) Return a xarray corresponding to scalararray averaged at a new grid location.
core.grids.generic_2d_grid.change_grid_location_f_to_u(...) Return a xarray corresponding to scalararray averaged at a new grid location.
core.grids.generic_2d_grid.change_grid_location_f_to_v(...) Return a xarray corresponding to scalararray averaged at a new grid location.
core.grids.generic_2d_grid.change_grid_location_v_to_u(...) Return a xarray corresponding to scalararray averaged at a new grid location.
core.grids.generic_2d_grid.change_grid_location_u_to_v(...) Return a xarray corresponding to scalararray averaged at a new grid location.

Vector calculus

core.grids.generic_2d_grid.norm_of_vectorfield(...) Return the norm of a vector field, at t-point.
core.grids.generic_2d_grid.scalar_product(...) Return the scalar product of two vector fields, at t-point.
core.grids.generic_2d_grid.scalar_outer_product(...) Return the outer product of a scalar (t location)
core.grids.generic_2d_grid.vertical_component_of_the_cross_product(...) Return the cross product of two vector fields.

Differential operators

core.grids.generic_2d_grid.horizontal_gradient(...) Return the horizontal gradient of the input datastructure.
core.grids.generic_2d_grid.horizontal_gradient_vector(...) Return the horizontal gradient of a scalar field defined at t-points.
core.grids.generic_2d_grid.horizontal_gradient_tensor(...) Return the horizontal gradient tensor of a two-dimensional vector field at u,v locations.
core.grids.generic_2d_grid.horizontal_laplacian(...) Return the horizontal laplacian of a scalar field at t-points.
core.grids.generic_2d_grid.vertical_component_of_curl(...) Return the vertical component of the curl of a vector field.
core.grids.generic_2d_grid.horizontal_divergence(...) Return the horizontal divergence of a vector field at u,v-points.
core.grids.generic_2d_grid.integrate_dxdy(array) Return the horizontal integral of array in regions where where is True.
core.grids.generic_2d_grid.spatial_average_xy(array) Return the horizontal average of array in regions where where is True.

Spatial integration

Operators specific to oceanic applications

core.grids.generic_2d_grid.geostrophic_current_from_sea_surface_height(...) Return the geostrophic current on u,v-grids.
core.grids.generic_2d_grid.q_vector_due_to_kinematic_deformation(...) Return the component of the generalized Q-vector associated with kinematic deformation of a two-dimensional velocity field.
core.grids.generic_2d_grid.frontogenesis_function(...) Return the frontogenesis function.

Tools for filtering timeseries and spatial fields

oocgcm.filtering.timefilters

Testing tools

oocgcm.test.signals