From f7393ffa6c5e75c7af6943b4537c94ac8c872648 Mon Sep 17 00:00:00 2001 From: ghiggi Date: Tue, 2 Apr 2024 22:00:50 +0200 Subject: [PATCH] Add pycodestyle rules --- disdrodb/api/checks.py | 4 +-- disdrodb/api/create_directories.py | 1 + disdrodb/api/info.py | 14 ++++----- disdrodb/api/io.py | 12 ++++---- .../scripts/disdrodb_initialize_station.py | 3 +- disdrodb/configs.py | 2 +- disdrodb/data_transfer/download_data.py | 4 +-- .../scripts/disdrodb_download_archive.py | 23 ++++++++++++++ .../scripts/disdrodb_download_station.py | 23 ++++++++++++++ .../scripts/disdrodb_upload_archive.py | 30 +++++++++++++++++++ .../scripts/disdrodb_upload_station.py | 27 +++++++++++++++++ disdrodb/data_transfer/upload_data.py | 2 +- disdrodb/data_transfer/zenodo.py | 2 -- disdrodb/issue/__init__.py | 2 +- disdrodb/issue/checks.py | 2 -- disdrodb/issue/reader.py | 4 ++- disdrodb/issue/writer.py | 2 +- disdrodb/l0/check_configs.py | 13 +++++--- disdrodb/l0/check_standards.py | 2 +- disdrodb/l0/io.py | 1 - disdrodb/l0/l0_processing.py | 1 - disdrodb/l0/l0_reader.py | 7 ++--- disdrodb/l0/l0a_processing.py | 3 -- disdrodb/l0/l0b_processing.py | 8 ++--- disdrodb/l0/readers/ARM/ARM_LD.py | 2 ++ disdrodb/l0/readers/ARM/ARM_LPM.py | 3 ++ .../readers/AUSTRALIA/MELBOURNE_2007_OTT.py | 1 + .../readers/AUSTRALIA/MELBOURNE_2007_THIES.py | 1 + disdrodb/l0/readers/BRAZIL/CHUVA_LPM.py | 1 + disdrodb/l0/readers/BRAZIL/CHUVA_OTT.py | 1 + disdrodb/l0/readers/BRAZIL/CHUVA_RD80.py | 1 + disdrodb/l0/readers/BRAZIL/GOAMAZON_LPM.py | 1 + disdrodb/l0/readers/BRAZIL/GOAMAZON_OTT.py | 1 + disdrodb/l0/readers/BRAZIL/GOAMAZON_RD80.py | 1 + disdrodb/l0/readers/CHINA/CHONGQING.py | 1 + disdrodb/l0/readers/DENMARK/EROSION_nc.py | 2 ++ disdrodb/l0/readers/EPFL/ARCTIC_2021.py | 2 ++ disdrodb/l0/readers/EPFL/COMMON_2011.py | 2 ++ disdrodb/l0/readers/EPFL/DAVOS_2009_2011.py | 2 ++ disdrodb/l0/readers/EPFL/EPFL_2009.py | 2 ++ disdrodb/l0/readers/EPFL/EPFL_ROOF_2008.py | 2 ++ disdrodb/l0/readers/EPFL/EPFL_ROOF_2010.py | 2 ++ disdrodb/l0/readers/EPFL/EPFL_ROOF_2011.py | 2 ++ disdrodb/l0/readers/EPFL/EPFL_ROOF_2012.py | 1 + disdrodb/l0/readers/EPFL/GENEPI_2007.py | 2 ++ .../l0/readers/EPFL/GRAND_ST_BERNARD_2007.py | 2 ++ .../readers/EPFL/GRAND_ST_BERNARD_2007_2.py | 2 ++ disdrodb/l0/readers/EPFL/HPICONET_2010.py | 2 ++ disdrodb/l0/readers/EPFL/HYMEX_LTE_SOP2.py | 3 +- disdrodb/l0/readers/EPFL/HYMEX_LTE_SOP3.py | 1 + disdrodb/l0/readers/EPFL/HYMEX_LTE_SOP4.py | 1 + disdrodb/l0/readers/EPFL/LOCARNO_2018.py | 1 + disdrodb/l0/readers/EPFL/LOCARNO_2019.py | 1 + disdrodb/l0/readers/EPFL/PARADISO_2014.py | 2 ++ disdrodb/l0/readers/EPFL/PARSIVEL_2007.py | 2 ++ disdrodb/l0/readers/EPFL/PLATO_2019.py | 1 + disdrodb/l0/readers/EPFL/RACLETS_2019.py | 2 ++ disdrodb/l0/readers/EPFL/RACLETS_2019_WJF.py | 2 ++ disdrodb/l0/readers/EPFL/RIETHOLZBACH_2011.py | 2 ++ disdrodb/l0/readers/EPFL/SAMOYLOV_2017.py | 2 ++ disdrodb/l0/readers/EPFL/SAMOYLOV_2019.py | 2 ++ disdrodb/l0/readers/EPFL/UNIL_2022.py | 2 ++ disdrodb/l0/readers/FRANCE/SIRTA_OTT2.py | 1 + disdrodb/l0/readers/GPM/GCPEX.py | 1 + disdrodb/l0/readers/GPM/IFLOODS.py | 1 + disdrodb/l0/readers/GPM/LPVEX.py | 1 + disdrodb/l0/readers/GPM/MC3E.py | 1 + disdrodb/l0/readers/GPM/NSSTC.py | 1 + disdrodb/l0/readers/ITALY/GID.py | 1 + disdrodb/l0/readers/MEXICO/OH_IIUNAM_nc.py | 2 ++ disdrodb/l0/readers/NCAR/CCOPE_2015.py | 1 + disdrodb/l0/readers/NCAR/CINDY_2011_RD80.py | 1 + disdrodb/l0/readers/NCAR/OWLES_MIPS.py | 3 +- disdrodb/l0/readers/NCAR/PECAN_FP3.py | 3 +- disdrodb/l0/readers/NCAR/PECAN_MIPS.py | 3 +- disdrodb/l0/readers/NCAR/PECAN_MOBILE.py | 3 +- disdrodb/l0/readers/NCAR/PLOWS_MIPS.py | 1 + disdrodb/l0/readers/NCAR/RELAMPAGO_OTT.py | 3 +- disdrodb/l0/readers/NCAR/RELAMPAGO_RD80.py | 1 + disdrodb/l0/readers/NCAR/SNOWIE_PJ.py | 1 + disdrodb/l0/readers/NCAR/SNOWIE_SB.py | 3 +- disdrodb/l0/readers/NCAR/VORTEX2_2009.py | 1 + disdrodb/l0/readers/NCAR/VORTEX2_2010.py | 3 +- disdrodb/l0/readers/NCAR/VORTEX2_2010_UF.py | 3 +- disdrodb/l0/readers/NCAR/VORTEX_SE_2016_P1.py | 3 +- disdrodb/l0/readers/NCAR/VORTEX_SE_2016_P2.py | 1 + .../l0/readers/NCAR/VORTEX_SE_2016_PIPS.py | 1 + disdrodb/l0/readers/NETHERLANDS/DELFT.py | 1 + disdrodb/l0/readers/SPAIN/SBEGUERIA.py | 1 + disdrodb/l0/readers/UK/DIVEN.py | 2 ++ disdrodb/l0/readers/reader_template.py | 3 +- disdrodb/l0/routines.py | 2 +- disdrodb/l0/scripts/disdrodb_run_l0.py | 2 +- .../l0/scripts/disdrodb_run_l0_station.py | 3 +- disdrodb/l0/scripts/disdrodb_run_l0a.py | 2 +- .../l0/scripts/disdrodb_run_l0a_station.py | 1 + disdrodb/l0/scripts/disdrodb_run_l0b.py | 2 +- .../l0/scripts/disdrodb_run_l0b_concat.py | 5 +--- .../disdrodb_run_l0b_concat_station.py | 2 +- .../l0/scripts/disdrodb_run_l0b_station.py | 2 +- disdrodb/l0/standards.py | 17 ++--------- disdrodb/l0/template_tools.py | 12 +++----- disdrodb/metadata/checks.py | 3 +- .../disdrodb_check_metadata_archive.py | 1 + disdrodb/metadata/search.py | 2 +- disdrodb/tests/__init__.py | 2 +- disdrodb/tests/conftest.py | 1 - disdrodb/tests/test_api/test_api_info.py | 2 +- .../test_data_transfer/test_upload_data.py | 1 - disdrodb/tests/test_l0/test_cmd_processing.py | 1 - disdrodb/tests/test_l0/test_config_files.py | 3 -- .../test_utils/test_utils_compression.py | 2 -- disdrodb/utils/compression.py | 5 ---- disdrodb/utils/directories.py | 2 +- disdrodb/utils/logger.py | 2 +- disdrodb/utils/netcdf.py | 2 -- disdrodb/utils/pandas.py | 1 - disdrodb/utils/scripts.py | 9 ++++++ pyproject.toml | 8 ++++- 119 files changed, 287 insertions(+), 116 deletions(-) diff --git a/disdrodb/api/checks.py b/disdrodb/api/checks.py index b79b38f9..54a97fba 100644 --- a/disdrodb/api/checks.py +++ b/disdrodb/api/checks.py @@ -129,7 +129,7 @@ def check_sensor_name(sensor_name: str, product: str = "L0A") -> None: def check_campaign_name(campaign_name): - """Check the campaign name is upper case !""" + """Check the campaign name is upper case !.""" upper_campaign_name = campaign_name.upper() if campaign_name != upper_campaign_name: msg = f"The campaign directory name {campaign_name} must be defined uppercase: {upper_campaign_name}" @@ -138,7 +138,7 @@ def check_campaign_name(campaign_name): def check_data_source(data_source): - """Check the data_source name is upper case !""" + """Check the data_source name is upper case !.""" upper_data_source = data_source.upper() if data_source != upper_data_source: msg = f"The data source directory name {data_source} must be defined uppercase: {upper_data_source}" diff --git a/disdrodb/api/create_directories.py b/disdrodb/api/create_directories.py index 81a0be76..cf31f1d9 100644 --- a/disdrodb/api/create_directories.py +++ b/disdrodb/api/create_directories.py @@ -376,6 +376,7 @@ def create_station_directory(base_dir, product, data_source, campaign_name, stat def create_issue_directory(base_dir, data_source, campaign_name): + """Create issue directory.""" issue_dir = define_issue_dir( base_dir=base_dir, data_source=data_source, diff --git a/disdrodb/api/info.py b/disdrodb/api/info.py index 9009ac1d..9b015811 100644 --- a/disdrodb/api/info.py +++ b/disdrodb/api/info.py @@ -91,7 +91,7 @@ def _get_version_from_filepath(filepath): def get_version_from_filepaths(filepaths): - """Return the DISDROB product version of the specified files""" + """Return the DISDROB product version of the specified files.""" if isinstance(filepaths, str): filepaths = [filepaths] list_version = [_get_version_from_filepath(filepath) for filepath in filepaths] @@ -99,37 +99,37 @@ def get_version_from_filepaths(filepaths): def get_campaign_name_from_filepaths(filepaths): - """Return the DISDROB campaign name of the specified files""" + """Return the DISDROB campaign name of the specified files.""" list_id = get_key_from_filepaths(filepaths, key="campaign_name") return list_id def get_station_name_from_filepaths(filepaths): - """Return the DISDROB station name of the specified files""" + """Return the DISDROB station name of the specified files.""" list_id = get_key_from_filepaths(filepaths, key="station_name") return list_id def get_product_from_filepaths(filepaths): - """Return the DISDROB product name of the specified files""" + """Return the DISDROB product name of the specified files.""" list_id = get_key_from_filepaths(filepaths, key="product") return list_id def get_start_time_from_filepaths(filepaths): - """Return the start time of the specified files""" + """Return the start time of the specified files.""" list_start_time = get_key_from_filepaths(filepaths, key="start_time") return list_start_time def get_end_time_from_filepaths(filepaths): - """Return the end time of the specified files""" + """Return the end time of the specified files.""" list_end_time = get_key_from_filepaths(filepaths, key="end_time") return list_end_time def get_start_end_time_from_filepaths(filepaths): - """Return the start and end time of the specified files""" + """Return the start and end time of the specified files.""" list_start_time = get_key_from_filepaths(filepaths, key="start_time") list_end_time = get_key_from_filepaths(filepaths, key="end_time") return np.array(list_start_time), np.array(list_end_time) diff --git a/disdrodb/api/io.py b/disdrodb/api/io.py index ff4d575f..dd2e22cc 100644 --- a/disdrodb/api/io.py +++ b/disdrodb/api/io.py @@ -281,7 +281,7 @@ def available_stations( ): """Return stations for which data are available on disk.""" base_dir = get_base_dir(base_dir) - # Checks + # Checks arguments product = check_product(product) data_sources = _check_data_sources( base_dir=base_dir, @@ -293,11 +293,6 @@ def available_stations( product=product, campaign_names=campaign_names, ) - # Format arguments to list - if isinstance(data_sources, str): - data_sources = [data_sources] - if isinstance(campaign_names, str): - campaign_names = [campaign_names] # If data_source is None, first retrieve all stations if data_sources is None: @@ -309,7 +304,6 @@ def available_stations( data_sources=data_sources, product=product, ) - # Then, if campaign_name is not None, subset by campaign_name if campaign_names is not None: list_info = [info for info in list_info if info[1] in campaign_names] @@ -317,6 +311,10 @@ def available_stations( if return_tuple: return list_info + # TODO: + # - Filter by station names ! + # - Add check_station_names + # TODO: ENSURE THAT NO DUPLICATED STATION NAMES ? list_stations = [info[2] for info in list_info] return list_stations diff --git a/disdrodb/api/scripts/disdrodb_initialize_station.py b/disdrodb/api/scripts/disdrodb_initialize_station.py index 2a3c5272..bb36cb80 100644 --- a/disdrodb/api/scripts/disdrodb_initialize_station.py +++ b/disdrodb/api/scripts/disdrodb_initialize_station.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -----------------------------------------------------------------------------. +"""Script to initialize the DISDRODB station directory structure.""" import sys from typing import Optional @@ -38,7 +39,7 @@ def disdrodb_initialize_station( # Processing options base_dir: Optional[str] = None, ): - """Initialize the DISDRODB directory structure for a station. + r"""Initialize the DISDRODB directory structure for a station. It adds the relevant directories and the default issue and metadata YAML files.. diff --git a/disdrodb/configs.py b/disdrodb/configs.py index 47a45113..50802057 100644 --- a/disdrodb/configs.py +++ b/disdrodb/configs.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 """ -Created on Thu Nov 2 15:39:01 2023 +Created on Thu Nov 2 15:39:01 2023. @author: ghiggi """ diff --git a/disdrodb/data_transfer/download_data.py b/disdrodb/data_transfer/download_data.py index e358524a..a5c03f52 100644 --- a/disdrodb/data_transfer/download_data.py +++ b/disdrodb/data_transfer/download_data.py @@ -83,7 +83,6 @@ def click_download_options(function: object): function : object Function. """ - function = click.option( "-f", "--force", @@ -103,8 +102,7 @@ def download_archive( force: bool = False, base_dir: Optional[str] = None, ): - """Get all YAML files that contain the ``disdrodb_data_url`` key - and download the data locally. + """Download DISDRODB stations with the ``disdrodb_data_url`` in the metadata. Parameters ---------- diff --git a/disdrodb/data_transfer/scripts/disdrodb_download_archive.py b/disdrodb/data_transfer/scripts/disdrodb_download_archive.py index 91a5c391..04b8d67f 100644 --- a/disdrodb/data_transfer/scripts/disdrodb_download_archive.py +++ b/disdrodb/data_transfer/scripts/disdrodb_download_archive.py @@ -38,6 +38,29 @@ def disdrodb_download_archive( base_dir: Optional[str] = None, force: bool = False, ): + """Download DISDRODB stations with the ``disdrodb_data_url`` in the metadata. + + Parameters + ---------- + data_sources : str or list of str, optional + Data source name (eg : EPFL). + If not provided (``None``), all data sources will be downloaded. + The default is ``data_source=None``. + campaign_names : str or list of str, optional + Campaign name (eg : EPFL_ROOF_2012). + If not provided (``None``), all campaigns will be downloaded. + The default is ``campaign_name=None``. + station_names : str or list of str, optional + Station name. + If not provided (``None``), all stations will be downloaded. + The default is ``station_name=None``. + force : bool, optional + If ``True``, overwrite the already existing raw data file. + The default is ``False``. + base_dir : str (optional) + Base directory of DISDRODB. Format: ``<...>/DISDRODB``. + If ``None`` (the default), the disdrodb config variable ``base_dir`` is used. + """ from disdrodb.data_transfer.download_data import download_archive base_dir = parse_base_dir(base_dir) diff --git a/disdrodb/data_transfer/scripts/disdrodb_download_station.py b/disdrodb/data_transfer/scripts/disdrodb_download_station.py index 561527b0..c13b7e35 100644 --- a/disdrodb/data_transfer/scripts/disdrodb_download_station.py +++ b/disdrodb/data_transfer/scripts/disdrodb_download_station.py @@ -40,6 +40,29 @@ def disdrodb_download_station( base_dir: Optional[str] = None, force: bool = False, ): + """ + Download data of a single DISDRODB station from the DISDRODB remote repository. + + Parameters + ---------- + data_source : str + The name of the institution (for campaigns spanning multiple countries) or + the name of the country (for campaigns or sensor networks within a single country). + Must be provided in UPPER CASE. + campaign_name : str + The name of the campaign. Must be provided in UPPER CASE. + station_name : str + The name of the station. + base_dir : str, optional + The base directory of DISDRODB, expected in the format ``<...>/DISDRODB``. + If not specified, the path specified in the DISDRODB active configuration will be used. + force: bool, optional + If ``True``, overwrite the already existing raw data file. + The default is ``False``. + base_dir : str (optional) + Base directory of DISDRODB. Format: ``<...>/DISDRODB``. + If ``None`` (the default), the disdrodb config variable ``base_dir`` is used. + """ from disdrodb.data_transfer.download_data import download_station base_dir = parse_base_dir(base_dir) diff --git a/disdrodb/data_transfer/scripts/disdrodb_upload_archive.py b/disdrodb/data_transfer/scripts/disdrodb_upload_archive.py index ea6236af..0107169d 100644 --- a/disdrodb/data_transfer/scripts/disdrodb_upload_archive.py +++ b/disdrodb/data_transfer/scripts/disdrodb_upload_archive.py @@ -41,6 +41,36 @@ def disdrodb_upload_archive( platform: Optional[str] = None, force: bool = False, ): + """Find all stations containing local data and upload them to a remote repository. + + Parameters + ---------- + platform: str, optional + Name of the remote platform. + The default platform is ``"sandbox.zenodo"`` (for testing purposes). + Switch to ``"zenodo"`` for final data dissemination. + force: bool, optional + If ``True``, upload even if data already exists on another remote location. + The default is ``force=False``. + base_dir : str (optional) + Base directory of DISDRODB. Format: ``<...>/DISDRODB``. + If ``None`` (the default), the ``base_dir`` path specified in the DISDRODB active configuration will be used. + + Other Parameters + ---------------- + data_sources: str or list of str, optional + Data source name (eg: EPFL). + If not provided (``None``), all data sources will be uploaded. + The default is ``data_source=None``. + campaign_names: str or list of str, optional + Campaign name (eg: EPFL_ROOF_2012). + If not provided (``None``), all campaigns will be uploaded. + The default is ``campaign_name=None``. + station_names: str or list of str, optional + Station name. + If not provided (``None``), all stations will be uploaded. + The default is ``station_name=None``. + """ from disdrodb.data_transfer.upload_data import upload_archive base_dir = parse_base_dir(base_dir) diff --git a/disdrodb/data_transfer/scripts/disdrodb_upload_station.py b/disdrodb/data_transfer/scripts/disdrodb_upload_station.py index f1debc3b..754a8f7e 100644 --- a/disdrodb/data_transfer/scripts/disdrodb_upload_station.py +++ b/disdrodb/data_transfer/scripts/disdrodb_upload_station.py @@ -41,6 +41,33 @@ def disdrodb_upload_station( base_dir: Optional[str] = None, force: bool = False, ): + """ + Upload data from a single DISDRODB station on a remote repository. + + This function also automatically update the disdrodb_data url in the metadata file. + + Parameters + ---------- + data_source : str + The name of the institution (for campaigns spanning multiple countries) or + the name of the country (for campaigns or sensor networks within a single country). + Must be provided in UPPER CASE. + campaign_name : str + The name of the campaign. Must be provided in UPPER CASE. + station_name : str + The name of the station. + base_dir : str, optional + The base directory of DISDRODB, expected in the format ``<...>/DISDRODB``. + If ``None`` (the default), the ``base_dir`` path specified in the DISDRODB active configuration will be used. + platform: str, optional + Name of the remote data storage platform. + The default platform is ``"sandbox.zenodo"`` (for testing purposes). + Switch to ``"zenodo"`` for final data dissemination. + force: bool, optional + If ``True``, upload the data and overwrite the ``disdrodb_data_url``. + The default is ``force=False``. + + """ from disdrodb.data_transfer.upload_data import upload_station base_dir = parse_base_dir(base_dir) diff --git a/disdrodb/data_transfer/upload_data.py b/disdrodb/data_transfer/upload_data.py index b07cccb0..7a22000e 100644 --- a/disdrodb/data_transfer/upload_data.py +++ b/disdrodb/data_transfer/upload_data.py @@ -29,6 +29,7 @@ def click_upload_options(function: object): + """Click command arguments for DISDRODB data upload.""" function = click.option( "--platform", type=click.Choice(["zenodo", "sandbox.zenodo"], case_sensitive=False), @@ -199,7 +200,6 @@ def upload_archive( Other Parameters ---------------- - data_sources: str or list of str, optional Data source name (eg: EPFL). If not provided (``None``), all data sources will be uploaded. diff --git a/disdrodb/data_transfer/zenodo.py b/disdrodb/data_transfer/zenodo.py index 05ec073f..5ae806c4 100644 --- a/disdrodb/data_transfer/zenodo.py +++ b/disdrodb/data_transfer/zenodo.py @@ -34,7 +34,6 @@ def _check_http_response( task_description: str, ) -> None: """Check the Zenodo HTTP request response status code and raise an error if not the expected one.""" - if response.status_code == expected_status_code: return @@ -95,7 +94,6 @@ def _define_disdrodb_data_url(zenodo_host, deposit_id, filename): def _upload_file_to_zenodo(filepath: str, metadata_filepath: str, sandbox: bool) -> None: """Upload a file to a Zenodo bucket.""" - # Read metadata metadata = read_yaml(metadata_filepath) data_source = metadata["data_source"] diff --git a/disdrodb/issue/__init__.py b/disdrodb/issue/__init__.py index 84113b02..03420242 100644 --- a/disdrodb/issue/__init__.py +++ b/disdrodb/issue/__init__.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 """ -Created on Sat Nov 11 01:12:40 2023 +Created on Sat Nov 11 01:12:40 2023. @author: ghiggi """ diff --git a/disdrodb/issue/checks.py b/disdrodb/issue/checks.py index a5bc68bf..b28aafc6 100644 --- a/disdrodb/issue/checks.py +++ b/disdrodb/issue/checks.py @@ -35,7 +35,6 @@ def _is_numpy_array_string(arr): arr : numpy array Numpy array to check. """ - dtype = arr.dtype.type return dtype in (np.str_, np.unicode_) @@ -148,7 +147,6 @@ def check_timesteps(timesteps): def _check_time_period_nested_list_format(time_periods): """Check that the time_periods is a list of list of length 2.""" - if not isinstance(time_periods, list): msg = "'time_periods' must be a list'" log_error(logger, msg=msg, verbose=False) diff --git a/disdrodb/issue/reader.py b/disdrodb/issue/reader.py index 009beeff..04b2e111 100644 --- a/disdrodb/issue/reader.py +++ b/disdrodb/issue/reader.py @@ -28,6 +28,8 @@ class NoDatesSafeLoader(yaml.SafeLoader): + """A YAML loader that does not parse dates.""" + @classmethod def remove_implicit_resolver(cls, tag_to_remove): """ @@ -47,7 +49,7 @@ def remove_implicit_resolver(cls, tag_to_remove): def _load_yaml_without_date_parsing(filepath): - "Read a YAML file without converting automatically date string to datetime." + """Read a YAML file without converting automatically date string to datetime.""" NoDatesSafeLoader.remove_implicit_resolver("tag:yaml.org,2002:timestamp") with open(filepath) as f: dictionary = yaml.load(f, Loader=NoDatesSafeLoader) diff --git a/disdrodb/issue/writer.py b/disdrodb/issue/writer.py index e3533181..eabfff38 100644 --- a/disdrodb/issue/writer.py +++ b/disdrodb/issue/writer.py @@ -30,7 +30,7 @@ def _write_issue_docs(f): - """Provide template for issue.yml""" + """Provide template for issue.yml.""" f.write("""# This file is used to store timesteps/time periods with wrong/corrupted observation. # The specified timesteps are dropped during the L0 processing. # The time format used is the isoformat : YYYY-mm-dd HH:MM:SS. diff --git a/disdrodb/l0/check_configs.py b/disdrodb/l0/check_configs.py index 89b0b0f6..1f577a27 100644 --- a/disdrodb/l0/check_configs.py +++ b/disdrodb/l0/check_configs.py @@ -119,7 +119,6 @@ def _schema_error(object_to_validate: Union[str, list], schema: BaseModel, messa Base model. """ - try: schema(**object_to_validate) except ValidationError as e: @@ -127,6 +126,8 @@ def _schema_error(object_to_validate: Union[str, list], schema: BaseModel, messa class L0BEncodingSchema(BaseModel): + """Pydantic model for DISDRODB L0B encodings.""" + contiguous: bool dtype: str zlib: bool @@ -139,6 +140,7 @@ class L0BEncodingSchema(BaseModel): # if contiguous=False, chunksizes specified, otherwise should be not ! @model_validator(mode="before") def check_chunksizes_and_zlib(cls, values): + """Check the chunksizes validity.""" contiguous = values.get("contiguous") chunksizes = values.get("chunksizes") if not contiguous and not chunksizes: @@ -148,6 +150,7 @@ def check_chunksizes_and_zlib(cls, values): # if contiguous = True, then zlib must be set to False @model_validator(mode="before") def check_contiguous_and_zlib(cls, values): + """Check the the compression value validity.""" contiguous = values.get("contiguous") zlib = values.get("zlib") if contiguous and zlib: @@ -157,6 +160,7 @@ def check_contiguous_and_zlib(cls, values): # if contiguous = True, then fletcher32 must be set to False @model_validator(mode="before") def check_contiguous_and_fletcher32(cls, values): + """Check the fletcher value validity.""" contiguous = values.get("contiguous") fletcher32 = values.get("fletcher32") if contiguous and fletcher32: @@ -172,7 +176,6 @@ def check_l0b_encoding(sensor_name: str) -> None: sensor_name : str Name of the sensor. """ - data = read_config_file(sensor_name, product="L0A", filename="l0b_encodings.yml") # check that the second level of the dictionary match the schema @@ -208,6 +211,8 @@ def check_l0a_encoding(sensor_name: str) -> None: class RawDataFormatSchema(BaseModel): + """Pydantic model for the DISDRODB Raw Data Format YAML files.""" + n_digits: Optional[int] n_characters: Optional[int] n_decimals: Optional[int] @@ -221,6 +226,7 @@ class RawDataFormatSchema(BaseModel): @field_validator("data_range") def check_list_length(cls, value): + """Check the data_range validity.""" if value: if len(value) != 2: raise ValueError(f"data_range must have exactly 2 keys, {len(value)} element have been provided.") @@ -229,7 +235,7 @@ def check_list_length(cls, value): def _check_raw_data_format(sensor_name: str) -> None: - """check ``raw_data_format.yml`` file based on the schema defined in the class ``RawDataFormatSchema``. + """Check ``raw_data_format.yml`` file based on the schema defined in the class ``RawDataFormatSchema``. Parameters ---------- @@ -272,7 +278,6 @@ def _check_bin_consistency(sensor_name: str) -> None: sensor_name : str Name of the sensor. """ - diameter_bin_lower = np.array(get_diameter_bin_lower(sensor_name)) diameter_bin_upper = np.array(get_diameter_bin_upper(sensor_name)) diameter_bin_center = np.array(get_diameter_bin_center(sensor_name)) diff --git a/disdrodb/l0/check_standards.py b/disdrodb/l0/check_standards.py index 7ff03503..bd2c4307 100644 --- a/disdrodb/l0/check_standards.py +++ b/disdrodb/l0/check_standards.py @@ -136,7 +136,6 @@ def check_l0a_column_names(df: pd.DataFrame, sensor_name: str) -> None: column is missing in the dataframe. """ - # Get valid columns dtype_dict = get_l0a_dtype(sensor_name) valid_columns = list(dtype_dict) @@ -217,6 +216,7 @@ def check_l0a_standards(df: pd.DataFrame, sensor_name: str, verbose: bool = True def check_l0b_standards(x: str) -> None: + """Check L0B standards.""" # - Check for realistic values after having removed the flags !!!! x = "noqa" # noqa F841 pass diff --git a/disdrodb/l0/io.py b/disdrodb/l0/io.py index ec76ec92..d3a5f141 100644 --- a/disdrodb/l0/io.py +++ b/disdrodb/l0/io.py @@ -231,7 +231,6 @@ def read_l0a_dataframe( L0A Dataframe. """ - from disdrodb.l0.l0a_processing import concatenate_dataframe # ---------------------------------------- diff --git a/disdrodb/l0/l0_processing.py b/disdrodb/l0/l0_processing.py index 63823195..44b5d866 100644 --- a/disdrodb/l0/l0_processing.py +++ b/disdrodb/l0/l0_processing.py @@ -709,7 +709,6 @@ def run_l0b_from_nc( Default is ``False``. """ - # ------------------------------------------------------------------------. # Start L0A processing if verbose: diff --git a/disdrodb/l0/l0_reader.py b/disdrodb/l0/l0_reader.py index 806100e5..7cfbc834 100644 --- a/disdrodb/l0/l0_reader.py +++ b/disdrodb/l0/l0_reader.py @@ -36,7 +36,7 @@ def _get_readers_directory() -> str: def _get_readers_data_sources() -> list: - """Returns the readers data sources available at ``disdrodb.l0.readers``""" + """Returns the readers data sources available at ``disdrodb.l0.readers``.""" # Readers directory path reader_dir = _get_readers_directory() @@ -50,7 +50,7 @@ def _get_readers_data_sources() -> list: def _get_readers_data_sources_path() -> list: - """Returns the list of readers data sources directory paths within ``disdrodb.l0.readers``""" + """Returns the list of readers data sources directory paths within ``disdrodb.l0.readers``.""" # Readers directory path reader_dir = _get_readers_directory() @@ -109,7 +109,6 @@ def _check_reader_data_source(reader_data_source: str) -> str: ValueError Error if the data source name provided is not a directory within the ``disdrodb.l0.readers`` directory. """ - # List available readers data sources available_reader_data_sources = _get_readers_data_sources() # If not valid data_source, raise error @@ -307,7 +306,7 @@ def get_reader_function_from_metadata_key(reader_data_source_name): def _get_reader_from_metadata(metadata): - """Retrieve the reader function from the metadata key ``reader`` + """Retrieve the reader function from the metadata key ``reader``. The convention for metadata reader key: ```` in ``disdrodb.l0.readers``. """ diff --git a/disdrodb/l0/l0a_processing.py b/disdrodb/l0/l0a_processing.py index 12348c18..03e25ae5 100644 --- a/disdrodb/l0/l0a_processing.py +++ b/disdrodb/l0/l0a_processing.py @@ -303,7 +303,6 @@ def cast_column_dtypes(df: pd.DataFrame, sensor_name: str) -> pd.DataFrame: pd.DataFrame Dataframe with corrected columns types. """ - # Cast dataframe to dtypes dtype_dict = get_l0a_dtype(sensor_name) # Ensure time column is saved with seconds resolution @@ -698,7 +697,6 @@ def write_l0a( NotImplementedError The input dataframe can not be processed. """ - # -------------------------------------------------------------------------. # Create station directory if does not exist create_directory(os.path.dirname(filepath)) @@ -826,7 +824,6 @@ def read_raw_files( Input parameters can not be used or the raw file can not be processed. """ - # ------------------------------------------------------. # Check input list if isinstance(filepaths, str): diff --git a/disdrodb/l0/l0b_processing.py b/disdrodb/l0/l0b_processing.py index 25ee529f..9f51f133 100644 --- a/disdrodb/l0/l0b_processing.py +++ b/disdrodb/l0/l0b_processing.py @@ -111,7 +111,6 @@ def _format_string_array(string: str, n_values: int) -> np.array: np.array array of float """ - split_str = infer_split_str(string) values = np.array(string.strip(split_str).split(split_str)) @@ -157,7 +156,8 @@ def _reshape_raw_spectrum( dims_order : list The order of dimension in the raw spectrum. - Examples: + Examples + -------- - OTT Parsivel spectrum [v1d1 ... v1d32, v2d1, ..., v2d32] --> dims_order = ["diameter_bin_center", "velocity_bin_center"] - Thies LPM spectrum [v1d1 ... v20d1, v1d2, ..., v20d2] @@ -214,7 +214,6 @@ def retrieve_l0b_arrays( Dictionary with data arrays. """ - msg = " - Retrieval of L0B data arrays started." log_info(logger=logger, msg=msg, verbose=verbose) # ----------------------------------------------------------. @@ -358,7 +357,7 @@ def _set_dataset_attrs(ds, sensor_name): def add_dataset_crs_coords(ds): - "Add the CRS coordinate to the xr.Dataset" + """Add the CRS coordinate to the xr.Dataset.""" # TODO: define CF-compliant CRS ! # - CF compliant # - wkt @@ -536,7 +535,6 @@ def rechunk_dataset(ds: xr.Dataset, encoding_dict: dict) -> xr.Dataset: xr.Dataset Output xarray dataset """ - for var in ds.data_vars: chunks = encoding_dict[var].pop("chunksizes") dims = list(ds[var].dims) diff --git a/disdrodb/l0/readers/ARM/ARM_LD.py b/disdrodb/l0/readers/ARM/ARM_LD.py index 89675bfa..46b6dc9a 100644 --- a/disdrodb/l0/readers/ARM/ARM_LD.py +++ b/disdrodb/l0/readers/ARM/ARM_LD.py @@ -31,6 +31,8 @@ def reader( parallel=False, debugging_mode=False, ): + """Reader.""" + ##------------------------------------------------------------------------. # Define dictionary mapping dataset variables to select and rename dict_names = { ### Dimensions diff --git a/disdrodb/l0/readers/ARM/ARM_LPM.py b/disdrodb/l0/readers/ARM/ARM_LPM.py index 8143f203..b54b8519 100644 --- a/disdrodb/l0/readers/ARM/ARM_LPM.py +++ b/disdrodb/l0/readers/ARM/ARM_LPM.py @@ -31,6 +31,9 @@ def reader( parallel=False, debugging_mode=False, ): + """Reader.""" + ##------------------------------------------------------------------------. + # Define dictionary mapping dataset variables to select and rename dict_names = { ## Dimensions "particle_diameter": "diameter_bin_center", diff --git a/disdrodb/l0/readers/AUSTRALIA/MELBOURNE_2007_OTT.py b/disdrodb/l0/readers/AUSTRALIA/MELBOURNE_2007_OTT.py index 61d3706d..40c1f960 100644 --- a/disdrodb/l0/readers/AUSTRALIA/MELBOURNE_2007_OTT.py +++ b/disdrodb/l0/readers/AUSTRALIA/MELBOURNE_2007_OTT.py @@ -30,6 +30,7 @@ def reader( parallel=False, debugging_mode=False, ): + """Reader.""" ##------------------------------------------------------------------------. #### - Define column names column_names = ["TO_BE_PARSED"] diff --git a/disdrodb/l0/readers/AUSTRALIA/MELBOURNE_2007_THIES.py b/disdrodb/l0/readers/AUSTRALIA/MELBOURNE_2007_THIES.py index eee032ac..bc4388c2 100644 --- a/disdrodb/l0/readers/AUSTRALIA/MELBOURNE_2007_THIES.py +++ b/disdrodb/l0/readers/AUSTRALIA/MELBOURNE_2007_THIES.py @@ -30,6 +30,7 @@ def reader( parallel=False, debugging_mode=False, ): + """Reader.""" ##------------------------------------------------------------------------. #### - Define column names column_names = ["TO_BE_PARSED"] diff --git a/disdrodb/l0/readers/BRAZIL/CHUVA_LPM.py b/disdrodb/l0/readers/BRAZIL/CHUVA_LPM.py index dae0a6fd..25f473c1 100644 --- a/disdrodb/l0/readers/BRAZIL/CHUVA_LPM.py +++ b/disdrodb/l0/readers/BRAZIL/CHUVA_LPM.py @@ -30,6 +30,7 @@ def reader( parallel=False, debugging_mode=False, ): + """Reader.""" ##------------------------------------------------------------------------. #### - Define column names column_names = ["TO_BE_PARSED"] diff --git a/disdrodb/l0/readers/BRAZIL/CHUVA_OTT.py b/disdrodb/l0/readers/BRAZIL/CHUVA_OTT.py index 963f73a4..a42f29d2 100644 --- a/disdrodb/l0/readers/BRAZIL/CHUVA_OTT.py +++ b/disdrodb/l0/readers/BRAZIL/CHUVA_OTT.py @@ -30,6 +30,7 @@ def reader( parallel=False, debugging_mode=False, ): + """Reader.""" ##------------------------------------------------------------------------. #### - Define column names column_names = ["TO_PARSE"] diff --git a/disdrodb/l0/readers/BRAZIL/CHUVA_RD80.py b/disdrodb/l0/readers/BRAZIL/CHUVA_RD80.py index b87df2df..55dca220 100644 --- a/disdrodb/l0/readers/BRAZIL/CHUVA_RD80.py +++ b/disdrodb/l0/readers/BRAZIL/CHUVA_RD80.py @@ -31,6 +31,7 @@ def reader( parallel=False, debugging_mode=False, ): + """Reader.""" ##------------------------------------------------------------------------. #### - Define column names column_names = [ diff --git a/disdrodb/l0/readers/BRAZIL/GOAMAZON_LPM.py b/disdrodb/l0/readers/BRAZIL/GOAMAZON_LPM.py index cfaa04c6..c590fafb 100644 --- a/disdrodb/l0/readers/BRAZIL/GOAMAZON_LPM.py +++ b/disdrodb/l0/readers/BRAZIL/GOAMAZON_LPM.py @@ -30,6 +30,7 @@ def reader( parallel=False, debugging_mode=False, ): + """Reader.""" ##------------------------------------------------------------------------. #### - Define column names column_names = ["TO_BE_PARSED"] diff --git a/disdrodb/l0/readers/BRAZIL/GOAMAZON_OTT.py b/disdrodb/l0/readers/BRAZIL/GOAMAZON_OTT.py index 12afce80..3366c62e 100644 --- a/disdrodb/l0/readers/BRAZIL/GOAMAZON_OTT.py +++ b/disdrodb/l0/readers/BRAZIL/GOAMAZON_OTT.py @@ -30,6 +30,7 @@ def reader( parallel=False, debugging_mode=False, ): + """Reader.""" ##------------------------------------------------------------------------. #### - Define column names column_names = ["TO_PARSE"] diff --git a/disdrodb/l0/readers/BRAZIL/GOAMAZON_RD80.py b/disdrodb/l0/readers/BRAZIL/GOAMAZON_RD80.py index 57022589..ce667dbb 100644 --- a/disdrodb/l0/readers/BRAZIL/GOAMAZON_RD80.py +++ b/disdrodb/l0/readers/BRAZIL/GOAMAZON_RD80.py @@ -31,6 +31,7 @@ def reader( parallel=False, debugging_mode=False, ): + """Reader.""" ##------------------------------------------------------------------------. #### - Define column names column_names = [ diff --git a/disdrodb/l0/readers/CHINA/CHONGQING.py b/disdrodb/l0/readers/CHINA/CHONGQING.py index cc528c91..0e60649e 100644 --- a/disdrodb/l0/readers/CHINA/CHONGQING.py +++ b/disdrodb/l0/readers/CHINA/CHONGQING.py @@ -32,6 +32,7 @@ def reader( parallel=False, debugging_mode=False, ): + """Reader.""" ##------------------------------------------------------------------------. #### - Define column names column_names = ["TO_SPLIT"] diff --git a/disdrodb/l0/readers/DENMARK/EROSION_nc.py b/disdrodb/l0/readers/DENMARK/EROSION_nc.py index cab4321a..88f8b64a 100644 --- a/disdrodb/l0/readers/DENMARK/EROSION_nc.py +++ b/disdrodb/l0/readers/DENMARK/EROSION_nc.py @@ -31,6 +31,8 @@ def reader( parallel=False, debugging_mode=False, ): + """Reader.""" + ##------------------------------------------------------------------------. # Define dictionary mapping dataset variables to select and rename dict_names = { ### Dimensions diff --git a/disdrodb/l0/readers/EPFL/ARCTIC_2021.py b/disdrodb/l0/readers/EPFL/ARCTIC_2021.py index 22027a78..e0e62ead 100644 --- a/disdrodb/l0/readers/EPFL/ARCTIC_2021.py +++ b/disdrodb/l0/readers/EPFL/ARCTIC_2021.py @@ -15,6 +15,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -----------------------------------------------------------------------------. +"""Reader for ARCTIC 2021 campaign.""" from disdrodb.l0 import run_l0a from disdrodb.l0.l0_reader import is_documented_by, reader_generic_docstring @@ -30,6 +31,7 @@ def reader( parallel=False, debugging_mode=False, ): + """Reader.""" ##------------------------------------------------------------------------. #### - Define column names column_names = [ diff --git a/disdrodb/l0/readers/EPFL/COMMON_2011.py b/disdrodb/l0/readers/EPFL/COMMON_2011.py index 91d82a6c..106cfaf0 100644 --- a/disdrodb/l0/readers/EPFL/COMMON_2011.py +++ b/disdrodb/l0/readers/EPFL/COMMON_2011.py @@ -15,6 +15,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -----------------------------------------------------------------------------. +"""Reader for COMMON 2011 campaign.""" from disdrodb.l0 import run_l0a from disdrodb.l0.l0_reader import is_documented_by, reader_generic_docstring @@ -30,6 +31,7 @@ def reader( parallel=False, debugging_mode=False, ): + """Reader.""" ##------------------------------------------------------------------------. #### - Define column names column_names = [ diff --git a/disdrodb/l0/readers/EPFL/DAVOS_2009_2011.py b/disdrodb/l0/readers/EPFL/DAVOS_2009_2011.py index ca29d10f..3812ed86 100644 --- a/disdrodb/l0/readers/EPFL/DAVOS_2009_2011.py +++ b/disdrodb/l0/readers/EPFL/DAVOS_2009_2011.py @@ -15,6 +15,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -----------------------------------------------------------------------------. +"""Reader for DAVOS 2009-2011 campaign.""" from disdrodb.l0 import run_l0a from disdrodb.l0.l0_reader import is_documented_by, reader_generic_docstring @@ -30,6 +31,7 @@ def reader( parallel=False, debugging_mode=False, ): + """Reader.""" ##------------------------------------------------------------------------. #### - Define column names column_names = [ diff --git a/disdrodb/l0/readers/EPFL/EPFL_2009.py b/disdrodb/l0/readers/EPFL/EPFL_2009.py index f680087d..8b106619 100644 --- a/disdrodb/l0/readers/EPFL/EPFL_2009.py +++ b/disdrodb/l0/readers/EPFL/EPFL_2009.py @@ -15,6 +15,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -----------------------------------------------------------------------------. +"""Reader for EPFL 2009 campaign.""" from disdrodb.l0 import run_l0a from disdrodb.l0.l0_reader import is_documented_by, reader_generic_docstring @@ -30,6 +31,7 @@ def reader( parallel=False, debugging_mode=False, ): + """Reader.""" ##------------------------------------------------------------------------. #### - Define column names column_names = [ diff --git a/disdrodb/l0/readers/EPFL/EPFL_ROOF_2008.py b/disdrodb/l0/readers/EPFL/EPFL_ROOF_2008.py index 8353256b..4ea639f8 100644 --- a/disdrodb/l0/readers/EPFL/EPFL_ROOF_2008.py +++ b/disdrodb/l0/readers/EPFL/EPFL_ROOF_2008.py @@ -15,6 +15,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -----------------------------------------------------------------------------. +"""Reader for EPFL ROOF 2008 campaign.""" from disdrodb.l0 import run_l0a from disdrodb.l0.l0_reader import is_documented_by, reader_generic_docstring @@ -30,6 +31,7 @@ def reader( parallel=False, debugging_mode=False, ): + """Reader.""" ##------------------------------------------------------------------------. #### - Define column names column_names = [ diff --git a/disdrodb/l0/readers/EPFL/EPFL_ROOF_2010.py b/disdrodb/l0/readers/EPFL/EPFL_ROOF_2010.py index 00da2f66..76881527 100644 --- a/disdrodb/l0/readers/EPFL/EPFL_ROOF_2010.py +++ b/disdrodb/l0/readers/EPFL/EPFL_ROOF_2010.py @@ -15,6 +15,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -----------------------------------------------------------------------------. +"""Reader for EPFL ROOF 2010 campaign.""" from disdrodb.l0 import run_l0a from disdrodb.l0.l0_reader import is_documented_by, reader_generic_docstring @@ -30,6 +31,7 @@ def reader( parallel=False, debugging_mode=False, ): + """Reader.""" ##------------------------------------------------------------------------. #### - Define column names column_names = [ diff --git a/disdrodb/l0/readers/EPFL/EPFL_ROOF_2011.py b/disdrodb/l0/readers/EPFL/EPFL_ROOF_2011.py index e3347848..e5f874a1 100644 --- a/disdrodb/l0/readers/EPFL/EPFL_ROOF_2011.py +++ b/disdrodb/l0/readers/EPFL/EPFL_ROOF_2011.py @@ -15,6 +15,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -----------------------------------------------------------------------------. +"""Reader for EPFL ROOF 2011 campaign.""" from disdrodb.l0 import run_l0a from disdrodb.l0.l0_reader import is_documented_by, reader_generic_docstring @@ -30,6 +31,7 @@ def reader( parallel=False, debugging_mode=False, ): + """Reader.""" ##------------------------------------------------------------------------. #### - Define column names column_names = [ diff --git a/disdrodb/l0/readers/EPFL/EPFL_ROOF_2012.py b/disdrodb/l0/readers/EPFL/EPFL_ROOF_2012.py index 460d9393..c0c8a722 100644 --- a/disdrodb/l0/readers/EPFL/EPFL_ROOF_2012.py +++ b/disdrodb/l0/readers/EPFL/EPFL_ROOF_2012.py @@ -31,6 +31,7 @@ def reader( parallel=False, debugging_mode=False, ): + """Reader.""" ##------------------------------------------------------------------------. #### - Define column names column_names = [ diff --git a/disdrodb/l0/readers/EPFL/GENEPI_2007.py b/disdrodb/l0/readers/EPFL/GENEPI_2007.py index 13db961e..7647fbaa 100644 --- a/disdrodb/l0/readers/EPFL/GENEPI_2007.py +++ b/disdrodb/l0/readers/EPFL/GENEPI_2007.py @@ -15,6 +15,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -----------------------------------------------------------------------------. +"""Reader for the GENEPI campaign.""" from disdrodb.l0 import run_l0a from disdrodb.l0.l0_reader import is_documented_by, reader_generic_docstring @@ -30,6 +31,7 @@ def reader( parallel=False, debugging_mode=False, ): + """Reader.""" ##------------------------------------------------------------------------. #### - Define column names column_names = [ diff --git a/disdrodb/l0/readers/EPFL/GRAND_ST_BERNARD_2007.py b/disdrodb/l0/readers/EPFL/GRAND_ST_BERNARD_2007.py index 4e634b37..dce94002 100644 --- a/disdrodb/l0/readers/EPFL/GRAND_ST_BERNARD_2007.py +++ b/disdrodb/l0/readers/EPFL/GRAND_ST_BERNARD_2007.py @@ -17,6 +17,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -----------------------------------------------------------------------------. +"""Reader for the GRAND ST BERNARD campaign.""" from disdrodb.l0 import run_l0a from disdrodb.l0.l0_reader import is_documented_by, reader_generic_docstring @@ -32,6 +33,7 @@ def reader( parallel=False, debugging_mode=False, ): + """Reader.""" ##------------------------------------------------------------------------. #### - Define column names column_names = [ diff --git a/disdrodb/l0/readers/EPFL/GRAND_ST_BERNARD_2007_2.py b/disdrodb/l0/readers/EPFL/GRAND_ST_BERNARD_2007_2.py index ceef5a59..a8306b72 100644 --- a/disdrodb/l0/readers/EPFL/GRAND_ST_BERNARD_2007_2.py +++ b/disdrodb/l0/readers/EPFL/GRAND_ST_BERNARD_2007_2.py @@ -17,6 +17,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -----------------------------------------------------------------------------. +"""Reader for the GRAND ST BERNARD campaign.""" from disdrodb.l0 import run_l0a from disdrodb.l0.l0_reader import is_documented_by, reader_generic_docstring @@ -32,6 +33,7 @@ def reader( parallel=False, debugging_mode=False, ): + """Reader.""" ##------------------------------------------------------------------------. #### - Define column names column_names = [ diff --git a/disdrodb/l0/readers/EPFL/HPICONET_2010.py b/disdrodb/l0/readers/EPFL/HPICONET_2010.py index 7fe0bb72..99e4d9e1 100644 --- a/disdrodb/l0/readers/EPFL/HPICONET_2010.py +++ b/disdrodb/l0/readers/EPFL/HPICONET_2010.py @@ -15,6 +15,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -----------------------------------------------------------------------------. +"""Reader for the HPICONET campaign.""" from disdrodb.l0 import run_l0a from disdrodb.l0.l0_reader import is_documented_by, reader_generic_docstring @@ -30,6 +31,7 @@ def reader( parallel=False, debugging_mode=False, ): + """Reader.""" ##------------------------------------------------------------------------. #### - Define column names column_names = [ diff --git a/disdrodb/l0/readers/EPFL/HYMEX_LTE_SOP2.py b/disdrodb/l0/readers/EPFL/HYMEX_LTE_SOP2.py index 6892b62f..cd2e808d 100644 --- a/disdrodb/l0/readers/EPFL/HYMEX_LTE_SOP2.py +++ b/disdrodb/l0/readers/EPFL/HYMEX_LTE_SOP2.py @@ -15,7 +15,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -----------------------------------------------------------------------------. -"""Reader for HYMEX SOP2 campaign.""" +"""Reader for the HYMEX SOP2 campaign.""" from disdrodb.l0 import run_l0a from disdrodb.l0.l0_reader import is_documented_by, reader_generic_docstring @@ -31,6 +31,7 @@ def reader( parallel=False, debugging_mode=False, ): + """Reader.""" ##------------------------------------------------------------------------. #### - Define column names column_names = [ diff --git a/disdrodb/l0/readers/EPFL/HYMEX_LTE_SOP3.py b/disdrodb/l0/readers/EPFL/HYMEX_LTE_SOP3.py index 473802b9..4bcbe192 100644 --- a/disdrodb/l0/readers/EPFL/HYMEX_LTE_SOP3.py +++ b/disdrodb/l0/readers/EPFL/HYMEX_LTE_SOP3.py @@ -31,6 +31,7 @@ def reader( parallel=False, debugging_mode=False, ): + """Reader.""" ##------------------------------------------------------------------------. #### - Define column names column_names = [ diff --git a/disdrodb/l0/readers/EPFL/HYMEX_LTE_SOP4.py b/disdrodb/l0/readers/EPFL/HYMEX_LTE_SOP4.py index d71d4c88..0a6c32ad 100644 --- a/disdrodb/l0/readers/EPFL/HYMEX_LTE_SOP4.py +++ b/disdrodb/l0/readers/EPFL/HYMEX_LTE_SOP4.py @@ -31,6 +31,7 @@ def reader( parallel=False, debugging_mode=False, ): + """Reader.""" ##------------------------------------------------------------------------. #### - Define column names column_names = [ diff --git a/disdrodb/l0/readers/EPFL/LOCARNO_2018.py b/disdrodb/l0/readers/EPFL/LOCARNO_2018.py index 3394d449..fd88f206 100644 --- a/disdrodb/l0/readers/EPFL/LOCARNO_2018.py +++ b/disdrodb/l0/readers/EPFL/LOCARNO_2018.py @@ -30,6 +30,7 @@ def reader( parallel=False, debugging_mode=False, ): + """Reader.""" ##------------------------------------------------------------------------. #### - Define column names column_names = [ diff --git a/disdrodb/l0/readers/EPFL/LOCARNO_2019.py b/disdrodb/l0/readers/EPFL/LOCARNO_2019.py index 4751087a..f0e2b414 100644 --- a/disdrodb/l0/readers/EPFL/LOCARNO_2019.py +++ b/disdrodb/l0/readers/EPFL/LOCARNO_2019.py @@ -30,6 +30,7 @@ def reader( parallel=False, debugging_mode=False, ): + """Reader.""" ##------------------------------------------------------------------------. #### - Define column names column_names = [ diff --git a/disdrodb/l0/readers/EPFL/PARADISO_2014.py b/disdrodb/l0/readers/EPFL/PARADISO_2014.py index 57f2717a..06be5c52 100644 --- a/disdrodb/l0/readers/EPFL/PARADISO_2014.py +++ b/disdrodb/l0/readers/EPFL/PARADISO_2014.py @@ -15,6 +15,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -----------------------------------------------------------------------------. +"""Reader for PARADISO 2014 campaign.""" from disdrodb.l0 import run_l0a from disdrodb.l0.l0_reader import is_documented_by, reader_generic_docstring @@ -30,6 +31,7 @@ def reader( parallel=False, debugging_mode=False, ): + """Reader.""" ##------------------------------------------------------------------------. #### - Define column names column_names = [ diff --git a/disdrodb/l0/readers/EPFL/PARSIVEL_2007.py b/disdrodb/l0/readers/EPFL/PARSIVEL_2007.py index a0a4dff1..42d99630 100644 --- a/disdrodb/l0/readers/EPFL/PARSIVEL_2007.py +++ b/disdrodb/l0/readers/EPFL/PARSIVEL_2007.py @@ -15,6 +15,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -----------------------------------------------------------------------------. +"""Reader for PARSIVEL 2007 campaign.""" from disdrodb.l0 import run_l0a from disdrodb.l0.l0_reader import is_documented_by, reader_generic_docstring @@ -30,6 +31,7 @@ def reader( parallel=False, debugging_mode=False, ): + """Reader.""" ##------------------------------------------------------------------------. #### - Define column names column_names = [ diff --git a/disdrodb/l0/readers/EPFL/PLATO_2019.py b/disdrodb/l0/readers/EPFL/PLATO_2019.py index 4981ce25..48cce7e3 100644 --- a/disdrodb/l0/readers/EPFL/PLATO_2019.py +++ b/disdrodb/l0/readers/EPFL/PLATO_2019.py @@ -30,6 +30,7 @@ def reader( parallel=False, debugging_mode=False, ): + """Reader.""" ##------------------------------------------------------------------------. #### - Define column names column_names = [ diff --git a/disdrodb/l0/readers/EPFL/RACLETS_2019.py b/disdrodb/l0/readers/EPFL/RACLETS_2019.py index 1533d4d8..8afaf788 100644 --- a/disdrodb/l0/readers/EPFL/RACLETS_2019.py +++ b/disdrodb/l0/readers/EPFL/RACLETS_2019.py @@ -15,6 +15,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -----------------------------------------------------------------------------. +"""Reader for RACLETS 2019 campaign.""" from disdrodb.l0 import run_l0a from disdrodb.l0.l0_reader import is_documented_by, reader_generic_docstring @@ -30,6 +31,7 @@ def reader( parallel=False, debugging_mode=False, ): + """Reader.""" ##------------------------------------------------------------------------. #### - Define column names column_names = ["TO_BE_SPLITTED"] diff --git a/disdrodb/l0/readers/EPFL/RACLETS_2019_WJF.py b/disdrodb/l0/readers/EPFL/RACLETS_2019_WJF.py index 4ff9cd33..17765cea 100644 --- a/disdrodb/l0/readers/EPFL/RACLETS_2019_WJF.py +++ b/disdrodb/l0/readers/EPFL/RACLETS_2019_WJF.py @@ -15,6 +15,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -----------------------------------------------------------------------------. +"""Reader for RACLETS WJF 2019 station.""" from disdrodb.l0 import run_l0a from disdrodb.l0.l0_reader import is_documented_by, reader_generic_docstring @@ -30,6 +31,7 @@ def reader( parallel=False, debugging_mode=False, ): + """Reader.""" ##------------------------------------------------------------------------. #### - Define column names column_names = [ diff --git a/disdrodb/l0/readers/EPFL/RIETHOLZBACH_2011.py b/disdrodb/l0/readers/EPFL/RIETHOLZBACH_2011.py index 45efd881..60176658 100644 --- a/disdrodb/l0/readers/EPFL/RIETHOLZBACH_2011.py +++ b/disdrodb/l0/readers/EPFL/RIETHOLZBACH_2011.py @@ -15,6 +15,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -----------------------------------------------------------------------------. +"""Reader for RIETHOLZBACH 2011 campaign.""" from disdrodb.l0 import run_l0a from disdrodb.l0.l0_reader import is_documented_by, reader_generic_docstring @@ -30,6 +31,7 @@ def reader( parallel=False, debugging_mode=False, ): + """Reader.""" ##------------------------------------------------------------------------. #### - Define column names column_names = [ diff --git a/disdrodb/l0/readers/EPFL/SAMOYLOV_2017.py b/disdrodb/l0/readers/EPFL/SAMOYLOV_2017.py index ee833c96..e4eb7133 100644 --- a/disdrodb/l0/readers/EPFL/SAMOYLOV_2017.py +++ b/disdrodb/l0/readers/EPFL/SAMOYLOV_2017.py @@ -15,6 +15,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -----------------------------------------------------------------------------. +"""Reader for SAMOYLOV 2017 campaign.""" from disdrodb.l0 import run_l0a from disdrodb.l0.l0_reader import is_documented_by, reader_generic_docstring @@ -30,6 +31,7 @@ def reader( parallel=False, debugging_mode=False, ): + """Reader.""" ##------------------------------------------------------------------------. #### - Define column names column_names = [ diff --git a/disdrodb/l0/readers/EPFL/SAMOYLOV_2019.py b/disdrodb/l0/readers/EPFL/SAMOYLOV_2019.py index 793dbd86..9169e2f1 100644 --- a/disdrodb/l0/readers/EPFL/SAMOYLOV_2019.py +++ b/disdrodb/l0/readers/EPFL/SAMOYLOV_2019.py @@ -15,6 +15,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -----------------------------------------------------------------------------. +"""Reader for SAMOYLOV 2019 campaign.""" from disdrodb.l0 import run_l0a from disdrodb.l0.l0_reader import is_documented_by, reader_generic_docstring @@ -30,6 +31,7 @@ def reader( parallel=False, debugging_mode=False, ): + """Reader.""" ##------------------------------------------------------------------------. #### - Define column names column_names = [ diff --git a/disdrodb/l0/readers/EPFL/UNIL_2022.py b/disdrodb/l0/readers/EPFL/UNIL_2022.py index 05b80452..e380015a 100644 --- a/disdrodb/l0/readers/EPFL/UNIL_2022.py +++ b/disdrodb/l0/readers/EPFL/UNIL_2022.py @@ -15,6 +15,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -----------------------------------------------------------------------------. +"""Reader for UNIL 2022 campaign.""" from disdrodb.l0 import run_l0a from disdrodb.l0.l0_reader import is_documented_by, reader_generic_docstring @@ -30,6 +31,7 @@ def reader( parallel=False, debugging_mode=False, ): + """Reader.""" ##------------------------------------------------------------------------. #### - Define column names column_names = [ diff --git a/disdrodb/l0/readers/FRANCE/SIRTA_OTT2.py b/disdrodb/l0/readers/FRANCE/SIRTA_OTT2.py index dbff1e3e..b6b1b5c6 100644 --- a/disdrodb/l0/readers/FRANCE/SIRTA_OTT2.py +++ b/disdrodb/l0/readers/FRANCE/SIRTA_OTT2.py @@ -31,6 +31,7 @@ def reader( parallel=False, debugging_mode=False, ): + """Reader.""" ##------------------------------------------------------------------------. #### - Define column names column_names = ["TO_SPLIT"] diff --git a/disdrodb/l0/readers/GPM/GCPEX.py b/disdrodb/l0/readers/GPM/GCPEX.py index 6d28b6df..64dcbedc 100644 --- a/disdrodb/l0/readers/GPM/GCPEX.py +++ b/disdrodb/l0/readers/GPM/GCPEX.py @@ -30,6 +30,7 @@ def reader( parallel=False, debugging_mode=False, ): + """Reader.""" ##------------------------------------------------------------------------. #### - Define column names column_names = ["time", "TO_BE_SPLITTED"] diff --git a/disdrodb/l0/readers/GPM/IFLOODS.py b/disdrodb/l0/readers/GPM/IFLOODS.py index 6d64fb51..035390f8 100644 --- a/disdrodb/l0/readers/GPM/IFLOODS.py +++ b/disdrodb/l0/readers/GPM/IFLOODS.py @@ -30,6 +30,7 @@ def reader( parallel=False, debugging_mode=False, ): + """Reader.""" ##------------------------------------------------------------------------. #### - Define column names column_names = ["time", "TO_BE_SPLITTED"] diff --git a/disdrodb/l0/readers/GPM/LPVEX.py b/disdrodb/l0/readers/GPM/LPVEX.py index 0fcb3dad..15b30f24 100644 --- a/disdrodb/l0/readers/GPM/LPVEX.py +++ b/disdrodb/l0/readers/GPM/LPVEX.py @@ -30,6 +30,7 @@ def reader( parallel=False, debugging_mode=False, ): + """Reader.""" ##------------------------------------------------------------------------. #### - Define column names column_names = ["time", "unknown", "raw_drop_number"] diff --git a/disdrodb/l0/readers/GPM/MC3E.py b/disdrodb/l0/readers/GPM/MC3E.py index 0ccd9302..775d14f4 100644 --- a/disdrodb/l0/readers/GPM/MC3E.py +++ b/disdrodb/l0/readers/GPM/MC3E.py @@ -30,6 +30,7 @@ def reader( parallel=False, debugging_mode=False, ): + """Reader.""" ##------------------------------------------------------------------------. #### - Define column name column_names = ["time", "TO_BE_SPLITTED"] diff --git a/disdrodb/l0/readers/GPM/NSSTC.py b/disdrodb/l0/readers/GPM/NSSTC.py index a5fcf9ee..7595ada7 100644 --- a/disdrodb/l0/readers/GPM/NSSTC.py +++ b/disdrodb/l0/readers/GPM/NSSTC.py @@ -30,6 +30,7 @@ def reader( parallel=False, debugging_mode=False, ): + """Reader.""" ##------------------------------------------------------------------------. #### - Define column names column_names = ["time", "TO_BE_SPLITTED"] diff --git a/disdrodb/l0/readers/ITALY/GID.py b/disdrodb/l0/readers/ITALY/GID.py index 3d66a01a..c762125d 100644 --- a/disdrodb/l0/readers/ITALY/GID.py +++ b/disdrodb/l0/readers/ITALY/GID.py @@ -31,6 +31,7 @@ def reader( parallel=False, debugging_mode=False, ): + """Reader.""" ##------------------------------------------------------------------------. #### - Define column names column_names = ["TO_BE_SPLITTED"] diff --git a/disdrodb/l0/readers/MEXICO/OH_IIUNAM_nc.py b/disdrodb/l0/readers/MEXICO/OH_IIUNAM_nc.py index 8b8f1b9e..5d2b78b4 100644 --- a/disdrodb/l0/readers/MEXICO/OH_IIUNAM_nc.py +++ b/disdrodb/l0/readers/MEXICO/OH_IIUNAM_nc.py @@ -31,6 +31,8 @@ def reader( parallel=False, debugging_mode=False, ): + """Reader.""" + ##------------------------------------------------------------------------. # Define dictionary mapping dataset variables to select and rename dict_names = { ### Dimensions diff --git a/disdrodb/l0/readers/NCAR/CCOPE_2015.py b/disdrodb/l0/readers/NCAR/CCOPE_2015.py index 73de0da8..e769c1a0 100644 --- a/disdrodb/l0/readers/NCAR/CCOPE_2015.py +++ b/disdrodb/l0/readers/NCAR/CCOPE_2015.py @@ -30,6 +30,7 @@ def reader( parallel=False, debugging_mode=False, ): + """Reader.""" ##------------------------------------------------------------------------. #### - Define column names column_names = ["TO_PARSE"] diff --git a/disdrodb/l0/readers/NCAR/CINDY_2011_RD80.py b/disdrodb/l0/readers/NCAR/CINDY_2011_RD80.py index 8a10f895..d5739035 100644 --- a/disdrodb/l0/readers/NCAR/CINDY_2011_RD80.py +++ b/disdrodb/l0/readers/NCAR/CINDY_2011_RD80.py @@ -31,6 +31,7 @@ def reader( parallel=False, debugging_mode=False, ): + """Reader.""" ##------------------------------------------------------------------------. #### - Define column names column_names = [ diff --git a/disdrodb/l0/readers/NCAR/OWLES_MIPS.py b/disdrodb/l0/readers/NCAR/OWLES_MIPS.py index 7ffc6936..9cf55997 100644 --- a/disdrodb/l0/readers/NCAR/OWLES_MIPS.py +++ b/disdrodb/l0/readers/NCAR/OWLES_MIPS.py @@ -30,7 +30,8 @@ def reader( parallel=False, debugging_mode=False, ): - ####----------------------------------------------------------------------. + """Reader.""" + ##------------------------------------------------------------------------. #### - Define column names column_names = [ "day", diff --git a/disdrodb/l0/readers/NCAR/PECAN_FP3.py b/disdrodb/l0/readers/NCAR/PECAN_FP3.py index 0f5bcf67..20f655ab 100644 --- a/disdrodb/l0/readers/NCAR/PECAN_FP3.py +++ b/disdrodb/l0/readers/NCAR/PECAN_FP3.py @@ -30,7 +30,8 @@ def reader( parallel=False, debugging_mode=False, ): - ####----------------------------------------------------------------------. + """Reader.""" + ##------------------------------------------------------------------------. #### - Define column names column_names = ["TO_SPLIT"] diff --git a/disdrodb/l0/readers/NCAR/PECAN_MIPS.py b/disdrodb/l0/readers/NCAR/PECAN_MIPS.py index a335596c..a94a1f28 100644 --- a/disdrodb/l0/readers/NCAR/PECAN_MIPS.py +++ b/disdrodb/l0/readers/NCAR/PECAN_MIPS.py @@ -30,7 +30,8 @@ def reader( parallel=False, debugging_mode=False, ): - ####----------------------------------------------------------------------. + """Reader.""" + ##------------------------------------------------------------------------. #### - Define column names column_names = [ "day", diff --git a/disdrodb/l0/readers/NCAR/PECAN_MOBILE.py b/disdrodb/l0/readers/NCAR/PECAN_MOBILE.py index e087dbff..2550ab5c 100644 --- a/disdrodb/l0/readers/NCAR/PECAN_MOBILE.py +++ b/disdrodb/l0/readers/NCAR/PECAN_MOBILE.py @@ -30,7 +30,8 @@ def reader( parallel=False, debugging_mode=False, ): - ####----------------------------------------------------------------------. + """Reader.""" + ##------------------------------------------------------------------------. #### - Define column names column_names = ["TO_SPLIT"] diff --git a/disdrodb/l0/readers/NCAR/PLOWS_MIPS.py b/disdrodb/l0/readers/NCAR/PLOWS_MIPS.py index b57a125a..cebbe8f8 100644 --- a/disdrodb/l0/readers/NCAR/PLOWS_MIPS.py +++ b/disdrodb/l0/readers/NCAR/PLOWS_MIPS.py @@ -30,6 +30,7 @@ def reader( parallel=False, debugging_mode=False, ): + """Reader.""" ##------------------------------------------------------------------------. #### - Define column names column_names = [ diff --git a/disdrodb/l0/readers/NCAR/RELAMPAGO_OTT.py b/disdrodb/l0/readers/NCAR/RELAMPAGO_OTT.py index ff2173f0..faefb118 100644 --- a/disdrodb/l0/readers/NCAR/RELAMPAGO_OTT.py +++ b/disdrodb/l0/readers/NCAR/RELAMPAGO_OTT.py @@ -30,7 +30,8 @@ def reader( parallel=False, debugging_mode=False, ): - ####----------------------------------------------------------------------. + """Reader.""" + ##------------------------------------------------------------------------. #### - Define column names column_names = ["TO_PARSE"] diff --git a/disdrodb/l0/readers/NCAR/RELAMPAGO_RD80.py b/disdrodb/l0/readers/NCAR/RELAMPAGO_RD80.py index 96f8edc5..55b0c8da 100644 --- a/disdrodb/l0/readers/NCAR/RELAMPAGO_RD80.py +++ b/disdrodb/l0/readers/NCAR/RELAMPAGO_RD80.py @@ -31,6 +31,7 @@ def reader( parallel=False, debugging_mode=False, ): + """Reader.""" ##------------------------------------------------------------------------. #### - Define column names column_names = [ diff --git a/disdrodb/l0/readers/NCAR/SNOWIE_PJ.py b/disdrodb/l0/readers/NCAR/SNOWIE_PJ.py index 393b57c8..53b4fbc9 100644 --- a/disdrodb/l0/readers/NCAR/SNOWIE_PJ.py +++ b/disdrodb/l0/readers/NCAR/SNOWIE_PJ.py @@ -30,6 +30,7 @@ def reader( parallel=False, debugging_mode=False, ): + """Reader.""" ##------------------------------------------------------------------------. #### - Define column names column_names = ["TO_PARSE"] diff --git a/disdrodb/l0/readers/NCAR/SNOWIE_SB.py b/disdrodb/l0/readers/NCAR/SNOWIE_SB.py index 878f20f0..223d4ffd 100644 --- a/disdrodb/l0/readers/NCAR/SNOWIE_SB.py +++ b/disdrodb/l0/readers/NCAR/SNOWIE_SB.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 """ -Created on Fri Feb 17 19:08:17 2023 +Created on Fri Feb 17 19:08:17 2023. @author: ghiggi """ @@ -37,6 +37,7 @@ def reader( parallel=False, debugging_mode=False, ): + """Reader.""" ##------------------------------------------------------------------------. #### - Define column names column_names = ["TO_PARSE"] diff --git a/disdrodb/l0/readers/NCAR/VORTEX2_2009.py b/disdrodb/l0/readers/NCAR/VORTEX2_2009.py index 580fcbcf..62276498 100644 --- a/disdrodb/l0/readers/NCAR/VORTEX2_2009.py +++ b/disdrodb/l0/readers/NCAR/VORTEX2_2009.py @@ -30,6 +30,7 @@ def reader( parallel=False, debugging_mode=False, ): + """Reader.""" ##------------------------------------------------------------------------. #### - Define column names column_names = ["TO_PARSE"] diff --git a/disdrodb/l0/readers/NCAR/VORTEX2_2010.py b/disdrodb/l0/readers/NCAR/VORTEX2_2010.py index c126cdd5..a3d6752d 100644 --- a/disdrodb/l0/readers/NCAR/VORTEX2_2010.py +++ b/disdrodb/l0/readers/NCAR/VORTEX2_2010.py @@ -31,7 +31,8 @@ def reader( parallel=False, debugging_mode=False, ): - ####----------------------------------------------------------------------. + """Reader.""" + ##------------------------------------------------------------------------. #### - Define column names column_names = ["TO_PARSE"] diff --git a/disdrodb/l0/readers/NCAR/VORTEX2_2010_UF.py b/disdrodb/l0/readers/NCAR/VORTEX2_2010_UF.py index aca3195e..16f99b25 100644 --- a/disdrodb/l0/readers/NCAR/VORTEX2_2010_UF.py +++ b/disdrodb/l0/readers/NCAR/VORTEX2_2010_UF.py @@ -31,7 +31,8 @@ def reader( parallel=False, debugging_mode=False, ): - ####----------------------------------------------------------------------. + """Reader.""" + ##------------------------------------------------------------------------. #### - Define column names column_names = ["TO_PARSE"] diff --git a/disdrodb/l0/readers/NCAR/VORTEX_SE_2016_P1.py b/disdrodb/l0/readers/NCAR/VORTEX_SE_2016_P1.py index 3b050554..089e6c63 100644 --- a/disdrodb/l0/readers/NCAR/VORTEX_SE_2016_P1.py +++ b/disdrodb/l0/readers/NCAR/VORTEX_SE_2016_P1.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 """ -Created on Fri Feb 17 20:47:10 2023 +Created on Fri Feb 17 20:47:10 2023. @author: ghiggi """ @@ -37,6 +37,7 @@ def reader( parallel=False, debugging_mode=False, ): + """Reader.""" ##------------------------------------------------------------------------. #### - Define column names column_names = [ diff --git a/disdrodb/l0/readers/NCAR/VORTEX_SE_2016_P2.py b/disdrodb/l0/readers/NCAR/VORTEX_SE_2016_P2.py index 65d5709c..c1e9e2c0 100644 --- a/disdrodb/l0/readers/NCAR/VORTEX_SE_2016_P2.py +++ b/disdrodb/l0/readers/NCAR/VORTEX_SE_2016_P2.py @@ -30,6 +30,7 @@ def reader( parallel=False, debugging_mode=False, ): + """Reader.""" ##------------------------------------------------------------------------. #### - Define column names column_names = [ diff --git a/disdrodb/l0/readers/NCAR/VORTEX_SE_2016_PIPS.py b/disdrodb/l0/readers/NCAR/VORTEX_SE_2016_PIPS.py index 07e37c2c..7814f66f 100644 --- a/disdrodb/l0/readers/NCAR/VORTEX_SE_2016_PIPS.py +++ b/disdrodb/l0/readers/NCAR/VORTEX_SE_2016_PIPS.py @@ -30,6 +30,7 @@ def reader( parallel=False, debugging_mode=False, ): + """Reader.""" ##------------------------------------------------------------------------. #### - Define column names column_names = [ diff --git a/disdrodb/l0/readers/NETHERLANDS/DELFT.py b/disdrodb/l0/readers/NETHERLANDS/DELFT.py index 6d325570..5fa5632a 100644 --- a/disdrodb/l0/readers/NETHERLANDS/DELFT.py +++ b/disdrodb/l0/readers/NETHERLANDS/DELFT.py @@ -30,6 +30,7 @@ def reader( parallel=False, debugging_mode=False, ): + """Reader.""" ##------------------------------------------------------------------------. #### - Define column names column_names = ["time", "epoch_time", "TO_BE_PARSED"] diff --git a/disdrodb/l0/readers/SPAIN/SBEGUERIA.py b/disdrodb/l0/readers/SPAIN/SBEGUERIA.py index 2131b175..db407c7a 100644 --- a/disdrodb/l0/readers/SPAIN/SBEGUERIA.py +++ b/disdrodb/l0/readers/SPAIN/SBEGUERIA.py @@ -30,6 +30,7 @@ def reader( parallel=False, debugging_mode=False, ): + """Reader.""" ##------------------------------------------------------------------------. #### - Define column names # These are the variables included in the datasets: diff --git a/disdrodb/l0/readers/UK/DIVEN.py b/disdrodb/l0/readers/UK/DIVEN.py index 97650caf..8077b534 100644 --- a/disdrodb/l0/readers/UK/DIVEN.py +++ b/disdrodb/l0/readers/UK/DIVEN.py @@ -30,6 +30,8 @@ def reader( parallel=False, debugging_mode=False, ): + """Reader.""" + ##------------------------------------------------------------------------. # Define dictionary mapping dataset variables to select and rename dict_names = { ### Dimensions diff --git a/disdrodb/l0/readers/reader_template.py b/disdrodb/l0/readers/reader_template.py index 20c34414..4f037dba 100644 --- a/disdrodb/l0/readers/reader_template.py +++ b/disdrodb/l0/readers/reader_template.py @@ -31,7 +31,8 @@ def reader( parallel=False, debugging_mode=False, ): - ####----------------------------------------------------------------------. + """Reader.""" + ##------------------------------------------------------------------------. ########################### #### CUSTOMIZABLE CODE #### ########################### diff --git a/disdrodb/l0/routines.py b/disdrodb/l0/routines.py index dcc3d2b2..0c57c203 100644 --- a/disdrodb/l0/routines.py +++ b/disdrodb/l0/routines.py @@ -107,6 +107,7 @@ def click_l0_processing_options(function: object): def click_remove_l0a_option(function: object): + """Click command line argument for ``remove_l0a``.""" function = click.option( "--remove_l0a", type=bool, @@ -363,7 +364,6 @@ def run_disdrodb_l0_station( Base directory of DISDRODB. Format: ``<...>/DISDRODB``. If ``None`` (the default), the ``base_dir`` path specified in the DISDRODB active configuration will be used. """ - # ---------------------------------------------------------------------. t_i = time.time() msg = f"L0 processing of station {station_name} has started." diff --git a/disdrodb/l0/scripts/disdrodb_run_l0.py b/disdrodb/l0/scripts/disdrodb_run_l0.py index f7908ba6..5d035f9a 100644 --- a/disdrodb/l0/scripts/disdrodb_run_l0.py +++ b/disdrodb/l0/scripts/disdrodb_run_l0.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -----------------------------------------------------------------------------. +"""Script to run the DISDRODB L0 processing.""" import sys from typing import Optional @@ -61,7 +62,6 @@ def disdrodb_run_l0( Parameters ---------- - base_dir : str Base directory of DISDRODB Format: <...>/DISDRODB diff --git a/disdrodb/l0/scripts/disdrodb_run_l0_station.py b/disdrodb/l0/scripts/disdrodb_run_l0_station.py index 99cfa6d7..a197f9fb 100644 --- a/disdrodb/l0/scripts/disdrodb_run_l0_station.py +++ b/disdrodb/l0/scripts/disdrodb_run_l0_station.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -----------------------------------------------------------------------------. +"""Script to run the DISDRODB L0 station processing.""" import sys from typing import Optional @@ -58,7 +59,7 @@ def disdrodb_run_l0_station( debugging_mode: bool = False, base_dir: Optional[str] = None, ): - """Run the L0 processing of a specific DISDRODB station from the terminal. + r"""Run the L0 processing of a specific DISDRODB station from the terminal. Parameters \n ---------- \n diff --git a/disdrodb/l0/scripts/disdrodb_run_l0a.py b/disdrodb/l0/scripts/disdrodb_run_l0a.py index c81c221d..5e8121de 100644 --- a/disdrodb/l0/scripts/disdrodb_run_l0a.py +++ b/disdrodb/l0/scripts/disdrodb_run_l0a.py @@ -15,6 +15,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -----------------------------------------------------------------------------. +"""Script to run the DISDRODB L0A processing.""" import sys from typing import Optional @@ -54,7 +55,6 @@ def disdrodb_run_l0a( Parameters ---------- - data_sources : str Name of data source(s) to process. The name(s) must be UPPER CASE. diff --git a/disdrodb/l0/scripts/disdrodb_run_l0a_station.py b/disdrodb/l0/scripts/disdrodb_run_l0a_station.py index b92a99ea..4f160a06 100644 --- a/disdrodb/l0/scripts/disdrodb_run_l0a_station.py +++ b/disdrodb/l0/scripts/disdrodb_run_l0a_station.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -----------------------------------------------------------------------------. +"""Script to run the DISDRODB L0A station processing.""" import sys from typing import Optional diff --git a/disdrodb/l0/scripts/disdrodb_run_l0b.py b/disdrodb/l0/scripts/disdrodb_run_l0b.py index d9b88b2c..836cc599 100644 --- a/disdrodb/l0/scripts/disdrodb_run_l0b.py +++ b/disdrodb/l0/scripts/disdrodb_run_l0b.py @@ -15,6 +15,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -----------------------------------------------------------------------------. +"""Script to run the DISDRODB L0B processing.""" import sys from typing import Optional @@ -57,7 +58,6 @@ def disdrodb_run_l0b( Parameters ---------- - data_sources : str Name of data source(s) to process. The name(s) must be UPPER CASE. diff --git a/disdrodb/l0/scripts/disdrodb_run_l0b_concat.py b/disdrodb/l0/scripts/disdrodb_run_l0b_concat.py index a7feee1d..46199e54 100644 --- a/disdrodb/l0/scripts/disdrodb_run_l0b_concat.py +++ b/disdrodb/l0/scripts/disdrodb_run_l0b_concat.py @@ -14,9 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -----------------------------------------------------------------------------. -################################################## -## Wrapper to concat L0B files by command lines ## -################################################## +"""Script to concatenate the DISDRODB L0B files.""" import sys from typing import Optional @@ -51,7 +49,6 @@ def disdrodb_run_l0b_concat( Parameters ---------- - data_sources : str Name of data source(s) to process. The name(s) must be UPPER CASE. diff --git a/disdrodb/l0/scripts/disdrodb_run_l0b_concat_station.py b/disdrodb/l0/scripts/disdrodb_run_l0b_concat_station.py index a6b7b883..8da14e10 100644 --- a/disdrodb/l0/scripts/disdrodb_run_l0b_concat_station.py +++ b/disdrodb/l0/scripts/disdrodb_run_l0b_concat_station.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -----------------------------------------------------------------------------. +"""Script to concatenate the DISDRODB L0B station files.""" ################################################## ## Wrapper to concat L0B files by command lines ## ################################################## @@ -50,7 +51,6 @@ def disdrodb_run_l0b_concat_station( Parameters ---------- - data_source : str Institution name (when campaign data spans more than 1 country), or country (when all campaigns (or sensor networks) are inside a given country). diff --git a/disdrodb/l0/scripts/disdrodb_run_l0b_station.py b/disdrodb/l0/scripts/disdrodb_run_l0b_station.py index d816c2bb..49462911 100644 --- a/disdrodb/l0/scripts/disdrodb_run_l0b_station.py +++ b/disdrodb/l0/scripts/disdrodb_run_l0b_station.py @@ -14,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -----------------------------------------------------------------------------. +"""Script to run the DISDRODB L0B station processing.""" import sys from typing import Optional @@ -54,7 +55,6 @@ def disdrodb_run_l0b_station( Parameters ---------- - data_source : str Institution name (when campaign data spans more than 1 country), or country (when all campaigns (or sensor networks) are inside a given country). diff --git a/disdrodb/l0/standards.py b/disdrodb/l0/standards.py index e5952191..fb163f3f 100644 --- a/disdrodb/l0/standards.py +++ b/disdrodb/l0/standards.py @@ -59,7 +59,6 @@ def get_data_format_dict(sensor_name: str) -> dict: dict Data format of each sensor variable. """ - return read_config_file(sensor_name=sensor_name, product="L0A", filename="raw_data_format.yml") @@ -76,7 +75,6 @@ def get_sensor_logged_variables(sensor_name: str) -> list: list List of the variables logged by the sensor. """ - return list(get_data_format_dict(sensor_name).keys()) @@ -94,7 +92,6 @@ def get_data_range_dict(sensor_name: str) -> dict: Dictionary with the expected data value range for each data field. It excludes variables without specified data_range key. """ - data_format_dict = get_data_format_dict(sensor_name) dict_data_range = {} for k in data_format_dict: @@ -118,7 +115,6 @@ def get_nan_flags_dict(sensor_name: str) -> dict: Dictionary with the expected nan_flags list for each data field. It excludes variables without specified nan_flags key. """ - data_format_dict = get_data_format_dict(sensor_name) dict_nan_flags = {} for k in data_format_dict: @@ -168,7 +164,6 @@ def get_field_ndigits_natural_dict(sensor_name: str) -> dict: dict Dictionary with the expected number of natural digits for each data field. """ - data_dict = get_data_format_dict(sensor_name) d = {k: v["n_naturals"] for k, v in data_dict.items()} return d @@ -189,7 +184,6 @@ def get_field_ndigits_decimals_dict(sensor_name: dict) -> dict: dict Dictionary with the expected number of decimal digits for each data field. """ - data_dict = get_data_format_dict(sensor_name) d = {k: v["n_decimals"] for k, v in data_dict.items()} return d @@ -205,12 +199,12 @@ def get_field_ndigits_dict(sensor_name: str) -> dict: ---------- sensor_name : str Name of the sensor. + Returns ------- dict Dictionary with the expected number of digits for each data field. """ - data_dict = get_data_format_dict(sensor_name) d = {k: v["n_digits"] for k, v in data_dict.items()} return d @@ -232,7 +226,6 @@ def get_field_nchar_dict(sensor_name: str) -> dict: dict Dictionary with the expected number of characters for each data field. """ - data_dict = get_data_format_dict(sensor_name) d = {k: v["n_characters"] for k, v in data_dict.items()} return d @@ -568,7 +561,6 @@ def get_velocity_bin_upper(sensor_name: str) -> list: list Velocity bin upper bound. """ - velocity_dict = get_velocity_bins_dict(sensor_name) if velocity_dict is not None: upper_bounds = [v[1] for v in velocity_dict["bounds"].values()] @@ -590,7 +582,6 @@ def get_velocity_bin_width(sensor_name: str) -> list: list Velocity bin width. """ - velocity_dict = get_velocity_bins_dict(sensor_name) if velocity_dict is not None: velocity_bin_width = list(velocity_dict["width"].values()) @@ -612,7 +603,6 @@ def get_bin_coords_dict(sensor_name: str) -> dict: dict Dictionary with coordinates arrays. """ - check_sensor_name(sensor_name=sensor_name) coords = {} # Retrieve diameter coords @@ -683,7 +673,6 @@ def get_l0a_dtype(sensor_name: str) -> dict: dict Dictionary with the L0A dtype. """ - # Note: This function could extract the info from l0a_encodings in future. d = read_config_file(sensor_name=sensor_name, product="L0A", filename="l0a_encodings.yml") return d @@ -702,7 +691,6 @@ def get_l0a_encodings_dict(sensor_name: str) -> dict: dict L0A encodings. """ - # - l0a_encodings.yml currently specify only the dtype. This could be expanded in the future. d = read_config_file(sensor_name=sensor_name, product="L0A", filename="l0a_encodings.yml") return d @@ -822,7 +810,8 @@ def get_raw_array_dims_order(sensor_name: str) -> dict: The order of dimension specified for raw_drop_number controls the reshaping of the precipitation raw spectrum. - Examples: + Examples + -------- OTT Parsivel spectrum [v1d1 ... v1d32, v2d1, ..., v2d32] --> dimension_order = ["velocity_bin_center", "diameter_bin_center"] Thies LPM spectrum [v1d1 ... v20d1, v1d2, ..., v20d2] diff --git a/disdrodb/l0/template_tools.py b/disdrodb/l0/template_tools.py index 33ad92f2..019deb6f 100644 --- a/disdrodb/l0/template_tools.py +++ b/disdrodb/l0/template_tools.py @@ -102,7 +102,7 @@ def _print_value(value): def print_df_with_any_nan_rows(df: pd.DataFrame) -> None: - """Print empty rows + """Print empty rows. Parameters ---------- @@ -137,7 +137,7 @@ def print_df_first_n_rows(df: pd.DataFrame, n: int = 5, print_column_names: bool def print_df_random_n_rows(df: pd.DataFrame, n: int = 5, print_column_names: bool = True) -> None: - """Print the content of the dataframe by column, randomly chosen + """Print the content of the dataframe by column, randomly chosen. Parameters ---------- @@ -215,7 +215,7 @@ def print_df_columns_unique_values( column_indices: Optional[Union[int, slice, list]] = None, print_column_names: bool = True, ) -> None: - """Print columns' unique values + """Print columns' unique values. Parameters ---------- @@ -243,7 +243,7 @@ def get_df_columns_unique_values_dict( column_indices: Optional[Union[int, slice, list]] = None, column_names: bool = True, ): - """Create a dictionary {column: unique values} + """Create a dictionary {column: unique values}. Parameters ---------- @@ -282,7 +282,6 @@ def str_is_number(string: str) -> bool: bool ``True`` if float. """ - try: float(string) return True @@ -380,7 +379,6 @@ def get_ndigits(string: str) -> int: int The number of total digits. """ - if not str_is_number(string): return 0 string = string.replace("-", "") @@ -443,7 +441,6 @@ def _get_possible_keys(dict_options: dict, desired_value: str) -> set: set Keys that the value matches the desired input value. """ - list_key_match = [] for k, v in dict_options.items(): if v == desired_value: @@ -542,7 +539,6 @@ def check_column_names(column_names: list, sensor_name: str) -> None: TypeError Error if some columns do not meet the DISDRODB standards. """ - if not isinstance(column_names, list): raise TypeError("'column_names' must be a list of strings.") # Get valid columns diff --git a/disdrodb/metadata/checks.py b/disdrodb/metadata/checks.py index 0dc05f40..fc03930b 100644 --- a/disdrodb/metadata/checks.py +++ b/disdrodb/metadata/checks.py @@ -70,7 +70,7 @@ def _check_metadata_keys(metadata): def _check_metadata_values(metadata): - """Check validity of metadata values + """Check validity of metadata values. If null is specified in the YAML files (or None in the dict) raise error. """ @@ -222,7 +222,6 @@ def identify_empty_metadata_keys(metadata_filepaths: list, keys: Union[str, list keys : Union[str,list] Attributes to verify the presence. """ - if isinstance(keys, str): keys = [keys] diff --git a/disdrodb/metadata/scripts/disdrodb_check_metadata_archive.py b/disdrodb/metadata/scripts/disdrodb_check_metadata_archive.py index be3d2c11..d3ad0d06 100644 --- a/disdrodb/metadata/scripts/disdrodb_check_metadata_archive.py +++ b/disdrodb/metadata/scripts/disdrodb_check_metadata_archive.py @@ -34,6 +34,7 @@ help="Whether to raise error of finish the check", ) def disdrodb_check_metadata_archive(base_dir=None, raise_error=True): + """Run the DISDRODB Metadata Archive Checks.""" from disdrodb.metadata.checks import check_archive_metadata_compliance base_dir = parse_base_dir(base_dir) diff --git a/disdrodb/metadata/search.py b/disdrodb/metadata/search.py index 1a28cedb..f6d3c960 100644 --- a/disdrodb/metadata/search.py +++ b/disdrodb/metadata/search.py @@ -162,6 +162,7 @@ def _get_list_metadata_with_data(base_dir, data_sources=None, campaign_names=Non station_names : str or list of str Station names of interest. The default is ``None``. + Returns ------- metadata_filepaths: list @@ -177,7 +178,6 @@ def _get_list_metadata_with_data(base_dir, data_sources=None, campaign_names=Non product="RAW", data_sources=data_sources, campaign_names=campaign_names, - station_names=station_names, ) # If no stations available, raise an error diff --git a/disdrodb/tests/__init__.py b/disdrodb/tests/__init__.py index 757855fd..9533c264 100644 --- a/disdrodb/tests/__init__.py +++ b/disdrodb/tests/__init__.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 """ -Created on Thu Nov 2 12:07:33 2023 +Created on Thu Nov 2 12:07:33 2023. @author: ghiggi """ diff --git a/disdrodb/tests/conftest.py b/disdrodb/tests/conftest.py index 5edfa2a4..97e28bed 100644 --- a/disdrodb/tests/conftest.py +++ b/disdrodb/tests/conftest.py @@ -169,7 +169,6 @@ def create_test_config_files(request): # noqa PT004 for the configuration files to be created. """ - config_dicts = request.param for filename, dictionary in config_dicts.items(): config_dir = os.path.join(__root_path__, "disdrodb", "l0", "configs") diff --git a/disdrodb/tests/test_api/test_api_info.py b/disdrodb/tests/test_api/test_api_info.py index 48c165fe..a9284e1b 100644 --- a/disdrodb/tests/test_api/test_api_info.py +++ b/disdrodb/tests/test_api/test_api_info.py @@ -85,7 +85,7 @@ def invalid_filepath(tmp_path): def test_infer_disdrodb_tree_path_components(): - """Test retrieve correct disdrodb path components""" + """Test retrieve correct disdrodb path components.""" base_dir = os.path.join("whatever_path", "DISDRODB") data_source = "DATA_SOURCE" campaign_name = "CAMPAIGN_NAME" diff --git a/disdrodb/tests/test_data_transfer/test_upload_data.py b/disdrodb/tests/test_data_transfer/test_upload_data.py index 5e3dcfc2..7386b55c 100644 --- a/disdrodb/tests/test_data_transfer/test_upload_data.py +++ b/disdrodb/tests/test_data_transfer/test_upload_data.py @@ -35,7 +35,6 @@ def test_wrong_http_response(requests_mock): """Test wrong response from Zenodo API.""" - requests_mock.post("https://sandbox.zenodo.org/api/deposit/depositions", json={}, status_code=404) with pytest.raises(ValueError): _create_zenodo_deposition(sandbox=True) diff --git a/disdrodb/tests/test_l0/test_cmd_processing.py b/disdrodb/tests/test_l0/test_cmd_processing.py index 89c51262..759edd27 100644 --- a/disdrodb/tests/test_l0/test_cmd_processing.py +++ b/disdrodb/tests/test_l0/test_cmd_processing.py @@ -208,7 +208,6 @@ def test_disdrodb_run_l0(tmp_path, remove_l0a, remove_l0b, l0b_concat): @pytest.mark.parametrize("verbose", [True, False]) def test_disdrodb_run_l0_nc_station(tmp_path, verbose, parallel): """Test the disdrodb_run_l0_station process correctly raw netCDF files.""" - BASE_DIR = os.path.join(__root_path__, "disdrodb", "tests", "data", "check_readers", "DISDRODB") DATA_SOURCE = "UK" CAMPAIGN_NAME = "DIVEN" diff --git a/disdrodb/tests/test_l0/test_config_files.py b/disdrodb/tests/test_l0/test_config_files.py index 8ac8496a..62314b38 100644 --- a/disdrodb/tests/test_l0/test_config_files.py +++ b/disdrodb/tests/test_l0/test_config_files.py @@ -64,7 +64,6 @@ def is_dict(obj) -> bool: result: bool True if object is a dictionary, False if not. """ - return isinstance(obj, dict) @@ -86,7 +85,6 @@ def is_sorted_int_keys(obj: list) -> bool: result: bool True if list contains only sorted integers keys, False if not. """ - if isinstance(obj, list): if len(obj) == 0: return True @@ -151,7 +149,6 @@ def validate_schema_pytest(schema_to_validate: Union[str, list], schema: BaseMod result: bool True is schema correct, False is wrong. """ - try: schema(**schema_to_validate) return True diff --git a/disdrodb/tests/test_utils/test_utils_compression.py b/disdrodb/tests/test_utils/test_utils_compression.py index b77379a7..e53a39d3 100644 --- a/disdrodb/tests/test_utils/test_utils_compression.py +++ b/disdrodb/tests/test_utils/test_utils_compression.py @@ -36,7 +36,6 @@ def create_fake_data_dir(base_dir, data_source, campaign_name, station_name): |-- Jan |-- file2.txt """ - data_dir = base_dir / "Raw" / data_source / campaign_name / "data" / station_name dir1 = data_dir / "2020" dir2 = dir1 / "Jan" @@ -52,7 +51,6 @@ def create_fake_data_dir(base_dir, data_source, campaign_name, station_name): @pytest.mark.parametrize("method", ["zip", "gzip", "bzip2"]) def test_files_compression(tmp_path, method): """Test compression of files in a directory.""" - base_dir = tmp_path / "DISDRODB" data_source = "test_data_source" campaign_name = "test_campaign_name" diff --git a/disdrodb/utils/compression.py b/disdrodb/utils/compression.py index dd085db8..32d3069c 100644 --- a/disdrodb/utils/compression.py +++ b/disdrodb/utils/compression.py @@ -47,7 +47,6 @@ def unzip_file(filepath: str, dest_path: str) -> None: dest_path : str Path of the destination directory. """ - with zipfile.ZipFile(filepath, "r") as zip_ref: zip_ref.extractall(dest_path) @@ -65,7 +64,6 @@ def _zip_dir(dir_path: str) -> str: str Path of the zip archive. """ - output_path_without_extension = os.path.join(tempfile.gettempdir(), os.path.basename(dir_path)) output_path = output_path_without_extension + ".zip" shutil.make_archive(output_path_without_extension, "zip", dir_path) @@ -228,7 +226,6 @@ def _compress_file_zip(filepath: str, compressed_filepath: str) -> None: Path of the compressed file. """ - with zipfile.ZipFile(compressed_filepath, "w", compression=zipfile.ZIP_DEFLATED) as zipf: zipf.write(filepath, os.path.basename(filepath)) @@ -245,7 +242,6 @@ def _compress_file_gzip(filepath: str, compressed_filepath: str) -> None: Path of the compressed file. """ - with open(filepath, "rb") as f_in, gzip.open(compressed_filepath, "wb") as f_out: f_out.writelines(f_in) @@ -262,6 +258,5 @@ def _compress_file_bzip2(filepath: str, compressed_filepath: str) -> None: Path of the compressed file. """ - with open(filepath, "rb") as f_in, bz2.open(compressed_filepath, "wb") as f_out: f_out.writelines(f_in) diff --git a/disdrodb/utils/directories.py b/disdrodb/utils/directories.py index c1a179dd..8eba18b6 100644 --- a/disdrodb/utils/directories.py +++ b/disdrodb/utils/directories.py @@ -182,7 +182,7 @@ def copy_file(src_filepath, dst_filepath): def remove_path_trailing_slash(path: str) -> str: - """ + r""" Removes a trailing slash or backslash from a file path if it exists. This function ensures that the provided file path is normalized by removing diff --git a/disdrodb/utils/logger.py b/disdrodb/utils/logger.py index 4bc91292..0ed99fb8 100644 --- a/disdrodb/utils/logger.py +++ b/disdrodb/utils/logger.py @@ -48,7 +48,7 @@ def create_file_logger(processed_dir, product, station_name, filename, parallel) def close_logger(logger: logger) -> None: - """Close the logger + """Close the logger. Parameters ---------- diff --git a/disdrodb/utils/netcdf.py b/disdrodb/utils/netcdf.py index 54c16b23..d001576c 100644 --- a/disdrodb/utils/netcdf.py +++ b/disdrodb/utils/netcdf.py @@ -169,7 +169,6 @@ def _remove_dataset_bad_values(list_ds, filepaths, dict_ds_bad_idx, dim): Returns ------- - list_ds : list List of xarray Dataset without bad values. """ @@ -434,7 +433,6 @@ def xr_concat_datasets(filepaths: str, verbose=False) -> xr.Dataset: Error if the merging/concatenation operations can not be achieved. """ - # --------------------------------------. # Open xr.Dataset lazily in parallel using dask delayed list_ds = get_list_ds(filepaths) diff --git a/disdrodb/utils/pandas.py b/disdrodb/utils/pandas.py index 99de719e..2d6dbc1c 100644 --- a/disdrodb/utils/pandas.py +++ b/disdrodb/utils/pandas.py @@ -35,7 +35,6 @@ def get_dataframe_start_end_time(df: pd.DataFrame): (``starting_time``, ``ending_time``) """ - starting_time = df["time"].iloc[0] ending_time = df["time"].iloc[-1] return (starting_time, ending_time) diff --git a/disdrodb/utils/scripts.py b/disdrodb/utils/scripts.py index c8ea2273..86d35924 100644 --- a/disdrodb/utils/scripts.py +++ b/disdrodb/utils/scripts.py @@ -36,6 +36,7 @@ def _execute_cmd(cmd, raise_error=False): def _parse_empty_string_and_none(args): """Utility to parse argument passed from the command line. + If ``args = ''``, returns None. If ``args = 'None'`` returns None. Otherwise return ``args``. @@ -69,6 +70,7 @@ def parse_arg_to_list(args): def parse_base_dir(base_dir): """Utility to parse base_dir provided by command line. + If ``base_dir = 'None'`` returns ``None``. If ``base_dir = ''`` returns ``None``. """ @@ -91,6 +93,13 @@ def click_station_arguments(function: object): def click_base_dir_option(function: object): + """Click command line argument for DISDRODB ``base_dir``. + + Parameters + ---------- + function : object + Function. + """ function = click.option( "--base_dir", type=str, diff --git a/pyproject.toml b/pyproject.toml index 4f3fc5b1..e21a6945 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -138,7 +138,7 @@ docstring-code-format = true select = [ # pydocstyle - # "D", + "D", # Pyflakes "F", # pycodestyle @@ -222,6 +222,12 @@ convention = "numpy" "ARG", # avoid problems with fixtures "D100", "D101","D102", "D103", "D104", "D105", # Missing docstrings ] +"disdrodb/l0/readers/*.py" = [ + "D100", # "D103", +] +"conftest.py" = [ + "D100", "D101","D102", "D103", "D104", "D105", +] "setup.py" = ["D100"] "*__init__.py" = ["D104"]