emp.geometry

Copyright (C) 2023 by The RAND Corporation See LICENSE and README.md for information on usage and licensing.

Contains the Point class describe locations in a coordinate-independent manner.

Functions

get_A_angle(point_b, point_s)

The angle A b/w the line of sight radial vector and the vertical/origin-burst vector.

get_line_of_sight_midway_point(point_b, point_t)

Get the position vector in geographic cartesian coordinates to a point mid-way between the upper and lower absorption layers, along the line of sight ray.

get_rotation_matrix(theta, axis)

Rotation matrix for angle theta and axis (vx, vy, vz).

get_xvec_g_from_A_to_B(pointA, pointB)

Compute the vector pointing from A to B in geographic cartesian coordinates.

great_circle_distance(pointA, pointB)

Computes the great-circle distance bewteen points A, B on the sphere.

line_of_sight_check(burst_point, target_point)

Given a burst and target point, compute the vector pointing from B to T and confirm that this vector's length is less than the length of the tangent vector pointing from B to a point on the surface.

Classes

Point(coord1, coord2, coord3, coordsys[, ...])

A point class used to handle the many different coordinate transformations used.

emp.geometry.get_rotation_matrix(theta, axis)[source]

Rotation matrix for angle theta and axis (vx, vy, vz). https://en.wikipedia.org/wiki/Rotation_matrix#Conversion_from_rotation_matrix_to_axis%E2%80%93angle

Parameters:

theta (float) – Rotation angle, in radians.

Returns:

Rotation matrix.

Return type:

NDArray[np.float64]

class emp.geometry.Point(coord1, coord2, coord3, coordsys, consistency_check=True)[source]

A point class used to handle the many different coordinate transformations used.

__init__(coord1, coord2, coord3, coordsys, consistency_check=True)[source]

Initialize a point by recording the point in all 4 coordinate systems.

Parameters:
  • coord1 (float) – First coordinate.

  • coord2 (float) – Second coordinate.

  • coord3 (float) – Third coordinate.

  • coordsys (str) – Coordinate system. Must be one of [‘lat/long geo’, ‘cartesian geo’, ‘lat/long mag’, ‘cartesian mag’].

  • consistency_check (bool, optional) – Once the point has been transformed to each of the four coordinate systems, perform a check by performing all possible coordinate transformations and checking that they all agree. By default True

classmethod from_gps_coordinates(latitude, longitude, altitude_km=0.0)[source]

Create a Point from GPS-style coordinates.

Parameters:
  • latitude (float | str) – Latitude in degrees (e.g. 40.7128) or as a string with N/S suffix.

  • longitude (float | str) – Longitude in degrees (e.g. -74.0060) or as a string with E/W suffix.

  • altitude_km (float) – Altitude above mean sea level in kilometers.

Returns:

A Point object in geographic lat/long coordinates.

Return type:

Point

static validate_latlong_coords(r, phi, lambd)[source]

Confirm that the (r, phi, lambd) coordinates lie within the proper range.

Parameters:
  • r (float) – Radius, any units.

  • phi (float) – Latitude, in radians.

  • lambd (float) – Longitude, in radians.

Return type:

None

static validate_spherical_coords(theta, phi)[source]

Check that the spherical coordinates lie within the proper range. No longer used.

Parameters:
  • theta (float) – Polar spherical coordinate, in radians.

  • phi (phi) – Azimuthal spherical coordinate, in radians.

Return type:

None

emp.geometry.get_xvec_g_from_A_to_B(pointA, pointB)[source]

Compute the vector pointing from A to B in geographic cartesian coordinates.

Parameters:
  • pointA (Point) – Starting point A.

  • pointB (Point) – Destination point B.

Returns:

The vector pointing from point A to point B.

Return type:

NDArray[np.float64]

emp.geometry.great_circle_distance(pointA, pointB)[source]

Computes the great-circle distance bewteen points A, B on the sphere. see: http://www.movable-type.co.uk/scripts/latlong.html

Parameters:
  • pointA (Point) – A point.

  • pointB (Point) – A point.

Returns:

The great circle distance between points A, B.

Return type:

float

emp.geometry.get_A_angle(point_b, point_s)[source]

The angle A b/w the line of sight radial vector and the vertical/origin-burst vector.

Parameters:
  • point_b (Point) – The burst point.

  • point_s (Point) – Evaluation point along the line of sight.

Returns:

The angle A, in radians.

Return type:

float

emp.geometry.get_line_of_sight_midway_point(point_b, point_t)[source]

Get the position vector in geographic cartesian coordinates to a point mid-way between the upper and lower absorption layers, along the line of sight ray.

Parameters:
  • point_b (Point) – Burst point.

  • point_t (Point) – Target point.

Returns:

The midway point.

Return type:

Point

emp.geometry.line_of_sight_check(burst_point, target_point)[source]

Given a burst and target point, compute the vector pointing from B to T and confirm that this vector’s length is less than the length of the tangent vector pointing from B to a point on the surface.

Parameters:
  • burst_point (Point) – Burst point.

  • target_point (Point) – Target point.

Returns:

True if the line of sight is valid, False otherwise.

Return type:

bool