random#

Random DataArray source for testing and examples.

Generates synthetic xarray.DataArray objects with random gridded data on a regular latitude/longitude grid. Useful for unit tests, example pipelines, and quick prototyping without needing real weather/climate data.

Classes#

RandomDataArraySource

Generate random DataArrays on a regular lat/lon grid.

Module Contents#

class physicsnemo_curator.domains.da.sources.random.RandomDataArraySource(
n_samples: int = 10,
n_lat: int = 181,
n_lon: int = 360,
variables: str = 'u10m,v10m,t2m',
seed: int = 42,
)#

Bases: physicsnemo_curator.core.base.Source[xarray.DataArray]

Generate random DataArrays on a regular lat/lon grid.

Each index yields a single xarray.DataArray with dimensions (time, variable, lat, lon) containing random values. The time coordinate advances by one hour per index.

Parameters:
  • n_samples (int) – Number of DataArrays this source provides (i.e. len(source)).

  • n_lat (int) – Number of latitude grid points.

  • n_lon (int) – Number of longitude grid points.

  • variables (str) – Comma-separated variable names (e.g. "u10m,v10m,t2m").

  • seed (int) – Base random seed. Each index uses seed + index for reproducibility.

Examples

>>> from physicsnemo_curator.domains.da.sources import RandomDataArraySource
>>> source = RandomDataArraySource(n_samples=5, n_lat=90, n_lon=180)
>>> len(source)
5
>>> da = next(source[0])
>>> da.dims
('time', 'variable', 'lat', 'lon')

Initialize the random DataArray source.

classmethod params() list[physicsnemo_curator.core.base.Param]#

Declare configurable parameters.

description: ClassVar[str] = 'Generate random DataArrays on a lat/lon grid for testing and prototyping'#

Short description shown in the interactive CLI.

name: ClassVar[str] = 'Random DataArray'#

Human-readable display name for the interactive CLI.