wradlib.georef.polar.spherical_to_proj

wradlib.georef.polar.spherical_to_proj#

wradlib.georef.polar.spherical_to_proj(r, phi, theta, site, *, crs=None, re=None, ke=1.3333333333333333)[source]#
wradlib.georef.polar.spherical_to_proj(obj: DataArray, **kwargs)
wradlib.georef.polar.spherical_to_proj(obj: Dataset, **kwargs)

Transforms spherical coordinates (r, phi, theta) to projected coordinates centered at site in given projection.

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.

  • phi (numpy.ndarray) – Contains the azimuthal angles.

  • theta (numpy.ndarray) – Contains the elevation angles.

  • site (sequence) – the lon / lat coordinates of the radar location and its altitude a.m.s.l. (in meters) if site is of length two, altitude is assumed to be zero

  • crs (osgeo.osr.SpatialReference, optional) – Destination Spatial Reference System (Projection). Defaults to wgs84 (epsg 4326).

  • re (float, optional) – earth’s radius [m], defaults to None (calculating from given latitude).

  • ke (float, optional) – adjustment factor to account for the refractivity gradient that affects radar beam propagation. In principle this is wavelength- dependend. The default of 4/3 is a good approximation for most weather radar wavelengths.

Returns:

coords (numpy.ndarray) – Array of shape (…, 3). Contains projected map coordinates.

Examples

A few standard directions (North, South, North, East, South, West) with different distances (amounting to roughly 1°) from a site located at 48°N 9°E

>>> r  = np.array([0.,   0., 111., 111., 111., 111.,])*1000
>>> az = np.array([0., 180.,   0.,  90., 180., 270.,])
>>> th = np.array([0.,   0.,   0.,   0.,   0.,  0.5,])
>>> csite = (9.0, 48.0, 0)
>>> coords = spherical_to_proj(r, az, th, csite)
>>> for coord in coords:
...     print( '{0:7.4f}, {1:7.4f}, {2:7.4f}'.format(*coord))
...
 9.0000, 48.0000,  0.0000
 9.0000, 48.0000,  0.0000
 9.0000, 48.9981, 725.7160
10.4872, 47.9904, 725.7160
 9.0000, 47.0017, 725.7160
 7.5131, 47.9904, 1694.2234

Here, the coordinates of the east and west directions won’t come to lie on the latitude of the site because the beam doesn’t travel along the latitude circle but along a great circle.

See Georeferencing and Projection.