From 8158d18bd74745c2ed423c43c73583770e10c245 Mon Sep 17 00:00:00 2001 From: Remi Cresson <remi.cresson@irstea.fr> Date: Fri, 15 Apr 2022 11:20:25 +0200 Subject: [PATCH] DOC: fix docstring --- scenes/dates.py | 3 ++- scenes/download.py | 21 ++++++++++++++------- scenes/raster.py | 3 ++- scenes/sentinel.py | 27 ++++++++++++++++++--------- scenes/spot.py | 2 +- 5 files changed, 37 insertions(+), 19 deletions(-) diff --git a/scenes/dates.py b/scenes/dates.py index 7cbe206..22cdf07 100644 --- a/scenes/dates.py +++ b/scenes/dates.py @@ -10,7 +10,8 @@ MAXDATE = datetime.datetime.strptime("3000-01-01", "%Y-%m-%d") def get_timestamp(dt): - """Converts datetime.datetime into a timestamp (in seconds) + """ + Converts datetime.datetime into a timestamp (in seconds) Args: dt: datetime.datetime instance diff --git a/scenes/download.py b/scenes/download.py index 2b9aaaf..1b8f688 100644 --- a/scenes/download.py +++ b/scenes/download.py @@ -14,7 +14,8 @@ from scenes import dates def compute_md5(fname): - """Compute md5sum of a file + """ + Compute md5sum of a file Args: fname: file name @@ -28,7 +29,8 @@ def compute_md5(fname): def is_file_complete(filename, md5sum): - """Tell if a file is complete + """ + Tell if a file is complete Args: filename: path of the file @@ -44,7 +46,8 @@ def is_file_complete(filename, md5sum): def curl_url(url, postdata, verbose=False, out_file=None, header=None): - """Use PyCurl to make some requests + """ + Use PyCurl to make some requests Args: url: url @@ -174,7 +177,8 @@ class TheiaDownloader: return token def _query(self, dict_query): - """Search products + """ + Search products Return a dict with the following structure TILE_NAME @@ -214,7 +218,8 @@ class TheiaDownloader: return tiles_dict def _download_tiles_and_dates(self, tiles_dict, download_dir): - """Download a product. + """ + Download a product. Updates the "tiles_dict" with the filename of the downloaded files @@ -255,7 +260,8 @@ class TheiaDownloader: return tiles_dict def download_in_range(self, bbox_wgs84, dates_range, download_dir=None, level="LEVEL3A"): - """Download all images within spatial and temporal ranges + """ + Download all images within spatial and temporal ranges Args: bbox_wgs84: bounding box (WGS84) @@ -287,7 +293,8 @@ class TheiaDownloader: return search_results def download_closest(self, bbox_wgs84, acq_date, download_dir=None, level="LEVEL3A"): - """Query Theia catalog, download_closest the files + """ + Query Theia catalog, download_closest the files Args: bbox_wgs84: bounding box (WGS84) diff --git a/scenes/raster.py b/scenes/raster.py index ba00ac0..0c4c168 100644 --- a/scenes/raster.py +++ b/scenes/raster.py @@ -62,7 +62,8 @@ def get_extent_wgs84(gdal_ds): def get_epsg_extent_bbox(filename): - """Returns (epsg, extent_wgs84) from a raster file that GDAL can open. + """ + Returns (epsg, extent_wgs84) from a raster file that GDAL can open. Args: filename: file name diff --git a/scenes/sentinel.py b/scenes/sentinel.py index 051f755..342b0ad 100644 --- a/scenes/sentinel.py +++ b/scenes/sentinel.py @@ -55,7 +55,8 @@ class Sentinel23ASource(Sentinel2Source): """Sentinel-2 level 3A source class""" def flg_msk_drilled(self, keep_flags_values=(3, 4), nodata=-10000): - """Return the source drilled from the FLG mask + """ + Return the source drilled from the FLG mask Args: keep_flags_values: flags values to keep (Default value = (3, 4)). Can be: @@ -168,7 +169,8 @@ class Sentinel2SceneBase(Scene): super().__init__(acquisition_date=acquisition_date, bbox_wgs84=bbox_wgs84, epsg=epsg) def get_file(self, endswith): - """Return the specified file. + """ + Return the specified file. Args: endswith: filtered extension @@ -188,7 +190,8 @@ class Sentinel2SceneBase(Scene): return filtered_files_list[0] def get_band(self, suffix1, suffix2): - """Return the file path for the specified band. + """ + Return the file path for the specified band. Args: suffix1: suffix 1, e.g. "FRE" @@ -204,7 +207,8 @@ class Sentinel2SceneBase(Scene): return self.get_file(endswith="_{}_{}.tif".format(suffix1, suffix2)) def get_metadata(self): - """Get metadata + """ + Get metadata Returns: metadata: dict @@ -228,7 +232,8 @@ class Sentinel2SceneBase(Scene): class Sentinel22AScene(Sentinel2SceneBase): - """Sentinel-2 level 2A scene class. + """ + Sentinel-2 level 2A scene class. The class carries all the metadata from the root_scene, and can be used to retrieve its imagery. @@ -249,7 +254,8 @@ class Sentinel22AScene(Sentinel2SceneBase): self.edg_r2_msk_file = self.get_file("_EDG_R2.tif") def get_imagery(self): # pylint: disable=arguments-differ - """ Get imagery + """ + Get imagery Returns: Imagery instance @@ -258,7 +264,8 @@ class Sentinel22AScene(Sentinel2SceneBase): return Sentinel22AImagery(self) def get_metadata(self): - """ Get metadatas + """ + Get metadata Returns: metadata: dict @@ -293,7 +300,8 @@ class Sentinel23AScene(Sentinel2SceneBase): self.flg_r2_msk_file = self.get_file("_FLG_R2.tif") def get_imagery(self): # pylint: disable=arguments-differ - """ Get imagery + """ + Get imagery Returns: Imagery instance @@ -302,7 +310,8 @@ class Sentinel23AScene(Sentinel2SceneBase): return Sentinel23AImagery(self) def get_metadata(self): - """ Get metadatas + """ + Get metadata Returns: metadata: dict diff --git a/scenes/spot.py b/scenes/spot.py index 1369da2..573f2c0 100644 --- a/scenes/spot.py +++ b/scenes/spot.py @@ -300,7 +300,7 @@ class Spot67Scene(Scene): def get_metadata(self): """ - Get metadatas + Get metadata Returns: metadata: dict -- GitLab