data.fetch_data¶
Import path: earth2studio.data.fetch_data
Documentation¶
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, default:array([timedelta64(0, 'h')])) –Lead times to fetch for each provided time, by default np.array(np.timedelta64(0, "h"))
-
device(device, default:'cpu') –Torch device to load data tensor to, by default "cpu"
-
interp_to(CoordSystem, default:None) –If provided, the fetched data will be interpolated to the coordinates specified by lat/lon arrays in this CoordSystem
-
interp_method(str, default:'nearest') –Interpolation method to use with xarray (by default 'nearest')
-
legacy(bool, default:True) –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: