xugrid.UgridDataArray.from_structured#

static UgridDataArray.from_structured(da: DataArray, x: str | None = None, y: str | None = None) UgridDataArray[source]#

Create a UgridDataArray from a (structured) xarray DataArray.

The spatial dimensions are flattened into a single UGRID face dimension.

By default, this method looks for the “x” and “y” coordinates and assumes they are one-dimensional. To convert rotated or curvilinear coordinates, provide the names of the x and y coordinates.

Parameters:
  • da (xr.DataArray) – Last two dimensions must be ("y", "x").

  • x (str, default: None) – Which coordinate to use as the UGRID x-coordinate.

  • y (str, default: None) – Which coordinate to use as the UGRID y-coordinate.

Returns:

unstructured

Return type:

UgridDataArray