pycontrails.datalib.leo_utils.landsat_metadata¶
Download and parse Landsat metadata from USGS.
This modules requires GeoPandas.
Functions
|
Return the detector time delay at the given (x, y) coordinates. |
|
Download and parse the Landsat metadata CSV file from USGS. |
|
Find the EPHEMERIS group in a ANG text file and extract the data arrays. |
- pycontrails.datalib.leo_utils.landsat_metadata.get_time_delay_detector(ds, ephemeris, utm_crs, x, y)¶
Return the detector time delay at the given (x, y) coordinates.
- Parameters:
ds (
xarray.Dataset
) – The Landsat dataset containing the VAA variable.ephemeris (
pandas.DataFrame
) – The ephemeris DataFrame containing the EPHEMERIS_TIME and ECEF coordinates.utm_crs (
pyproj.CRS
) – The UTM coordinate reference system for the Landsat scene.x (
npt.NDArray[np.floating]
) – The x-coordinates of the pixels in the dataset’s coordinate system.y (
npt.NDArray[np.floating]
) – The y-coordinates of the pixels in the dataset’s coordinate system.
- Returns:
npt.NDArray[np.timedelta64]
– The time delay for each (x, y) coordinate as a timedelta64 array.
- pycontrails.datalib.leo_utils.landsat_metadata.open_landsat_metadata(cachestore=None, update_cache=False)¶
Download and parse the Landsat metadata CSV file from USGS.
By default, the metadata is cached in a disk cache store.
- Parameters:
cachestore (
cache.CacheStore | None
, optional) – Cache store for Landsat metadata. Defaults tocache.DiskCacheStore
.update_cache (
bool
, optional) – Force update to cached Landsat metadata. The remote file is updated daily, so this is useful to ensure you have the latest metadata.
- Returns:
gpd.GeoDataFrame
– Processed Landsat metadata. Thegeometry
column contains polygons representing the footprints of the Landsat scenes.
- pycontrails.datalib.leo_utils.landsat_metadata.parse_ephemeris_landsat(ang_content)¶
Find the EPHEMERIS group in a ANG text file and extract the data arrays.
- Parameters:
ang_content (
str
) – The content of the ANG file as a string.- Returns:
pandas.DataFrame
– Apandas.DataFrame
containing the ephemeris track with columns: - EPHEMERIS_TIME: Timestamps of the ephemeris data. - EPHEMERIS_ECEF_X: ECEF X coordinates. - EPHEMERIS_ECEF_Y: ECEF Y coordinates. - EPHEMERIS_ECEF_Z: ECEF Z coordinates.