Package pygeodesy :: Module geoids |
[frames] | no frames]

# Module geoids

Classes GeoidG2012B, GeoidKarney and GeoidPGM to interpolate the height of various geoids at `LatLon` locations or separate lat-/longitudes using different interpolation methods.

GeoidKarney is a transcription of Charles Karney's C++ class Geoid to pure Python. However, the GeoidG2012B and GeoidPGM interpolators both depend on scipy and numpy and require those packages to be installed.

In addition, each geoid interpolator needs grid knots to be (down)loaded from a geoid file, specific to the interpolator, more details below. For each interpolator, there are several interpolation choices, like bilinear, cubic, spline, etc.

Typical usage is as follows. First create an interpolator from a geoid file, also refered to as the grid knots.

`ginterpolator = GeoidXyz(grid_file, **options)`

Get the interpolated geoid height of `LatLon` location(s) with

`h = ginterpolator(ll)`

or

`h0, h1, h2, ... = ginterpolator(ll0, ll1, ll2, ...)`

or

`hs = ginterpolator(lls)` # `list, tuple, generator, ...`

For separate lat-/longitudes invoke the `.height` method

`h = ginterpolator.height(lat, lon)`

or

`h0, h1, h2, ... = ginterpolator.height(lats, lons)` # `list, ...`

Errors from `scipy` as raised as SciPyErrors. Warnings issued by `scipy` can be thrown as SciPyWarning exceptions, provided Python `warnings` are filtered accordingly, see SciPyWarning.

See Also: Charles Karney's GeographicLib, Geoid height and Installing the Geoid datasets, SciPy interpolation RectBivariateSpline and interp2d and the functions elevations.elevation2 and elevations.geoidHeight2.

Version: 19.03.31

Classes
| GeoidError Geoid interpolator or interpolation error.
| PGMError Error parsing or cropping an `egm*.pgm` geoid dataset.
| _GeoidBase (INTERNAL) Base class for `Geoid...`s.
| GeoidG2012B Geoid height interpolator for GEOID12B Model grids CONUS, Alaska, Hawaii, Guam and Northern Mariana Islands, Puerto Rico and U.S. Virgin Islands and American Samoa based on `SciPy` RectBivariateSpline or interp2d interpolation.
| GeoidKarney Geoid height interpolator for Charles Karney's GeographicLib Earth Gravitational Model (EGM) geoid egm*.pgm datasets using bilinear or cubic interpolation and caching in pure Python transcribed from Karney's C++ class Geoid.
| GeoidPGM Geoid height interpolator for Charles Karney's GeographicLib Earth Gravitational Model (EGM) geoid egm*.pgm datasets but based on `SciPy` RectBivariateSpline or interp2d interpolation.

Functions
egmGeoidHeights(GeoidHeights_dat) Generate geoid egm*.pgm height tests from GeoidHeights.dat Test data for Geoids. |

Function Details

### egmGeoidHeights(GeoidHeights_dat) |
Generate geoid egm*.pgm height tests from GeoidHeights.dat Test data for Geoids. Parameters: `GeoidHeights_dat` - The un-gz-ed `GeoidHeights.dat` file (`str` or `file` handle). Returns: For each test, yield a 5-Tuple `(lat, lon, egm84, egm96, egm2008)` with the expected heights for 3 different EGM grids in `-90.0 <= lat <= 90.0` and `-180.0 <= lat <= 180.0` degrees. Raises: `GeoidError` - Invalid GeoidHeights_dat. Note: Function egmGeoidHeights is used to test geoids GeoidKarney and GeoidPGM, see PyGeodesy module `test/testGeoids.py`.