seagrid.sources.model.ecco2#

ECCO2 cube92 daily ocean state estimate from the APDRC server (OPeNDAP).

The APDRC GrADS Data Server offers each variable as one OPeNDAP dataset covering the whole daily record. A day is selected from it and cached as a Zarr store, <datadir>/<year>/CUBE92_<date>_<var>.zarr, with the longitudes rolled from 0.125–359.875 to -179.875–179.875.

Layout: a regular 0.25° grid. Variables open on (z, y, x) with 1-D coordinates z (depth, m), y (latitude) and x (longitude). There are no mesh files: ECCO2.grid_definition() computes the cell sizes from the coordinates and the number of ocean levels from the land pattern of one uvel field (land and below-sea-floor cells are exactly 0).

Examples

>>> from seagrid import ecco2
>>> ds = ecco2.open_dataset("2010-06-01")
>>> grid = ecco2.grid_definition()

Functions

calc_grid_spacing(lat, lon[, radius])

Return the face widths of the T-cells of a regular lat/lon grid.

calc_kmt_dzt(uvel0, lev)

Return the number of ocean levels and the layer thickness from one field.

cell_edges(centers)

Return the cell edges around a 1-D array of cell centres.

center_on_prime_meridian(ds)

Roll longitudes 0–360 to -180–180, so the Prime Meridian is in the middle.

Classes

ECCO2([variant])

ECCO2 cube92 daily ocean state estimate (APDRC, OPeNDAP).

class seagrid.sources.model.ecco2.ECCO2(variant=None, **overrides)[source]#

Bases: OpendapModelSource

ECCO2 cube92 daily ocean state estimate (APDRC, OPeNDAP).

Settings ([ecco2]): host, product (path of the dataset directory), variables, chunks, opendap_timeout, compute_retries, grid_reference_date (the day whose uvel gives kmt).

Parameters:
  • variant (str | None)

  • overrides (Any)

seagrid.sources.model.ecco2.calc_grid_spacing(lat, lon, radius=EARTH_RADIUS)[source]#

Return the face widths of the T-cells of a regular lat/lon grid.

Parameters:
  • lat (numpy.ndarray) – 1-D cell-centre latitudes (ny,) and longitudes (nx,), degrees.

  • lon (numpy.ndarray) – 1-D cell-centre latitudes (ny,) and longitudes (nx,), degrees.

  • radius (float, optional) – Earth radius in metres.

Returns:

  • dxv (numpy.ndarray) – Zonal width (the face meridional fluxes cross), m, (ny, nx).

  • dyu (numpy.ndarray) – Meridional height (the face zonal fluxes cross), m, (ny, nx).

Return type:

tuple[ndarray, ndarray]

seagrid.sources.model.ecco2.calc_kmt_dzt(uvel0, lev)[source]#

Return the number of ocean levels and the layer thickness from one field.

The APDRC server declares -1e23 as fill value but serves exactly 0 in land and below-sea-floor cells, so the ocean levels of each column are the levels with a non-zero velocity.

Parameters:
  • uvel0 (numpy.ndarray) – Zonal velocity of one day, (nz, ny, nx).

  • lev (numpy.ndarray) – Depth of the level centres, m, (nz,).

Returns:

  • kmt (numpy.ndarray) – Number of ocean levels, int32, (ny, nx).

  • dzt (numpy.ndarray) – Layer thickness, 0 below the sea floor, (nz, ny, nx).

Return type:

tuple[ndarray, ndarray]

Examples

>>> u = np.array([[[1.0, 0.0]], [[2.0, 0.0]], [[0.0, 0.0]]])
>>> kmt, dzt = calc_kmt_dzt(u, np.array([5.0, 15.0, 30.0]))
>>> kmt.tolist(), dzt[:, 0, 0].tolist()
([[2, 0]], [10.0, 12.5, 0.0])
seagrid.sources.model.ecco2.cell_edges(centers)[source]#

Return the cell edges around a 1-D array of cell centres.

Parameters:

centers (numpy.ndarray) – Cell centres, (n,).

Returns:

numpy.ndarray – Edges, (n + 1,): midpoints, extended by half a cell at each end.

Return type:

ndarray

Examples

>>> cell_edges(np.array([0.5, 1.5, 3.0]))
array([0.  , 1.  , 2.25, 3.75])