Geoid reading object (sarpy.io.DEM.geoid)

Provides a class for calculating the height of the WGS84 geoid above the ellipsoid at any given latitude and longitude.

Some Accuracy Details: Using the 5 minute pgm and linear interpolation, the average error |calculated - real| is around 5 millimeters, and the worst case error is around 30 centimeters. Using cubic interpolation, the average error drops to about 3 mm, and the worst case is about 17 cm.

Using the 1 minute pgm and linear interpolation, the average error is around 0.5 mm and worst case error around 1 cm. Using cubic interpolation, the average error is still around 0.5 mm, and worst case error around 2 mm.

The accuracy obtained using the 5, 2.5, or 1 minute pgm are likely all more than suitable for any SAR application. The the accuracy clearly increases with finer grid.

Some Processing Speed and Resource Details: A memory map into the pgm file is established, which requires relatively little “real” RAM, but an amount of virtual memory on par with the file size. The speed seems to generally scale close to inverse linearly with pixel size, so using the 5 minute pgm is generally ~4-5 times faster than using the 1 minute pgm.

Using the 5 minute pgm, processing rate of around 4-8 million points per second for linear interpolation and 1-2 million points per second for cubic interpolation. Using the 1 minute pgm, this processing rate drops to 1-2 million points per second for linear interpolation, and ~million points per second using the cubic interpolation. These rates depend of a variety of factors including processor speed, hard drive speed, and how your operating system handles memory maps.

The 5 minute pgm is about 25 times smaller at around 18 MB, while the 1 minute pgm file is around 450 MB.

File Locations: As of January 2020, the egm2008 pgm files are available for download at https://geographiclib.sourceforge.io/html/geoid.html

Specifically 1 minute data is available at https://sourceforge.net/projects/geographiclib/files/geoids-distrib/egm2008-1.tar.bz2 or https://sourceforge.net/projects/geographiclib/files/geoids-distrib/egm2008-1.zip

Specifically the 5 minute data is available at https://sourceforge.net/projects/geographiclib/files/geoids-distrib/egm2008-5.tar.bz2 or https://sourceforge.net/projects/geographiclib/files/geoids-distrib/egm2008-5.zip

sarpy.io.DEM.geoid.find_geoid_file_from_dir(dir_name, search_files=None)

Find the geoid file.

Parameters:
  • dir_name (str) –

  • search_files (str|List[str]) –

Return type:

str

class sarpy.io.DEM.geoid.GeoidHeight(file_name)

Bases: object

Calculator for the height of the WGS84 geoid above the ellipsoid at any given latitude and longitude, based on one of the egm .pgm files.

We are set up to use a dem/geoid parent directory. In this case, we expect our egm .pgm to be in the <root_dir>/geoid directory, and we will search in order of preference (‘egm2008-1.pgm’, ‘egm2008-2_5.pgm’, ‘egm2008-5.pgm’, ‘egm96-5.pgm’, ‘egm96-15.pgm’)

get(lat, lon, cubic=True, block_size=50000)

Calculate the height of the geoid above the ellipsoid in meters at the given points.

Parameters:
  • lat (numpy.ndarray) –

  • lon (numpy.ndarray) –

  • cubic (bool) – Use a simple cubic spline interpolation, otherwise us simple linear. Default is True.

  • block_size (None|int) – If None, then the entire calculation will proceed as a single block. Otherwise, block processing using blocks of the given size will be used. The minimum value used for this is 50,000, and any smaller value will be replaced with 50,000. Default is 50,000.

Return type:

numpy.ndarray

classmethod from_directory(dir_name, search_files=None)

Create the GeoidHeight object from a search directory.

Parameters:
  • dir_name (str) –

  • search_files (str|List[str]) –

Return type:

GeoidHeight