mlair.helpers.geofunctions

Functions related to geo locations etc.

Module Contents

Functions

deg2rad_all_points(lat1: xr_int_float, lon1: xr_int_float, lat2: xr_int_float, lon2: xr_int_float) → Tuple[tuple_of_2xr_int_float, tuple_of_2xr_int_float]

Converts coordinates provided in lat1, lon1, lat2, and lon2 from deg to rad. In fact this method just calls

haversine_dist(lat1: xr_int_float, lon1: xr_int_float, lat2: xr_int_float, lon2: xr_int_float, to_radians: bool = True, earth_radius: float = 6371.0) → xarray.DataArray

Calculate the great circle distance between two points

Attributes

__author__

__date__

xr_int_float

tuple_of_2xr_int_float

mlair.helpers.geofunctions.__author__ = Felix Kleinert
mlair.helpers.geofunctions.__date__ = 2021-02-16
mlair.helpers.geofunctions.xr_int_float
mlair.helpers.geofunctions.tuple_of_2xr_int_float
mlair.helpers.geofunctions.deg2rad_all_points(lat1: xr_int_float, lon1: xr_int_float, lat2: xr_int_float, lon2: xr_int_float) → Tuple[tuple_of_2xr_int_float, tuple_of_2xr_int_float]

Converts coordinates provided in lat1, lon1, lat2, and lon2 from deg to rad. In fact this method just calls dasks deg2rad method on all inputs and returns a tuple of tuples.

Parameters
  • lat1 – Latitude(-s) of first location

  • lon1 – Longitude(-s) of first location

  • lat2 – Latitude(-s) of second location

  • lon2 – Longitude(-s) of second location

Returns

Lats and lons in radians ((lat1, lon1), (lat2, lon2))

Return type

mlair.helpers.geofunctions.haversine_dist(lat1: xr_int_float, lon1: xr_int_float, lat2: xr_int_float, lon2: xr_int_float, to_radians: bool = True, earth_radius: float = 6371.0) → xarray.DataArray

Calculate the great circle distance between two points on the Earth (specified in decimal degrees or in radians)

Reference: ToBeAdded (First implementation provided by M. Langguth)

Parameters
  • lat1 – Latitude(-s) of first location

  • lon1 – Longitude(-s) of first location

  • lat2 – Latitude(-s) of second location

  • lon2 – Longitude(-s) of second location

  • to_radians – Flag if conversion from degree to radiant is required

  • earth_radius – Earth radius in kilometers

Returns

Distance between locations in kilometers