from_xarray#
- gpjax.xarray.from_xarray(obj, target, inputs, *, dropna=True)[source]#
Flatten labelled xarray data into a
Dataset.Every input is broadcast onto the target’s grid, so an input on fewer dims (e.g.
elevation(lat, lon)for a(time, lat, lon)target) repeats along the rest. Datetime inputs become float days since their earliest timestamp.- Parameters:
obj (Dataset | DataArray) – The labelled data. A
DataArraymust be named, and that name is the target.target (str) – Name of the data variable to model. Its dims define the grid.
inputs (Sequence[str]) – Coordinates and/or data variables to use as inputs, in the order of the columns of
X.dropna (bool) – Drop grid cells where the target or any input is NaN. When
False, such cells raise instead.
- Returns:
The flattened
Datasetand theGridSpecneeded to map predictions back onto the grid.- Raises:
ValueError – If a name is missing,
inputsis empty, repeats a name or includes the target, an input has a dim the target lacks, aDataArrayis unnamed, or no cells survive NaN handling (or any NaN is present whendropna=False).TypeError – If
inputsis a single string, or the target or an input is not numeric (inputs may also bedatetime64).
- Return type:
Expand for references to
gpjax.xarray.from_xarray