polaris.mesh.info.is_spherical

polaris.mesh.info.is_spherical(ds: Dataset, default: bool | None = None) bool[source]

Whether an MPAS mesh is on a sphere, based on the on_a_sphere global attribute of ds

Parameters:
  • ds (xarray.Dataset) – A dataset with the on_a_sphere attribute, which MPAS meshes always give as 'YES' or 'NO'

  • default (bool, optional) – The value to return if ds has no on_a_sphere attribute. By default, a missing attribute is an error, since a mesh dataset without it is invalid and guessing either way leads to silently wrong results. A step assembling a dataset that has not picked up the attribute yet may pass an explicit default.

Returns:

spherical (bool) – Whether the mesh is on a sphere

Raises:

ValueError – If ds has no on_a_sphere attribute and no default was given, or if the attribute is neither 'YES' nor 'NO'