xlandsat.load_panchromatic

xlandsat.load_panchromatic#

xlandsat.load_panchromatic(path, region=None, dtype='float32')[source]#

Load the panchromatic band from a USGS EarthExplorer Level 1 Landsat scene.

Can read from a folder with the *.TIF file and an *_MTL.txt file or directly from a tar archive (compressed or not) without the need to first unpack the archive. The band is converted to reflectance units using appropriate scaling parameters and UTM coordinates are set in the returned xarray.DataArray.

Important

Do not rename the TIF or MTL files. The folder/archive can have any name but TIF and MTL files need their original names.

Note

Only supports Landsat 8 and 9 Collection 2 Level 1 scenes containing the panchromatic band.

Parameters:
  • path (str or pathlib.Path) – The path to a folder or tar archive containing the TIF file for the panchromatic band. Must include the *_MTL.txt metadata file. Other band files may be present but will be ignored.

  • region (None or list) – Crop the band to this bounding box given as a list of West, East, South, and North coordinate values (UTM in meters). If None, no cropping is performed on the band. Default is None.

  • dtype (str or numpy dtype object) – The type used for the band array. Integer types will result in rounding so floating point is recommended. Default is float16.

Returns:

panchromatic (xarray.DataArray) – The loaded band including UTM easting and northing as dimensional coordinates and metadata read from the MTL file and other CF compliant fields in the attrs attribute.