- xlandsat.save_scene(path, scene)#
Save a Landsat scene to a tar archive in the USGS EarthExplorer format.
Requires the scene to be in the format returned by
load_scene, including all of the original metadata.
The tar archive will contain the bands saved as
*.TIFfiles in unscaled 16-bit unsigned-integers. The metadata is saved to a corresponding
*_MTL.txtfile. If the scene was cropped, the file metadata will be adjusted to reflect the new UTM bounding box. The lat/lon bounding box will not be updated.
Do not use this function as a general output format for the scene unless you require compatibility with EarthExplorer. The best way to save a scene is with
xarray.Dataset.to_netcdfsince it will result in a single file with all metadata preserved. To load the saved scene, use
xarray.load_dataset. NetCDF files can also be loaded lazily with
xarray.open_datasetto avoid loading the entire scene into memory.
Only supports Landsat 8 and 9 Collection 2 Level 2 scenes.
path (str or
pathlib.Path) – The desired path of the output tar archive. The file extension can be
.tar.bz2to make a compressed archive.
xarray.Dataset) – The scene including UTM easting and northing as dimensional coordinates, bands as 2D arrays of the given type as variables, and metadata read from the MTL file and other CF compliant fields in the