wradlib.georef.polar.spherical_to_xyz

wradlib.georef.polar.spherical_to_xyz(r, phi, theta, sitecoords, re=None, ke=1.3333333333333333, squeeze=None, strict_dims=False)

Transforms spherical coordinates (r, phi, theta) to cartesian coordinates (x, y, z) centered at sitecoords (aeqd).

It takes the shortening of the great circle distance with increasing elevation angle as well as the resulting increase in height into account.

Parameters:
  • r (numpy.ndarray) – Contains the radial distances in meters.
  • phi (numpy.ndarray) – Contains the azimuthal angles in degree.
  • theta (numpy.ndarray) – Contains the elevation angles in degree.
  • sitecoords (a sequence of three floats) – the lon / lat coordinates of the radar location and its altitude a.m.s.l. (in meters) if sitecoords is of length two, altitude is assumed to be zero
  • re (float) – earth’s radius [m]
  • ke (float) – adjustment factor to account for the refractivity gradient that affects radar beam propagation. In principle this is wavelength- dependent. The default of 4/3 is a good approximation for most weather radar wavelengths.
  • squeeze (bool) – If True, returns squeezed array.
  • strict_dims (bool) – If True, generates output of (theta, phi, r, 3) in any case. If False, dimensions with same length are “merged”.
Returns:

  • xyz (numpy.ndarray) – Array of shape (…, 3). Contains cartesian coordinates.
  • rad (osr object) – Destination Spatial Reference System (Projection). Defaults to wgs84 (epsg 4326).