seagrid.sources.model.glorys#
GLORYS12 daily reanalysis from the Mercator Ocean THREDDS server (OPeNDAP).
Each day and variable is read over OPeNDAP and cached as one Zarr store,
<datadir>/<year>/GLORYS12V1_<date>_grid<X>.zarr. The server needs a
Mercator Ocean account, read from ~/.netrc (see Glorys.check_auth()).
Layout (NEMO ORCA12 C-grid, 1/12°): one variable opens with its own
dimensions (deptht or depthw, y, x) and coordinates
lat_<g>/lon_<g>, where <g> is the first letter of the variable
(lat_u for uvel). Opened together (open_dataset(dtm)), the depth
dimensions become z. The velocity stores have x = 4322: two halo
columns in the west and one in the east relative to the T-cells of the mesh
files (x = 4320).
Examples
>>> from seagrid import glorys
>>> ds = glorys.open_dataset("2010-06-01")
>>> temp = glorys.open_dataarray("2010-06-01", "temp")
>>> grid = glorys.grid_definition()
Functions
|
Return the T-cell thickness of a NEMO grid with partial bottom cells. |
Classes
|
GLORYS12 daily reanalysis (Mercator Ocean THREDDS, OPeNDAP, login). |
Exceptions
Login to the Mercator THREDDS server failed (see |
- exception seagrid.sources.model.glorys.AuthError[source]#
Bases:
PermissionErrorLogin to the Mercator THREDDS server failed (see
Glorys.check_auth()).
- class seagrid.sources.model.glorys.Glorys(variant=None, **overrides)[source]#
Bases:
OpendapModelSourceGLORYS12 daily reanalysis (Mercator Ocean THREDDS, OPeNDAP, login).
Settings (
[glorys]):host(dap2://tds.mercator-ocean.fr),product(glorys12v1),variables,mesh_hgrandmesh_zgr(NEMO mesh files indatadir(), needed bygrid_definition()),chunks(dask chunks of the remote read and the cached stores),opendap_timeout([connect, read] seconds per request),account_email,userguide_url.- Parameters:
variant (str | None)
overrides (Any)
- has_fill_values: ClassVar[bool] = True#
True if land cells hold fill values that
mask_fill()replaces.
- check_auth(raise_error=True, timeout=20)[source]#
Check that the THREDDS server accepts the login in
~/.netrc.Requests the description (
.dds) of theuveldataset without following redirects: the server answers 200 when the login works and redirects to its login page when it is missing or wrong. Nothing is downloaded.- Parameters:
- Returns:
bool– True if the login works.- Raises:
AuthError – The login is missing or rejected. The message says what is wrong with the netrc file, how to fix it and how to request an account.
seagrid.download.DownloadError – If the server cannot be reached (not a login problem).
- Return type:
- grid_definition(dask=True, force=False)[source]#
Return the ORCA12 cell metrics from the NEMO mesh files, cached as Zarr.
As
ModelSource.grid_definition(). Fill values in land cells of older caches become 0 (land iskmt == 0anddzt == 0).
- rechunk_wvel(start, end=None, depth_chunk=10, path=None)[source]#
Rewrite cached
wvelstores with depth_chunk levels per chunk.wvelstores downloaded by tracmass before 2026-10-08 hold each 1000 × 1000 tile as one 50-level chunk, so reading a few levels decompresses all 50. Each store is written next to the original, checked to hold identical values, and only then swapped in. Stores that already have depth_chunk levels per chunk are skipped.Do not run it on days a tracking run reads at the same time: a run that opened a store before the swap fails to read it.
- Parameters:
start (
strordatetime-like) – First day.end (
strordatetime-like, optional) – Last day (inclusive). Default: start only.depth_chunk (
int, optional) – Levels per chunk. Default 10, asuvel/vvel.path (
stroros.PathLike, optional) – Rechunk this one store instead (for testing on a copy).
- Returns:
listofpathlib.Path– The stores that were rewritten.- Raises:
RuntimeError – If a rewritten store differs from its original (which is then left untouched).
- Return type:
- seagrid.sources.model.glorys.calc_e3t(zgr)[source]#
Return the T-cell thickness of a NEMO grid with partial bottom cells.
- Parameters:
zgr (
xarray.Dataset) – A NEMOmesh_zgrfile withe3t_0(thickness of full cells),e3t_ps(thickness of the bottom cell) andmbathy(1-based level of the bottom cell, 0 on land).- Returns:
xarray.DataArray–(z, y, x)thickness in metres, 0 below the sea floor.- Return type: