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: |
|
---|
-
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.
fetch_noaa_tide_data
(station, begin_date, end_date, time_zone='GMT', datum='STND', units='metric', cache_dir=None, verbose=True)¶ Fetch water levels and tide predictions at given NOAA tide station.
The data is returned in 6 minute intervals between the specified begin and end dates/times. A complete specification of the NOAA CO-OPS API for Data Retrieval used to fetch the data can be found at:
By default, retrieved data is cached in the geoclaw scratch directory located at:
$CLAW/geoclaw/scratchRequired Arguments: - station (string): 7 character station ID
- begin_date (datetime): start of date/time range of retrieval
- end_date (datetime): end of date/time range of retrieval
Optional Arguments: - time_zone (string): see NOAA API documentation for possible values
- datum (string): see NOAA API documentation for possible values
- units (string): see NOAA API documentation for possible values
- cache_dir (string): alternative directory to use for caching data
- verbose (bool): whether to output informational messages
Returns: - date_time (numpy.ndarray): times corresponding to retrieved data
- water_level (numpy.ndarray): preliminary or verified water levels
- prediction (numpy.ndarray): tide predictions
-
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.