DTED reading objects (sarpy.io.DEM.DTED)

Classes and methods for parsing and using digital elevation models in DTED format.

sarpy.io.DEM.DTED.get_default_prioritization()

Gets the default prioritization of the DTED types.

Return type:

List[str]

sarpy.io.DEM.DTED.get_lat_lon_box(lats, lons)

Gets the lat/lon bounding box, as appropriate.

Parameters:
  • lats (numpy.ndarray|list|tuple|float|int) –

  • lons (numpy.ndarray|list|tuple|float|int) –

Return type:

numpy.ndarray

class sarpy.io.DEM.DTED.DTEDList(root_directory, missing_error=False)

Bases: DEMList

The DEM directory structure is assumed to look like the following:

  • For DTED<1,2>: <root_dir>/dted/<1, 2>/<lon_string>/<lat_string>.dtd

  • For SRTM<1,2,2F>: <root_dir>/srtm/<1, 2, 2f>/<lon_string>/<lat_string>.dt<1,2,2>

Here <lat_string> corresponds to a string of the form X##, where X is one of ‘N’ or ‘S’, and ## is the zero-padded formatted string for the integer value floor(lat).

Similarly, <lon_string> corresponds to a string of the form Y##, where Y is one of ‘E’ or ‘W’, and ### is the zero-padded formatted string for the integer value floor(lon).

<lon_string>, <lat_string> corresponds to the origin in the lower left corner of the DEM tile.

property root_dir

the root directory

Type:

str

get_file_list(lat_lon_box, dem_type=None)

Get the file list required for the given coordinates.

Parameters:
  • lat_lon_box (numpy.ndarray|list|tuple) – The bounding box of the form [lat min, lat max, lon min, lon max].

  • dem_type (None|str|List[str]) – The prioritized list of dem types to check. If None, then get_default_prioritization() is used. Each entry must be one of (“DTED1”, “DTED2”, “SRTM1”, “SRTM2”, “SRTM2F”)

Return type:

List[str]

class sarpy.io.DEM.DTED.DTEDReader(file_name)

Bases: object

Reader/interpreter for DTED files, generally expected to be a helper class. As such, some implementation choices have been made for computational efficiency, and not user convenience.

property origin

The origin of this DTED, of the form [longitude, latitude].

Type:

numpy.ndarray

property bounding_box

The bounding box of the form [longitude min, longitude max, latitude min, latitude max].

Type:

numpy.ndarray

in_bounds(lat, lon)

Determine which of the given points are inside the extent of this DTED.

Parameters:
  • lat (numpy.ndarray) –

  • lon (numpy.ndarray) –

Returns:

boolean array of the same shape as lat/lon

Return type:

numpy.ndarray

get_elevation(lat, lon, block_size=50000)

Interpolate the elevation values for lat/lon. This is relative to the EGM96 geoid by DTED specification.

Parameters:
  • lat (numpy.ndarray) –

  • lon (numpy.ndarray) –

  • 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.

Returns:

Elevation values of the same shape as lat/lon.

Return type:

numpy.ndarray

get_max(lat_lon_box=None)

Gets the maximum observed DEM value, possibly contained in the given rectangular area of interest.

Parameters:

lat_lon_box (None|numpy.ndarray) – None or of the form [lat min, lat max, lon min, lon max].

Return type:

float|None

get_min(lat_lon_box=None)

Gets the minimum observed DEM value, possibly contained in the given rectangular area of interest.

Parameters:

lat_lon_box (None|numpy.ndarray) – None or of the form [lat min, lat max, lon min, lon max].

Return type:

float|None

class sarpy.io.DEM.DTED.DTEDInterpolator(files, geoid_file, lat_lon_box=None)

Bases: DEMInterpolator

DEM Interpolator using DTED/SRTM files for the DEM information.

classmethod from_coords_and_list(lat_lon_box, dted_list, dem_type=None, geoid_file=None)

Construct a DTEDInterpolator from a coordinate collection and DTEDList object.

Note

