XRadar Georeferencing#

Transformations#

antenna_to_cartesian

Return Cartesian coordinates from antenna coordinates.

get_x_y_z

Add Cartesian coordinates from antenna coordinates.

get_x_y_z_tree

Applies the georeferencing to a xradar datatree

xradar.georeference.transforms.antenna_to_cartesian(ranges, azimuths, elevations, earth_radius=6371000, effective_radius_fraction=None, site_altitude=0)[source]#

Return Cartesian coordinates from antenna coordinates.

Parameters:
  • ranges (array-like) – Distances to the center of the radar gates (bins) in meters.

  • azimuths (array-like) – Azimuth angle of the radar in degrees.

  • elevations (array-like) – Elevation angle of the radar in degrees.

  • earth_radius (float) – Radius of the earth (default is 6371000 m).

  • effective_radius_fraction (float) – Fraction of earth to use for the effective radius (default is 4/3).

  • site_altitude (float) – Altitude amsl of radar site

Returns:

x, y, z (array) – Cartesian coordinates in meters from the radar.

Notes

The calculation for Cartesian coordinate is adapted from equations 2.28(b) and 2.28(c) of Doviak and Zrnić [1]_ assuming a standard atmosphere (4/3 Earth’s radius model).

\begin{gather*} z = \sqrt{r^2+R^2+2*r*R*sin(\theta_e)} - R \\ s = R * arcsin(\frac{r*cos(\theta_e)}{R+z}) \\ x = s * sin(\theta_a) \\ y = s * cos(\theta_a) \end{gather*}

Where r is the distance from the radar to the center of the gate, \(\theta_a\) is the azimuth angle, \(\theta_e\) is the elevation angle, s is the arc length, and R is the effective radius of the earth, taken to be 4/3 the mean radius of earth (6371 km).

References

xradar.georeference.transforms.get_x_y_z(ds, earth_radius=None, effective_radius_fraction=None, target_crs=None)[source]#

Add Cartesian coordinates from antenna coordinates.

Parameters:
  • ds (xarray.Dataset) – Xarray dataset containing range, azimuth, and elevation

  • earth_radius (float) – Radius of the earth. Defaults to a latitude-dependent radius derived from WGS84 ellipsoid.

  • effective_radius_fraction (float) – Fraction of earth to use for the effective radius (default is 4/3).

  • target_crs (pyproj.CRS) – Coordinate reference system. If not provided, radar_crs() is used.

Returns:

ds (xarray.Dataset) – Dataset including x, y, and z as coordinates.

Notes

The calculation for Cartesian coordinate is adapted from equations 2.28(b) and 2.28(c) of Doviak and Zrnić [1]_ assuming a standard atmosphere (4/3 Earth’s radius model).

\begin{gather*} z = \sqrt{r^2+R^2+2*r*R*sin(\theta_e)} - R \\ s = R * arcsin(\frac{r*cos(\theta_e)}{R+z}) \\ x = s * sin(\theta_a) \\ y = s * cos(\theta_a) \end{gather*}

Where r is the distance from the radar to the center of the gate, \(\theta_a\) is the azimuth angle, \(\theta_e\) is the elevation angle, s is the arc length, and R is the effective radius of the earth, taken to be 4/3 the mean radius of earth (6371 km).

References

xradar.georeference.transforms.get_x_y_z_tree(radar, earth_radius=None, effective_radius_fraction=None, target_crs=None)[source]#

Applies the georeferencing to a xradar datatree

Parameters:
  • radar (xarray.DataTree) – Xradar datatree object with radar information.

  • earth_radius (float) – Radius of the earth. Defaults to a latitude-dependent radius derived from WGS84 ellipsoid.

  • effective_radius_fraction (float) – Fraction of earth to use for the effective radius (default is 4/3).

  • target_crs (pyproj.CRS) – Coordinate reference system. If not provided, radar_crs() is used.

Returns:

radar (xarray.DataTree) – Datatree with sweep datasets including georeferenced coordinates

Projection#

get_earth_radius

Return earth radius (in m) for a given Spheroid model (crs) at a given latitude.

add_crs

Add crs_wkt coordinate derived from pyproj.crs.CoordinateSystem.

add_crs_tree

Add crs_wkt coordinate derived from pyproj.crs.CoordinateSystem.

get_crs

Return pyproj.crs.CoordinateSystem from crs_wkt or spatial_ref coordinate.

xradar.georeference.projection.add_crs(ds, crs=None, datum='WGS84')[source]#

Add crs_wkt coordinate derived from pyproj.crs.CoordinateSystem.

Parameters:
Returns:

ds (xarray.Dataset) – Dataset including crs_wkt coordinate.

xradar.georeference.projection.add_crs_tree(radar, datum='WGS84')[source]#

Add crs_wkt coordinate derived from pyproj.crs.CoordinateSystem.

Parameters:
Returns:

radar (xarray.DataTree) – Datatree with sweep datasets including crs_wkt coordinate.

xradar.georeference.projection.get_crs(ds, datum='WGS84')[source]#

Return pyproj.crs.CoordinateSystem from crs_wkt or spatial_ref coordinate.

Parameters:
Returns:

proj_crs (CoordinateSystem)

