Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Evaluating geoid heights using egms in Python

Tags:

python

Are there any libraries in Python that have functions that compute for geoid heights using egm84, egm96 and egm2008?

I know that geographiclib has a function (http://geographiclib.sourceforge.net/html/classGeographicLib_1_1GravityModel.html) that computes for geoid heights using the three egms but I don't know how to implement them in Python (if they are really applicable). How do you implement that? Or if it isn't applicable to Python, are there any libraries that can be used?

Thank you.

like image 299
Marcus Avatar asked Nov 10 '22 10:11

Marcus


1 Answers

There is some relevant work done here on this:

https://github.com/mrJean1/PyGeodesy

Their instructions on use were not the most up to date, but here is a TLDR:

First download your choice of geoid from here, like so:

wget https://sourceforge.net/projects/geographiclib/files/geoids-distrib/egm2008-5.tar.bz2
bzip2 -d egm2008-5.tar.bz2
tar -xvf egm2008-5.tar

Then use in your python script:

import pygeodesy
from pygeodesy.ellipsoidalKarney import LatLon
ginterpolator = pygeodesy.GeoidKarney("./geoids/egm2008-5.pgm")

# Make an example location
lat=51.416422
lon=-116.217151

# Get the geoid height
single_position=LatLon(lat, lon)
h = ginterpolator(single_position)
print(h)

This will give you the deviation from the ellipsoid at that location in meters:

-11.973145778529625

This roughly matches up with what we find when we use an online calculator.

like image 110
user185160 Avatar answered Nov 14 '22 21:11

user185160