seagrid.sources.model.scrippsgog#
Scripps Gulf of Guinea (GoG) regional MITgcm daily output (HTTPS files).
The run (GG_i001) is served as netCDF files, one per day and variable
group, e.g. daily/GG_i001_2024-01-02_1day_UVEL_VVEL_top200m.nc, and
cached unchanged in <datadir>/daily/<year>/.
Layout: an MITgcm C-grid on a regular 1/64° mesh (1376 × 385 T-cells,
11°W–10.5°E, 1–7°N). The velocity files cover the 320 T-cell rows 2–7°N
and keep MITgcm’s staggered dimensions (uvel on (z, YC, XG), the
west face of each T-cell; vvel on (z, YG, XC), the south face plus
the northernmost north face) and their face metrics (dyG, dxG,
drF) and open fractions (hFacW, hFacS). open_dataset(dtm)
returns the whole velocity file.
There is no hFacC in the files. ScrippsGoG.grid_definition()
rebuilds it from the binary Depth grid file and the layer thicknesses
with MITgcm’s partial-cell rule (calc_hfac()), and checks it against
the files’ hFacW/hFacS.
Examples
>>> from seagrid import scrippsgog
>>> ds = scrippsgog.open_dataset("2024-06-01")
>>> grid = scrippsgog.grid_definition()
Module Attributes
|
Binary MITgcm grid files (big-endian float32) under |
Functions
|
Rebuild MITgcm's T-cell open fraction |
|
Return the number of open layers and the cell thickness from |
|
Raise if a rebuilt |
|
Return the array shape |
Classes
|
Scripps Gulf of Guinea regional MITgcm daily output (HTTPS). |
- class seagrid.sources.model.scrippsgog.ScrippsGoG(variant=None, **overrides)[source]#
Bases:
ModelSourceScripps Gulf of Guinea regional MITgcm daily output (HTTPS).
Settings (
[scrippsgog]):host,product(PRELIM),run(i001),variables({key: [file group, name in file]}),hfac_min(MITgcm’s partial-cell minimum fraction of the run) anddelr_file(the layer-thickness file ingrid/).- Parameters:
variant (str | None)
overrides (Any)
- available_dates(data_var='uvel')[source]#
Return the dates the server has files for (from its directory listing).
- Parameters:
data_var (
str, optional) – Variable. Default"uvel".- Returns:
- Return type:
DatetimeIndex
- open_dataset(dtm=None, data_var=None, *, tracers=False, **kwargs)[source]#
Open one day, downloading the file first if it is not cached.
Without data_var (and tracers), the whole velocity file:
uvel,vveland the face metrics. Other parameters as forModelSource.open_dataset().
- retrieve_grid(force=False)[source]#
Download the binary MITgcm grid files (
XC,YC,Depth, …).- Parameters:
force (
bool, optional) – Download again even if cached. Default False.- Returns:
- Return type:
- read_grid_field(name)[source]#
Read one binary MITgcm grid field (
XC,YC,Depth,RC).- Parameters:
name (
str) – Field name;<name>.dataand<name>.metamust be ingriddir(seeretrieve_grid()).- Returns:
numpy.ndarray– float32,(385, 1376)for 2-D fields.- Return type:
- seagrid.sources.model.scrippsgog.calc_hfac(depth, drf, hfac_min=0.2, hfac_min_dr=0.0)[source]#
Rebuild MITgcm’s T-cell open fraction
hFacCfrom the bathymetry.- Parameters:
depth (
numpy.ndarray) – Ocean depth (positive, m),(ny, nx); 0 on land.drf (
numpy.ndarray) – Layer thicknesses (m),(nz,), surface first.hfac_min (
float, optional) – MITgcmhFacMinandhFacMinDr.hfac_min_dr (
float, optional) – MITgcmhFacMinandhFacMinDr.
- Returns:
numpy.ndarray–hFacC, float32(nz, ny, nx), in [0, 1].- Return type:
Notes
As MITgcm
ini_masks_etc: the fraction of each layer above the sea floor is rounded to 0 below half the minimum size, and up to the minimum size below it.Examples
>>> calc_hfac(np.array([[25.0]]), np.array([10.0, 10.0, 10.0]))[:, 0, 0] array([1. , 1. , 0.5], dtype=float32)
- seagrid.sources.model.scrippsgog.calc_kmt_dzt(hfac, drf)[source]#
Return the number of open layers and the cell thickness from
hFacC.- Parameters:
hfac (
numpy.ndarray) – Open fraction,(nz, ny, nx).drf (
numpy.ndarray) – Layer thicknesses (m),(nz,).
- Returns:
kmt (
numpy.ndarray) – Number of open layers, int32(ny, nx); 0 on land.dzt (
numpy.ndarray) –drf * hfac(partial bottom cells), float32(nz, ny, nx).
- Return type:
- seagrid.sources.model.scrippsgog.check_hfac(hfac_ext, ref, atol=1e-4)[source]#
Raise if a rebuilt
hFacCdisagrees with a file’shFacW/hFacS.MITgcm sets a face’s open fraction to the smaller of its two T-cells’.
- Parameters:
hfac_ext (
numpy.ndarray) –hFacCon the velocity rows plus one row on each side.ref (
xarray.Dataset) – A velocity file withhFacWandhFacS.atol (
float, optional) – Tolerance.
- Raises:
ValueError – If they disagree by more than atol.
- Return type:
None