geoclaw.util module of utility functions

This describes new tools added in Clawpack 5.2.1.

Documentation auto-generated from the module docstrings

GeoClaw util Module $CLAW/geoclaw/src/python/geoclaw/util.py

Module provides provides utility functions.

Functions:
  • dms2decimal - Convert (degrees, minutes, seconds) to decimal degrees
  • dist_meters2latlong - Convert dx, dy distance in meters to degrees
  • dist_latlong2meters - Convert dx, dy distance in degrees to meters
  • haversine - Calculate the haversine based great circle distance
  • inv_haversine - Inverts the haversine distance
clawpack.geoclaw.util.dist_latlong2meters(dx, dy, latitude=0.0)

Convert distance from degrees longitude-latitude to meters.

Takes the distance described by dx and dy in degrees and converts it into distances in meters.

returns (float, float)

clawpack.geoclaw.util.dist_meters2latlong(dx, dy, latitude=0.0)

Convert distance from meters to degrees of longitude-latitude.

Takes the distance described by dx and dy in meters and converts it into distances in the longitudinal and latitudinal directions in degrees.

returns (float, float)

clawpack.geoclaw.util.dms2decimal(d, m, s, coord='N')

Convert coordinates in (degrees, minutes, seconds) to decimal form.

If coord == ‘S’ or coord == ‘W’ then value is negated too.

Example:
>>> topotools.dms2decimal(7,30,36,'W')
-7.51

(Note that you might want to add 360 to resulting W coordinate if using E coordinates everywhere in a computation spanning date line.)

Returns:float
clawpack.geoclaw.util.haversine(x0, y0, x1=None, y1=None, units='degrees')

x0,y0 is assumed to be a point (or an array with the same shapes as x1,y1) x1,y1 is a point or two arrays of points (of the same dimension) returns array with same shape as x1 and y1 containing distance of each point from (x0,y0).

For backward compatibility, also allows x0,y0 to be 2-tuples specifying two points, but this is not suggested since the notation is not consistent.

clawpack.geoclaw.util.inv_haversine(d, x1, y1, y2, Rsphere=6367500.0, units='degrees')

Invert the Haversine function to find dx given a distance and point.

Invert the haversine function to find dx given distance d and (x1,y1) and y2. The corresponding x2 can be x1+dx or x1-dx. May return NaN if no solution.