map_field¶
Import path: earth2studio.run.map_field
Documentation¶
Select the variables and domain of target from x.
Use it to fit fetched data or a model's output to another model's inputs, or to
an output subset. batch, time and lead_time are kept from x,
as are coordinates that target leaves empty. Exact contiguous selections
are views; labels missing from a numeric coordinate select the nearest one.
Curvilinear auxiliaries are never indexed as dimensions; model validation
checks their geometry at the inference boundary.
map_field selects and never regrids. Nearest selection is accepted only
when x covers target: a target label more than one source spacing
beyond the source's range (a regional source on a global grid, or a
-180..180 longitude source on a 0..360 grid) raises instead of copying edge
values. Resolution is not checked, so a source coarser than the target (a
1 degree source on a 0.25 degree grid) repeats neighbouring values. Fetch
such data with fetch_data(target_grid=...) or wrap the source in
RegriddedSource.
Parameters:
-
x(DataArray) –Field to select from
-
target(DataArray | CoordSystem) –Signature to select, such as
model.input_coords(), or a mapping of coordinate names to labels
Returns:
-
DataArray–xontarget's coordinates, carryingtarget's grid metadata whentargetis a DataArray
Raises:
-
ValueError–If a label is missing from a non-numeric coordinate, a numeric coordinate of
xdoes not covertarget's range, or the geometry or CRS does not match a DataArraytarget.