geoutils.satimg

geoutils.satimg provides a toolset for working with satellite data.

Functions

latlon_to_sw_naming

geoutils.satimg.latlon_to_sw_naming(latlon, latlon_sizes=((1.0, 1.0),), lat_lims=((0.0, 90.1),))[source]

Convert latitude and longitude to widely used southwestern corner tile naming (originally for SRTMGL1) Can account for varying tile sizes, and a dependency with the latitude (e.g., TDX global DEM)

Parameters
  • latlon – latitude and longitude

  • latlon_sizes – sizes of lat/lon tiles corresponding to latitude intervals

  • lat_lims – latitude intervals

Returns

tile name

parse_landsat

geoutils.satimg.parse_landsat(gname)[source]

parse_metadata_from_fn

geoutils.satimg.parse_metadata_from_fn(fname)[source]

parse_tile_attr_from_name

geoutils.satimg.parse_tile_attr_from_name(tile_name, product=None)[source]

Convert tile naming to metadata coordinates based on sensor and product by default the SRTMGL1 1x1° tile naming convention to lat, lon (originally SRTMGL1)

Parameters
  • tile_name – tile name

  • product – satellite product

Returns

lat, lon of southwestern corner

sw_naming_to_latlon

geoutils.satimg.sw_naming_to_latlon(tile_name)[source]

Get latitude and longitude corresponding to southwestern corner of tile naming (originally SRTMGL1 convention)

Parsing is robust to lower/upper letters to formats with 2 or 3 digits for latitude (NXXWYYY for most existing products, but for example it is NXXXWYYY for ALOS) and to reverted formats (WXXXNYY).

Parameters

tile_name – name of tile

Returns

latitude and longitude of southwestern corner

Classes

SatelliteImage

class geoutils.satimg.SatelliteImage(filename_or_dataset, attrs=None, load_data=True, bands=None, as_memfile=False, read_from_fn=True, datetime=None, tile_name=None, satellite=None, sensor=None, product=None, version=None, read_from_meta=True, fn_meta=None, silent=True)[source]

Bases: geoutils.georaster.raster.Raster

__init__(filename_or_dataset, attrs=None, load_data=True, bands=None, as_memfile=False, read_from_fn=True, datetime=None, tile_name=None, satellite=None, sensor=None, product=None, version=None, read_from_meta=True, fn_meta=None, silent=True)[source]

Load satellite data through the Raster class and parse additional attributes from filename or metadata.

Parameters
  • filename_or_dataset – The filename of the dataset.

  • attrs – Additional attributes from rasterio’s DataReader class to add to the Raster object. Default list is [‘bounds’, ‘count’, ‘crs’, ‘dataset_mask’, ‘driver’, ‘dtypes’, ‘height’, ‘indexes’, ‘name’, ‘nodata’, ‘res’, ‘shape’, ‘transform’, ‘width’] - if no attrs are specified, these will be added.

  • load_data – Load the raster data into the object. Default is True.

  • bands – The band(s) to load into the object. Default is to load all bands.

  • as_memfile – open the dataset via a rio.MemoryFile.

  • read_from_fn – Try to read metadata from the filename

  • datetime – Provide datetime attribute

  • tile_name – Provide tile name

  • satellite – Provide satellite name

  • sensor – Provide sensor name

  • product – Provide data product name

  • version – Provide data version

  • read_from_meta – Try to read metadata from known associated metadata files

  • fn_meta – Provide filename of associated metadata

  • silent – No informative output when trying to read metadata

Returns

A SatelliteImage object (Raster subclass)

copy(new_array=None)[source]

Copy the Raster object in memory

Parameters

new_array – New array to use for the copied Raster

Returns