fetch_data#

earth2studio.data.fetch_data(
source,
time,
variable,
lead_time=array([0], dtype='timedelta64[h]'),
device='cpu',
interp_to=None,
interp_method='nearest',
legacy=True,
)[source]#

Utility function to fetch data arrays from particular sources and load data on the target device. If desired, xarray interpolation/regridding in the spatial domain can be used by passing a target coordinate system via the optional interp_to argument.

Parameters:
  • source (DataSource | ForecastSource) – The data source to fetch from

  • time (TimeArray) – Timestamps to return data for (UTC).

  • variable (VariableArray) – Strings or list of strings that refer to variables to return

  • lead_time (LeadTimeArray, optional) – Lead times to fetch for each provided time, by default np.array(np.timedelta64(0, “h”))

  • device (torch.device, optional) – Torch device to load data tensor to, by default “cpu”

  • interp_to (CoordSystem, optional) – If provided, the fetched data will be interpolated to the coordinates specified by lat/lon arrays in this CoordSystem

  • interp_method (str) – Interpolation method to use with xarray (by default ‘nearest’)

  • legacy (bool, optional) – If True (default), returns tuple of (torch.Tensor, CoordSystem). If False, returns xr.DataArray with numpy arrays for CPU or cupy arrays for CUDA.

Returns:

If legacy=True: Tuple containing output tensor and coordinate OrderedDict. If legacy=False: xr.DataArray with numpy arrays (CPU) or cupy arrays (CUDA).

Return type:

tuple[torch.Tensor, CoordSystem] | xr.DataArray

Examples using earth2studio.data.fetch_data#

Tropical Cyclone Tracking

Tropical Cyclone Tracking

Running Atlas Inference

Running Atlas Inference

CBottle Super Resolution

CBottle Super Resolution

Ensemble Forecasting with Downscaling

Ensemble Forecasting with Downscaling

Regional Downscaling to COSMO-REA (6 km and 2.2 km)

Regional Downscaling to COSMO-REA (6 km and 2.2 km)

StormScope Satellite and Radar Nowcasting

StormScope Satellite and Radar Nowcasting

StormCast-CONUS Score-Based Data Assimilation

StormCast-CONUS Score-Based Data Assimilation

Statistical Inference

Statistical Inference

Running DLESyM Inference

Running DLESyM Inference

Running the DLESyM ISCCP-ERA5 Model

Running the DLESyM ISCCP-ERA5 Model

CBottle Data Generation and Infilling

CBottle Data Generation and Infilling

IO Backend Performance

IO Backend Performance

Creating a Local Data Source

Creating a Local Data Source