This depends on using DTEDList.get_file_list() to get the relevant file list.

Parameters:
  • lat_lon_box (numpy.ndarray|list|tuple) – Of the form [lat min, lat max, lon min, lon max].

  • dted_list (DTEDList|str) – The dted list object or root directory

  • dem_type (None|str|List[str]) – The DEM type or list of DEM types in order of priority.

  • geoid_file (None|str|GeoidHeight) – The GeoidHeight object, an egm file name, or root directory containing one of the egm files in the sub-directory “geoid”. If None, then default to the root directory of dted_list.

Return type:

DTEDInterpolator

classmethod from_reference_point(ref_point, dted_list, dem_type=None, geoid_file=None, pad_value=0.1)

Construct a DTEDInterpolator object by padding around the reference point by pad_value latitude degrees (1 degree ~ 111 km or 69 miles).

Note

The degeneracy at the poles is not handled, because DTED are not defined there anyways.

Parameters:
  • ref_point (numpy.ndarray|list|tuple) – This is assumed to be of the form [lat, lon, …], and entries beyond the first two are ignored.

  • dted_list (DTEDList|str) – The dted list object or root directory

  • dem_type (None|str|List[str]) – The DEM type or list of DEM types in order of priority.

  • geoid_file (None|str|GeoidHeight) – The GeoidHeight object, an egm file name, or root directory containing one of the egm files in the sub-directory “geoid”. If None, then default to the root directory of dted_list.

  • pad_value (float) – The degree value to pad by.

Return type:

DTEDInterpolator

property geoid: GeoidHeight

Get the geoid height calculator

Type:

GeoidHeight

get_elevation_hae(lat, lon, block_size=50000)

Get the elevation value relative to the WGS-84 ellipsoid.

Note

DTED elevation is relative to the egm96 geoid, and we are simply adding values determined by a geoid calculator. Using a the egm2008 model will result in only minor differences.

Parameters:
  • lat (numpy.ndarray|list|tuple|int|float) –

  • lon (numpy.ndarray|list|tuple|int|float) –

  • 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. A minimum value of 50000 will be enforced here.

Returns:

The elevation relative to the WGS-84 ellipsoid.

Return type:

numpy.ndarray

get_elevation_geoid(lat, lon, block_size=50000)

Get the elevation value relative to the geoid.

Note

DTED elevation is relative to the egm96 geoid, though using the egm2008 model will result in only minor differences.

Parameters:
  • lat (numpy.ndarray|list|tuple|int|float) –

  • lon (numpy.ndarray|list|tuple|int|float) –

  • 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 50000, and any smaller value will be replaced with 50000. Default is 50000.

Returns:

the elevation relative to the geoid

Return type:

numpy.ndarray

get_max_hae(lat_lon_box=None)

Get the maximum dem value with respect to HAE, which should be assumed approximately correct. This may possibly be with respect to some Area of Interest.

Parameters:

lat_lon_box (None|numpy.ndarray) – None or any area of interest of the form [lat min lat max, lon min, lon max].

Return type:

float

get_min_hae(lat_lon_box=None)

Get the minimum dem value with respect to HAE, which should be assumed approximately correct. This may possibly be with respect to some Area of Interest.

Parameters:

lat_lon_box (None|numpy.ndarray) – None or any area of interest of the form [lat min lat max, lon min, lon max].

Return type:

float

get_max_geoid(lat_lon_box=None)

Get the maximum dem value with respect to the geoid, which should be assumed approximately correct. This may possibly be with respect to some Area of Interest.

Parameters:

lat_lon_box (None|numpy.ndarray) – None or any area of interest of the form [lat min lat max, lon min, lon max].

Return type:

float

get_min_geoid(lat_lon_box=None)

Get the minimum dem value with respect to geoid, whihc should be assumed approximately correct. This may possibly be with respect to some Area of Interest.

Parameters:

lat_lon_box (None|numpy.ndarray) – None or any area of interest of the form [lat min lat max, lon min, lon max].

Return type:

float