1st Stage
- class rsdtlib.Retrieve(starttime, endtime, aoi, shconfig)
Class for downloading observations from Sentinel Hub (https://www.sentinel-hub.com/).
- Parameters:
starttime (datetime.datetime) – Starting time of the time series to retrieve
endtime (datetime.datetime) – End time of the time series to retrieve
aoi (str) – Area of Interest (path to shape file)
Example:
Define a download of observations in the time frame 01-01-2017 to 01-07-2017 from Sentinel Hub for the Area of Interest (AoI) defined in the shape file
ostrava.shp. An account on Sentinel Hub is required for which theshconfigprovides the access credentials.import rsdtlib from dateutil.parser import isoparse from sentinelhub import SHConfig # Credentials to access Sentinel Hub. See instructions: # https://github.com/sentinel-hub/eo-learn/blob/master/examples/README.md shconfig = SHConfig() shconfig.instance_id = "<YOUR INSTANCE ID>" shconfig.sh_client_id = "<YOUR CLIENT ID>" shconfig.sh_client_secret = "<YOUR CLIENT SECRET>" # Just a small area in Ostrava/CZ my_aoi = "./ostrava.shp" retrieve = rsdtlib.Retrieve( starttime=isoparse("20170101T000000"), endtime=isoparse("20170701T000000"), aoi=my_aoi, shconfig=shconfig)
- get_images(datacollection, dst_path, maxcc=1.0)
Download the observations for the specified remote sensing type
datacollectionand maximum cloud coveragemaxcc(if applicable). The observations are stored on the filesystem atdst_path.- Parameters:
datacollection (sentinelhub.DataCollection) – Data collection to download
dst_path (str) – Path on filesystem to store observations at
maxcc (float) – Maximum cloud coverage (default =
1.0)
- Returns:
Number of retrieved observations
- Return type:
int
Example:
Start the download of the AoI and time frame specified in the object retrieve. Sentinel Hub’s data collection
SENTINEL1_IW_ASCis specified to retrieve Sentinel 1 observations in ascending orbit direction. The retrieved observations are stored in pathdst_s1_asc.from sentinelhub import DataCollection dst_s1_asc = "<PATH FOR OBSERVATIONS>" num_down = retrieve.get_images( datacollection=DataCollection.SENTINEL1_IW_ASC, dst_path=dst_s1_asc)
- class rsdtlib.Convert(dst_path, aoi, normalize=255.0)
Class for converting GeoTIFF files to EOPatches.
- Parameters:
dst_path (str) – Path on filesystem to store the converted observations at
aoi (str) – Area of Interest (path to shape file)
normalize (float) – Divisor to use for normalization (e.g., 255.0 for 8 bit unsigned integer types)
Example:
Define a conversion of observations for the Area of Interest (AoI) defined in the shape file
ostrava.shp. The converted observations are stored in in pathdst_path.import rsdtlib dst_path = "<PATH FOR OBSERVATIONS>" # Just a small area in Ostrava/CZ my_aoi = "./ostrava.shp" convert = rsdtlib.Convert( dst_path=dst_path, aoi=my_aoi)
- process(root_path, bands_tiff, mask_tiff, timestamp)
Start the conversion process. Merge the GeoTIFF with the bands
bands_tiffand the GeoTIFF containing a maskmask_tifffrom the same directoryroot_path. Annotate the result with a timestamptimestmapand store it as a single EOPatch.- Parameters:
root_path (str) – Root directory of all GeoTIFF files
bands_tiff (str) – Filename of the GeoTIFF containing the bands
mask_tiff (str) – Filename of the GeoTIFF containing the mask
timestamp (datetime.datetime) – Timestamp of the converted observation
- Returns:
EOPatch object
- Return type:
eolearn.core.EOPatch
Example:
Convert observations as specified in the object
convert. This is called for every single observation provided as two GeoTIFF files from theroot_path. One contains the contents (bands_tiff) and one the data mask (mask_tiff). A timestamp is assigned viatimestamp.root_path = "<ROOT OF GEOTIFFS>" sample = convert.process( root_path=root_path bands_tiff="19931010T090051.TIF", # LS5 TM 7 bands mask_tiff="19931010T090051_QA.TIF", # LS5 TM QA band timestamp="19931010T090051")