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:

  1. "x" and "y" dimensions.

  2. "longitude" and "latitude" dimensions.

  3. "axis" attributes of “X” or “Y” on coordinates.

  4. "standard_name" attributes of “longitude”, “latitude”, “projection_x_coordinate”, or “project_y_coordinate” on coordinate variables.

Specify the x and y coordinate names explicitly otherwise.

Parameters:
  • da (xr.DataArray) – Last two dimensions must be the y and x dimension (in that order!).

  • 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