dubfi.util

Collection of utility functions for dubfi.

Added in version 0.1.0: (initial release)

Functions

str2timedelta64(s)

Convert string (user input) to np.timedelta64.

config_overwrite(config, changes)

Overwrite config by given changes, recursively updating dictionaries.

sphere_dist_deg(lon1, lat1, lon2, lat2)

Like sphere_dist_rad(), but input and output is in degrees.

earth_dist_deg(lon1, lat1, lon2, lat2)

Distance on spherical earth input in degrees, output in meters.

sphere_dist_rad(lon1, lat1, lon2, lat2)

Angle between two points on the unit sphere.

Module Contents

dubfi.util.str2timedelta64(s)

Convert string (user input) to np.timedelta64.

Parameters:

s (str)

Return type:

numpy.timedelta64

dubfi.util.config_overwrite(config, changes)

Overwrite config by given changes, recursively updating dictionaries.

Parameters:
  • config (dict)

  • changes (dict)

dubfi.util.sphere_dist_deg(lon1, lat1, lon2, lat2)

Like sphere_dist_rad(), but input and output is in degrees.

Parameters:
  • lon1 (float | numpy.ndarray)

  • lat1 (float | numpy.ndarray)

  • lon2 (float | numpy.ndarray)

  • lat2 (float | numpy.ndarray)

Return type:

float | numpy.ndarray

dubfi.util.earth_dist_deg(lon1, lat1, lon2, lat2)

Distance on spherical earth input in degrees, output in meters.

Parameters:
  • lon1 (array or float) – longitude of first position(s) (degrees east)

  • lat1 (array or float) – latitude of first position(s) (degrees north)

  • lon2 (array or float) – longitude of second position(s) (degrees east)

  • lat2 (array or float) – latitude of second position(s) (degrees north)

Return type:

distance on spherical earth (meters)

dubfi.util.sphere_dist_rad(lon1, lat1, lon2, lat2)

Angle between two points on the unit sphere.

Parameters:
  • lon1 (array or float) – longitude of first position(s) (radians)

  • lat1 (array or float) – latitude of first position(s) (radians)

  • lon2 (array or float) – longitude of second position(s) (radians)

  • lat2 (array or float) – latitude of second position(s) (radians)

Return type:

angle on unit sphere (radians)