xradar.georeference.projection.get_earth_radius(crs, latitude)[source]#

Return earth radius (in m) for a given Spheroid model (crs) at a given latitude.

\[R^2 = \frac{a^4 \cos(f)^2 + b^4 \sin(f)^2} {a^2 \cos(f)^2 + b^2 \sin(f)^2}\]
Parameters:
Returns:

radius (float) – earth radius in meter

xradar.georeference.add_crs(ds, crs=None, datum='WGS84')[source]#

Add crs_wkt coordinate derived from pyproj.crs.CoordinateSystem.

Parameters:
Returns:

ds (xarray.Dataset) – Dataset including crs_wkt coordinate.

xradar.georeference.add_crs_tree(radar, datum='WGS84')[source]#

Add crs_wkt coordinate derived from pyproj.crs.CoordinateSystem.

Parameters:
Returns:

radar (xarray.DataTree) – Datatree with sweep datasets including crs_wkt coordinate.

xradar.georeference.antenna_to_cartesian(ranges, azimuths, elevations, earth_radius=6371000, effective_radius_fraction=None, site_altitude=0)[source]#

Return Cartesian coordinates from antenna coordinates.

Parameters:
  • ranges (array-like) – Distances to the center of the radar gates (bins) in meters.

  • azimuths (array-like) – Azimuth angle of the radar in degrees.

  • elevations (array-like) – Elevation angle of the radar in degrees.

  • earth_radius (float) – Radius of the earth (default is 6371000 m).

  • effective_radius_fraction (float) – Fraction of earth to use for the effective radius (default is 4/3).

  • site_altitude (float) – Altitude amsl of radar site

Returns:

x, y, z (array) – Cartesian coordinates in meters from the radar.

Notes

The calculation for Cartesian coordinate is adapted from equations 2.28(b) and 2.28(c) of Doviak and Zrnić [1]_ assuming a standard atmosphere (4/3 Earth’s radius model).

\begin{gather*} z = \sqrt{r^2+R^2+2*r*R*sin(\theta_e)} - R \\ s = R * arcsin(\frac{r*cos(\theta_e)}{R+z}) \\ x = s * sin(\theta_a) \\ y = s * cos(\theta_a) \end{gather*}

Where r is the distance from the radar to the center of the gate, \(\theta_a\) is the azimuth angle, \(\theta_e\) is the elevation angle, s is the arc length, and R is the effective radius of the earth, taken to be 4/3 the mean radius of earth (6371 km).

References

xradar.georeference.get_crs(ds, datum='WGS84')[source]#

Return pyproj.crs.CoordinateSystem from crs_wkt or spatial_ref coordinate.

Parameters:
Returns:

proj_crs (CoordinateSystem)

xradar.georeference.get_earth_radius(crs, latitude)[source]#

Return earth radius (in m) for a given Spheroid model (crs) at a given latitude.

\[R^2 = \frac{a^4 \cos(f)^2 + b^4 \sin(f)^2} {a^2 \cos(f)^2 + b^2 \sin(f)^2}\]
Parameters:
Returns:

radius (float) – earth radius in meter

xradar.georeference.get_x_y_z(ds, earth_radius=None, effective_radius_fraction=None, target_crs=None)[source]#

Add Cartesian coordinates from antenna coordinates.

Parameters:
  • ds (xarray.Dataset) – Xarray dataset containing range, azimuth, and elevation

  • earth_radius (float) – Radius of the earth. Defaults to a latitude-dependent radius derived from WGS84 ellipsoid.

  • effective_radius_fraction (float) – Fraction of earth to use for the effective radius (default is 4/3).

  • target_crs (pyproj.CRS) – Coordinate reference system. If not provided, radar_crs() is used.

Returns:

ds (xarray.Dataset) – Dataset including x, y, and z as coordinates.

Notes

The calculation for Cartesian coordinate is adapted from equations 2.28(b) and 2.28(c) of Doviak and Zrnić [1]_ assuming a standard atmosphere (4/3 Earth’s radius model).

\begin{gather*} z = \sqrt{r^2+R^2+2*r*R*sin(\theta_e)} - R \\ s = R * arcsin(\frac{r*cos(\theta_e)}{R+z}) \\ x = s * sin(\theta_a) \\ y = s * cos(\theta_a) \end{gather*}

Where r is the distance from the radar to the center of the gate, \(\theta_a\) is the azimuth angle, \(\theta_e\) is the elevation angle, s is the arc length, and R is the effective radius of the earth, taken to be 4/3 the mean radius of earth (6371 km).

References

xradar.georeference.get_x_y_z_tree(radar, earth_radius=None, effective_radius_fraction=None, target_crs=None)[source]#

Applies the georeferencing to a xradar datatree

Parameters:
  • radar (xarray.DataTree) – Xradar datatree object with radar information.

  • earth_radius (float) – Radius of the earth. Defaults to a latitude-dependent radius derived from WGS84 ellipsoid.

  • effective_radius_fraction (float) – Fraction of earth to use for the effective radius (default is 4/3).

  • target_crs (pyproj.CRS) – Coordinate reference system. If not provided, radar_crs() is used.

Returns:

radar (xarray.DataTree) – Datatree with sweep datasets including georeferenced coordinates