osmose.spatial_series

Extract a single grid cell’s value over time from a spatial NetCDF output.

The Python engine writes spatial outputs as (time, species, lat, lon) arrays ({prefix}_spatial_biomass_Simu{i}.nc etc., see osmose.engine.output.write_outputs_netcdf_spatial) when output.spatial.enabled=true. cell_timeseries reads one cell’s trajectory out of such a file without materialising the whole cube.

NaN marks land cells (per the writer’s nan_semantics attribute); ocean cells with no schools in the averaging window hold 0.0. Land cells are returned as NaN so callers can show an empty state rather than a flat-zero line.

This module is part of the core library and deliberately does not import from ui/ — the dimension-name detection sets are defined locally (the UI’s grid_helpers has parallel constants for its own use).

Functions

cell_timeseries(nc_path, variable, *, ...[, ...])

Time series of one grid cell from a spatial NetCDF variable.

cell_timeseries_from_dataset(ds, variable, ...)

Per-cell time series from an already-open xarray.Dataset.

grid_latlon(ds, variable)

Return (lat, lon) coordinate arrays for variable via the dim-name sets.

spatial_diff_2d(ds_a, ds_b, variable, *[, ...])

B A as a 2-D (lat, lon) array; NaN where either side is land/missing.

spatial_slice_2d(ds, variable, *[, ...])

A 2-D (lat, lon) slice of a spatial variable at one timestep.