Class EModel

java.lang.Object
llnl.gnem.core.util.Geometry.EModel

public class EModel extends Object
A class that provides static methods for calculating distances and azimuths on a spherical Earth or a WGS84 ellipsoidal Earth.
Author:
Doug Dodge
  • Field Details

  • Method Details

    • enu2Geodetic

      public static GeodeticCoordinate enu2Geodetic(GeodeticCoordinate refg, ENUCoordinate pos)
    • getSeparationMeters

      public static double getSeparationMeters(GeodeticCoordinate c1, GeodeticCoordinate c2)
    • getDistance

      public static double getDistance(GeodeticCoordinate pt1, GeodeticCoordinate pt2)
    • getAngleBetweenAzimuths

      public static double getAngleBetweenAzimuths(double azimuth1, double azimuth2)
      Gets the angle in degrees between two vectors represented as azimuths in degrees clockwise from North.
      Parameters:
      azimuth1 - Azimuth of the first vector in degrees clockwise from North.
      azimuth2 - Azimuth of the second vector in degrees clockwise from North.
      Returns:
      The angle between the two azimuths in degrees.
    • getAngleInRadians

      public static double getAngleInRadians(double v1x, double v1y, double v2x, double v2y)
    • getAzGapFromAzVector

      public static double getAzGapFromAzVector(List<Double> az)
      Gets the azimuthal gap of an origin solution given a Vector of event-station azimuths.
      Parameters:
      az - The Vector of event-station azimuths
      Returns:
      The azgap value
    • getAzgap

      public static double getAzgap(double evla, double evlo, List<Double> stla, List<Double> stlo)
      Gets the azimuthal gap of an origin solution given the epicenter location and the locations of the stations used in the origin solution.
      Parameters:
      evla - Event latitude
      evlo - Event longitude
      stla - A Vector of station latitudes
      stlo - A Vector of station longitudes
      Returns:
      The azgap value
    • getAzimuth

      public static double getAzimuth(double stla, double stlo, double evla, double evlo)
      Gets the azimuth of an event relative to a station on a spherical Earth.
      Parameters:
      stla - Station latitude
      stlo - Station longitude
      evla - Event latitude
      evlo - Event longitude
      Returns:
      The azimuth of the event relative to the station
    • getAzimuthWGS84

      public static double getAzimuthWGS84(double stla, double stlo, double evla, double evlo)
      Gets the azimuth of an event relative to a station using the WGS84 Earth model.
      Parameters:
      stla - Station latitude
      stlo - Station longitude
      evla - Event latitude
      evlo - Event longitude
      Returns:
      The azimuth of the event relative to the station
    • getBAZ

      public static double getBAZ(double stla, double stlo, double evla, double evlo)
      Gets the back azimuth in degrees (azimuth from event to station) on a spherical Earth.
      Parameters:
      stla - Station latitude
      stlo - Station longitude
      evla - Event latitude
      evlo - Event longitude
      Returns:
      The back azimuth value
    • getBAZWGS84

      public static double getBAZWGS84(double stla, double stlo, double evla, double evlo)
      Gets the back azimuth in degrees (azimuth from event to station) using the WGS84 Earth model
      Parameters:
      stla - Station latitude
      stlo - Station longitude
      evla - Event latitude
      evlo - Event longitude
      Returns:
      The back azimuth value
    • getDegreesFromDeparture

      public static double getDegreesFromDeparture(double lat, double departureKm)
      Gets the change in longitude in degrees given a latitude and departure in km
      Parameters:
      lat - The latitude at which to compute.
      departureKm - The departure in km.
      Returns:
      the change in longitude.
    • getDegreesPerKilometer

      public static double getDegreesPerKilometer()
    • getDelay

      public static double getDelay(GeodeticCoordinate sourcePosition, GeodeticCoordinate referenceElementPosition, GeodeticCoordinate observationElementPosition, double apparentVelocity)
      Computes the delay in passage of a plane wave from the reference element of an array to an observation element of the array. The array is assumed to be small enough in aperature that the plane-wave approximation is valid and that errors introduced by assigning a local Cartesian coordinate system are small.
      Parameters:
      sourcePosition - The position of the source of the plane wave (used to determine the back azimuth.)
      referenceElementPosition - The position of the reference element of the array.
      observationElementPosition - The position of the element for which the delay is to be computed.
      apparentVelocity - The apparent velocity of the plane wave in km/sec.
      Returns:
      The delay in seconds between when the wavefront crosses the reference element and when it crosses the observation element.
    • getDelta

      public static double getDelta(double stla, double stlo, double evla, double evlo)
      Gets the distance in degrees of an event from a station on a spherical Earth.
      Parameters:
      stla - Station latitude.
      stlo - Station longitude.
      evla - Event latitude.
      evlo - Event longitude.
      Returns:
      The distance in degrees.
    • getDelta

      public static double getDelta(Vertex sta, Vertex event)
      Gets the distance in degrees of an event from a station on a spherical Earth.
      Parameters:
      sta - Vertex object containing station coordinates.
      event - Vertex object containing the event epicentral coordinates.
      Returns:
      The distance in degrees.
    • getDeltaWGS84

      public static double getDeltaWGS84(double stla, double stlo, double evla, double evlo)
      Gets the distance in degrees of an event from a station using the WGS84 Earth model
      Parameters:
      stla - Station latitude
      stlo - Station longitude
      evla - Event latitude
      evlo - Event longitude
      Returns:
      The distance in degrees
    • getDeltaWGS84

      public static double getDeltaWGS84(Vertex point1, Vertex point2)
      Gets the distance in degrees of two points on the surface of the Earth using the WGS84 Earth model.
      Parameters:
      point1 - The first point.
      point2 - The second point.
      Returns:
      The distance in degrees.
    • getDepartureKm

      public static double getDepartureKm(double lat, double delta)
      Gets the distance in km along a line of constant latitude
      Parameters:
      lat - The latitude at which to compute.
      delta - The distance in degrees
      Returns:
      the departure in km
    • getDistance

      public static double getDistance(double stla, double stlo, double evla, double evlo)
      Gets the distance in km between two points on a spherical Earth.
      Parameters:
      stla - Station latitude
      stlo - Station longitude
      evla - Event latitude
      evlo - Event longitude
      Returns:
      The distance in kilometers
    • getDistance

      public static double getDistance(Vertex pt1, Vertex pt2)
      Gets the distance in km between two points on a spherical Earth model.
      Parameters:
      pt1 - Vertex object representing first point.
      pt2 - Vertex object representing second point.
      Returns:
      The distance in km.
    • getDistanceWGS84

      public static double getDistanceWGS84(double stla, double stlo, double evla, double evlo)
      Gets the distance in km between two points using the WGS84 Earth model
      Parameters:
      stla - Station latitude
      stlo - Station longitude
      evla - Event latitude
      evlo - Event longitude
      Returns:
      The distance in kilometers
    • getEarthRadius

      public static double getEarthRadius(double latitude)
      Gets the Earth Radius in km as a function of latitude in degrees
      Parameters:
      latitude - The latitude in degrees of the place where the radius is desired
      Returns:
      The Earth Radius value in km
    • getEsaz

      public static double getEsaz(Vertex event, Vertex sta)
      Gets the Event to Station azimuth on a spherical Earth model.
      Parameters:
      event - The epicentral Vertex.
      sta - The station Vertex.
      Returns:
      The azimuth of the station relative to the event epicenter in degrees.
    • getEsaz

      public static double getEsaz(double evla, double evlo, double stla, double stlo)
    • getEsazWGS84

      public static double getEsazWGS84(Vertex event, Vertex sta)
      Gets the Event to Station azimuth using the WGS84 Earth model.
      Parameters:
      event - The epicentral Vertex.
      sta - The station Vertex.
      Returns:
      The azimuth of the station relative to the event epicenter in degrees.
    • getGeodeticCoords

      public static GeodeticCoordinate getGeodeticCoords(GeodeticCoordinate coordOrigin, NEZCoordinate localCoords)
    • getGreatCircleAzimuth

      public static double getGreatCircleAzimuth(double lat1, double lon1, double lat2, double lon2)
      Returns a great-circle azimuth in degrees between two points specified by their latitude and longitude in degrees.
      Parameters:
      lat1 - Latitude of the first point in degrees.
      lon1 - Longitude of the second point in degrees.
      lat2 - Latitude of the second point in degrees.
      lon2 - Longitude of the second point in degrees.
      Returns:
      great-circle distance in degrees
    • getGreatCircleDelta

      public static double getGreatCircleDelta(double lat1, double lon1, double lat2, double lon2)
      Returns a great-circle distance in degrees between two points specified by their latitude and longitude in degrees.
      Parameters:
      lat1 - Latitude of the first point in degrees.
      lon1 - Longitude of the second point in degrees.
      lat2 - Latitude of the second point in degrees.
      lon2 - Longitude of the second point in degrees.
      Returns:
      great-circle distance in degrees
    • getKilometersPerDegree

      public static double getKilometersPerDegree()
    • getLocalCoords

      public static ArrayList<NEZCoordinate> getLocalCoords(GeodeticCoordinate coordOrigin, Vertex[] vertices)
    • getLocalCoords

      public static ArrayList<NEZCoordinate> getLocalCoords(GeodeticCoordinate coordOrigin, ArrayList<GeodeticCoordinate> vertices)
    • getLocalCoords

      public static NEZCoordinate getLocalCoords(GeodeticCoordinate coordOrigin, GeodeticCoordinate position)
    • enu2nez

      public static NEZCoordinate enu2nez(ENUCoordinate enu)
    • getLocalRadiusFromLatitude

      public static double getLocalRadiusFromLatitude(double latitude, double depth)
      A convience method to calculate the Local Radius based on the latitude in degrees
      Parameters:
      latitude - - in DEGREES
      depth - - in km
      Returns:
      the local radius at the given latitude
    • getSeaz

      public static double getSeaz(double evla, double evlo, double stla, double stlo)
    • getSeaz

      public static double getSeaz(Vertex event, Vertex sta)
      Gets the station to event azimuth.
      Parameters:
      event - position of the event epicenter.
      sta - position of the station.
      Returns:
      the station-to-event azimuth in degrees.
    • getWGS84RadiusKm

      public static double getWGS84RadiusKm()
    • reckonWGS84

      public static Vertex reckonWGS84(double latIn, double lonIn, double deltaIn, double azimuthIn)
    • reckon

      public static Vertex reckon(double latIn, double lonIn, double deltaIn, double azimuthIn)
      Calculate point at azimuth and distance from another point. Returns a Vertex at great-circle distance delta and azimuth Azimuth.
      Parameters:
      latIn - latitude in degrees of start point
      deltaIn - great-circle distance between points in degrees
      azimuthIn - east of north (-180 LTEQ Azimuth LTEQ 180 )
      lonIn - Longitude of the start point
      Returns:
      Vertex of point reckoned to
    • smallCircle

      public static Vertex[] smallCircle(Vertex center, double radius, int npts)
      Returns an array of Vertex objects defining points on a small circle of radius radius centered at the point center. The number of Vertex objects returned is equal to npts. TODO note as written this returns (npts + 1) Vertices
      Parameters:
      center - A Vertex object defining the center latitude-longitude of the small circle.
      radius - The radius of the small circle in degrees.
      npts - The number of points to create.
      Returns:
      An array of Vertex objects defining the requested small circle.
    • track

      public static List<Vertex> track(double startLat, double startLon, double endLat, double endLon, int npts)
      Computes a vector of waypoints (including the start and end) for a great-circle track defined by its start and end points.
      Parameters:
      startLat - The starting point latitude in degrees.
      startLon - The starting point longitude in degrees.
      endLat - The ending point latitude in degrees.
      endLon - The ending point longitude in degrees.
      npts - The number of desired points in the track.
      Returns:
      The Vector of Vertex objects that define the track.
    • getGreatCircleArc

      public static void getGreatCircleArc(GeographicCoordinate coord1, GeographicCoordinate coord2, double az, double dist, double[] lats, double[] lons, int npts)
    • geodeticLatToGeocentricLat

      public static double geodeticLatToGeocentricLat(double lat, double heightMeters)
    • geodetic2ecef

      public static ECEFCoordinate geodetic2ecef(GeodeticCoordinate coord)
    • ecef2geodetic

      public static GeodeticCoordinate ecef2geodetic(ECEFCoordinate coord)
    • ecef2geodetic

      public static GeodeticCoordinate ecef2geodetic(double X, double Y, double Z)
    • ecef2enu

      public static ENUCoordinate ecef2enu(GeodeticCoordinate gref, ECEFCoordinate pos)
    • geodetic2enu

      public static ENUCoordinate geodetic2enu(GeodeticCoordinate ref, GeodeticCoordinate pos)
    • enu2ecef

      public static ECEFCoordinate enu2ecef(ENUCoordinate data, GeodeticCoordinate ref)