polaris.mesh.radius.rescale_sphere_radius
- polaris.mesh.radius.rescale_sphere_radius(ds: Dataset, radius: float | None = None) list[str][source]
Rescale the coordinates, lengths and areas of a spherical MPAS mesh to a new sphere radius, in place, and update the
sphere_radiusglobal attribute to match. Latitudes, longitudes, angles and dimensionless fields are unchanged. The variables rescaled are thelength_variablesandarea_variablesgroups frompolaris.mesh.variables.get_mesh_variables(). Those not indsare skipped, so the function works on any MPAS component’s mesh, initial-condition or restart file.- Parameters:
ds (xarray.Dataset) – A dataset on a spherical MPAS mesh with a positive
sphere_radiusglobal attribute. The variables are replaced with rescaled copies that keep their attributes and encoding.radius (float, optional) – The new sphere radius in meters. The default is the PCD’s
mean_radius.
- Returns:
rescaled (list of str) – The names of the variables that were rescaled
- Raises:
ValueError – If the mesh is not spherical or
sphere_radiusis missing or not positive