xscape.core.create_xscp_da
- xscape.core.create_xscp_da(points, seascape_size, var_da, seascape_timerange=None, get_column=False, compute_result=True)
Crops and packages together a series of seascapes.
- Parameters:
points (pd.DataFrame) – DataFrame of points as rows with “lat” and “lon” columns. If seascape_timerange is specified it must also have a “time” column.
seascape_size (float) – Size (in degrees) of the seascape around each point.
var_da (xr.DataArray) – Gridded background field from which we extract the seascapes.
seascape_timerange (np.timedelta64, optional) – Duration of the seascape around each point’s timestamp. If not an exact multiple of the timestep duration, take the minimum number of timesteps so that the specified duration is covered.
get_column (bool, optional) – Whether to include a vertical dimension in the seascape. If True, var_da must have a dimension and coordinate named “depth” or “height”.
compute_result (bool, optional) – Whether to apply .compute() to the final result, which loads it into memory. Massively shortens subsequent computations at the cost of a higher memory footprint. Defaults to True.
- Returns:
A DataArray indexed by seascape_idx, ss_lon and ss_lat. The latter two coordinates correspond to a relative reference frame centered on each seascape.
- Return type:
xr.DataArray
- Raises:
ValueError – When var_da has a time dimension but no seascape_timerange is specified.