toad.utils.synthetic_data

Functions

add_shift_blob(data_xr[, center_lat, ...])

Add an abrupt shift blob to the data array.

add_xyz_coords(data)

Add 3D Cartesian coordinates to the dataset for globe plotting.

create_global_dataset([lat_size, lon_size, ...])

Generate a global dataset with background trend and spatially coherent abrupt shifts.

toad.utils.synthetic_data.add_shift_blob(data_xr, center_lat=0, center_lon=0, center_time=50, sigma_lat=10, sigma_lon=20, sigma_time=1, steepness=2.0, magnitude=1.0)

Add an abrupt shift blob to the data array.

Parameters:
  • center_lat (float)

  • center_lon (float)

  • center_time (int)

  • sigma_lat (float)

  • sigma_lon (float)

  • sigma_time (float)

  • steepness (float)

  • magnitude (float)

toad.utils.synthetic_data.add_xyz_coords(data)

Add 3D Cartesian coordinates to the dataset for globe plotting.

toad.utils.synthetic_data.create_global_dataset(lat_size=90, lon_size=180, time_size=80, background_trend=0.0, background_noise=0.005, n_shifts=3, random_seed=42)

Generate a global dataset with background trend and spatially coherent abrupt shifts.

Parameters:
  • lat_size (int) – Number of latitude points

  • lon_size (int) – Number of longitude points

  • time_size (int) – Number of time points

  • background_trend (float) – Linear trend coefficient

  • background_noise (float) – Amplitude of random noise

  • n_shifts (int) – Number of abrupt shift events to add

  • random_seed (int) – Seed for reproducible results

Returns:

Dataset containing the time series and coordinates labels (xr.DataArray): Binary indicator of shift locations shift_params (dict): Parameters of the generated shifts

Return type:

data (xr.Dataset)

Example

>>> data_ds, labels_xr, shift_params = create_global_dataset(
>>>    lat_size=30,
>>>    lon_size=60,
>>>    time_size=120,
>>>    n_shifts=3,
>>>    random_seed=1,
>>>    background_noise=0.01,
>>> )