Field.radius(default=None)[source]

Return the radius of a latitude-longitude plane defined in spherical polar coordinates.

The radius is taken from the datums of any coordinate reference constructs, but if and only if this is not possible then a default value may be used instead.

New in version 3.0.2.

Parameters
default: optional

The radius is taken from the datums of any coordinate reference constructs, but if and only if this is not possible then the value set by the default parameter is used. May be set to any numeric scalar object, including numpy and Data objects. The units of the radius are assumed to be metres, unless specified by a Data object. If the special value 'earth' is given then the default radius taken as 6371229 metres. If default is None an exception will be raised if no unique datum can be found in the coordinate reference constructs.

Parameter example:

Five equivalent ways to set a default radius of 6371200 metres: 6371200, numpy.array(6371200), cf.Data(6371200), cf.Data(6371200, 'm'), cf.Data(6371.2, 'km').

Returns
Data

The radius of the sphere, in units of metres.

Examples

>>> f.radius()
<CF Data(): 6371178.98 m>

>>> g.radius()
ValueError: No radius found in coordinate reference constructs and no default provided