fetch_data¶
Import path: earth2studio.data.fetch_data
Documentation¶
Fetch field DataArrays with temporal statistics, optionally regridded.
Parameters:
-
source(DataSource | ForecastSource) –The data source to fetch from
-
time(TimeArray) –Timestamps to return data for (UTC).
-
variable(VariableArray) –Variable labels, optionally qualified with a temporal statistic, e.g.
"t2m:mean:24h". -
lead_time(LeadTimeArray, default:cast(LeadTimeArray, array([timedelta64(0, 'h')]))) –Lead times to fetch for each provided time, by default np.array(np.timedelta64(0, "h"))
-
device(device | str, default:'cpu') –NumPy CPU or CuPy CUDA destination, by default "cpu"
-
target_grid(GridDefinition, default:None) –Grid to return fields on, such as
infer_grid(model.input_coords()), by default None, which keeps the source grid. Withoutregridder, fields already on it pass through, exact crops are selected, and otherwise fields are regridded by nearest neighbor within the source resolution, raising if the target extends beyond the source. -
regridder(Regridder, default:None) –Regridder to apply, by default None. It must produce
target_gridwhen both are given. -
member(int | str | Sequence | MemberArray, default:None) –Distinct ensemble member label or labels to fetch, in the source's own labeling, by default None, which returns the member the source was built with. Only ensemble sources, those taking a
memberkeyword (seeEnsembleDataSource), accept it.
Returns:
-
DataArray–Field values with dimensions [time, lead_time, variable, ...], auxiliary coordinates, actual grid metadata and normalized temporal statistics. The field is on the source grid unless regridded. With
member, a leadingensembledimension holds the requested members in order. Floating point fields are always returned as float32, regardless of the source's dtype.
Note
Temporal statistics require native source support. The source chooses its
sampling and computes the reduction; unsupported methods raise ValueError.
Windows exclude their left endpoint and include their right endpoint.
Sources may return NumPy- or CuPy-backed fields. Temporal reductions run on
that backing; the result then moves to device only if it is not already
there, and regridding runs last, on device. Regridding automatically
constructs a regridder on every call; pass a
[Regridder][earth2studio.grids.Regridder] to choose the method and reuse it.