Note
Go to the end to download the full example code.
Parsing sensor metadata#
This example demonstrates the instantiation of a raster while parsing image sensor metadata.
import geoutils as gu
We print the filename of our raster that, as often with satellite data, holds metadata information.
filename_geoimg = gu.examples.get_path("everest_landsat_b4")
import os
print(os.path.basename(filename_geoimg))
LE71400412000304SGS00_B4.tif
We open it as a raster with the option to parse metadata, un-silencing the attribute retrieval to see it printed.
img = gu.Raster(filename_geoimg, parse_sensor_metadata=True, silent=False)
Setting platform as Landsat 7 read from filename.
Setting sensor as ETM+ read from filename.
Setting tile_name as 140041 read from filename.
Setting datetime as 2000-10-30 00:00:00 read from filename.
We have now retrieved the metadata, stored in the geoutils.Raster.tags attribute.
{'AREA_OR_POINT': 'Point', 'COMPRESSION': 'LZW', 'INTERLEAVE': 'BAND', 'platform': 'Landsat 7', 'sensor': 'ETM+', 'product': None, 'version': None, 'tile_name': '140041', 'datetime': datetime.datetime(2000, 10, 30, 0, 0)}
Total running time of the script: (0 minutes 0.002 seconds)