tracmass.new_grid#

tracmass.new_grid(fluxes, dtm_start=None, dtm_end=None)[source]#

Build the static grid geometry for a run.

Calls fluxes once (at dtm_start) purely to read the time-invariant geometry — kmt, dxdy, imt / jmt / km, iperio / jperio — and the GCM output interval (timestep). No flux data is loaded. The returned GridFields is immutable for the lifetime of the run and can be reused across many new_flux() buffers on the same grid (successive experiments, restart windows).

Integration direction is inferred from dtm_start / dtm_end exactly as in new_flux(): dtm_end < dtm_start marks a backward run (grid.reverse=True). grid.timestep is always positive.

Parameters:
  • fluxes (callable or str) – fluxes(dtm) -> xr.Dataset, or the name of a tracmass.gcm sub-module (e.g. "glorys"). When the adapter can be identified, the [env.gcm] subset table from the active tracmass.toml environment is applied first via tracmass.config.apply_gcm_subset().

  • dtm_start (pd.Timestamp or str or None, optional) – Any valid time for the adapter; only the geometry is read. Default None — fluxes is called with no arguments at all, so its own default applies (for gcm.glorys/gcm.ecco2 this falls through to tracmass.seagrid.glorys.open_dataset() / tracmass.seagrid.ecco2.open_dataset()’s own dtm default).

  • dtm_end (pd.Timestamp or str or None, optional) – When earlier than the resolved dtm_start, marks the grid backward (reverse=True). Default None (forward).

Returns:

GridFields – Static geometry with timestep (positive) and reverse set.

Return type:

GridFields

See also

new_flux

build the flux buffer, optionally reusing a grid from here.