Skip to content

Commit

Permalink
refactor() : update doc (#184)
Browse files Browse the repository at this point in the history
  • Loading branch information
regislon authored May 8, 2023
1 parent 76da654 commit 2960369
Show file tree
Hide file tree
Showing 7 changed files with 80 additions and 141 deletions.
13 changes: 12 additions & 1 deletion disdrodb/l0/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -946,7 +946,18 @@ def _check_pre_existing_station_data(campaign_dir, product_level, station_name,


def check_processed_dir(processed_dir):
# Check input, format and validity of the directory path
"""Check input, format and validity of the directory path
Parameters
----------
processed_dir : str
Path of the processed directory
Returns
-------
str
Path of the processed directory
"""
processed_dir = _check_is_processed_dir(processed_dir)
return processed_dir

Expand Down
40 changes: 38 additions & 2 deletions disdrodb/l0/issue.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,53 @@


def is_numpy_array_string(arr):
"""Check if the numpy array contains strings."""
"""Check if the numpy array contains strings
Parameters
----------
arr : numpy array
Numpy array to check.
"""

dtype = arr.dtype.type
return dtype == np.str_ or dtype == np.unicode_


def is_numpy_array_datetime(arr):
"""Check if the numpy array contains datetime64
Parameters
----------
arr : numpy array
Numpy array to check.
Returns
-------
numpy array
Numpy array checked.
"""
return arr.dtype.type == np.datetime64


def _check_timestep_datetime_accuracy(timesteps, unit="s"):
"""Check the accuracy of the numpy datetime array."""
"""Check the accuracy of the numpy datetime array.
Parameters
----------
timesteps : numpy array
Numpy array to check.
unit : str, optional
Unit, by default "s"
Returns
-------
numpy array
Numpy array checked.
Raises
------
ValueError
"""
if not timesteps.dtype == f"<M8[{unit}]":
msg = f"The timesteps does not have datetime64 {unit} accuracy."
log_error(logger, msg=msg, verbose=False)
Expand Down
2 changes: 2 additions & 0 deletions disdrodb/l0/l0_processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ def _generate_l0a(
parallel,
issue_dict={},
):
"""Generate L0A file from raw file."""

from disdrodb.l0.io import get_L0A_fpath
from disdrodb.l0.l0a_processing import (
process_raw_file,
Expand Down
8 changes: 8 additions & 0 deletions docs/source/api/disdrodb.l0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@ disdrodb.l0.check\_metadata module
:undoc-members:
:show-inheritance:

disdrodb.l0.check\_readers module
---------------------------------

.. automodule:: disdrodb.l0.check_readers
:members:
:undoc-members:
:show-inheritance:

disdrodb.l0.check\_standards module
-----------------------------------

Expand Down
29 changes: 15 additions & 14 deletions docs/source/metadata.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,21 @@ There are 7 metadata keys for which is mandatory to specify the value :
to process the data, you specify the reader name ``GPM/IFLOODS``.




To check the validity of the metadata YAML files, run the following code:

.. code-block:: python
from disdrodb.l0 import check_archive_metadata_compliance, check_archive_metadata_geolocation
disdrodb_dir = "<...>/DISDRODB"
check_archive_metadata_compliance(disdrodb_dir)
check_archive_metadata_geolocation(disdrodb_dir)
The list of the standard metadata keys and their description is provided here below:


Expand Down Expand Up @@ -70,17 +85,3 @@ The list of the standard metadata keys and their description is provided here be
:file: ./metadata_csv/Data_Attribution.csv
:widths: auto
:header-rows: 1





To check the validity of the metadata YAML files, run the following code:

.. code-block:: python
from disdrodb.l0 import check_archive_metadata_compliance, check_archive_metadata_geolocation
disdrodb_dir = "<...>/DISDRODB"
check_archive_metadata_compliance(disdrodb_dir)
check_archive_metadata_geolocation(disdrodb_dir)
119 changes: 0 additions & 119 deletions docs/source/overview.rst
Original file line number Diff line number Diff line change
Expand Up @@ -74,122 +74,3 @@ The current software structure is described below:
| πŸ“œ README.md
| πŸ“œ readthedocs.yml
| πŸ“œ requirements.txt



Description of the disdrodb files and folders
================================================

The disdrodb folder contains the core software to process raw data files to DISDRODB L0 products. Here is a description of the files and folders:

+-------+------------------------------------+--------------------------------------------------------------------------------------------------------------+
| Type | Folder / files name | Description |
+=======+====================================+==============================================================================================================+
| πŸ“ | api | Contains some generic functions |
+-------+------------------------------------+--------------------------------------------------------------------------------------------------------------+
| πŸ“œ | checks.py | Basic checks on paths |
+-------+------------------------------------+--------------------------------------------------------------------------------------------------------------+
| πŸ“œ | info.py | DISDRODB File Information and parser |
+-------+------------------------------------+--------------------------------------------------------------------------------------------------------------+
| πŸ“œ | io.py | Input output fuctions |
+-------+------------------------------------+--------------------------------------------------------------------------------------------------------------+
| πŸ“œ | metadata.py | Operation on metadata stations files |
+-------+------------------------------------+--------------------------------------------------------------------------------------------------------------+
| πŸ“ | data_transfer | Contains scripts to upload or download stations's data |
+-------+------------------------------------+--------------------------------------------------------------------------------------------------------------+
| πŸ“œ | download_data.py | Functions to download stations' raw data |
+-------+------------------------------------+--------------------------------------------------------------------------------------------------------------+
| πŸ“œ | upload_data.py | Functions to upload to Zenodo stations' raw data |
+-------+------------------------------------+--------------------------------------------------------------------------------------------------------------+
| πŸ“ | l0 | Contains the software to produce the DISDRODB L0 products |
+-------+------------------------------------+--------------------------------------------------------------------------------------------------------------+
| πŸ“œ | check_configs.py | Contain functionsChecking the sensorConfigs YAML files |
+-------+------------------------------------+--------------------------------------------------------------------------------------------------------------+
| πŸ“œ | check_metadata.py | Contain functionsChecking the metadata YAML files |
+-------+------------------------------------+--------------------------------------------------------------------------------------------------------------+
| πŸ“œ | check_standards.py | Contain functionsChecking that DISDRODB standards are met |
+-------+------------------------------------+--------------------------------------------------------------------------------------------------------------+
| πŸ“œ | io.py | Core functions to read/write files andCreate/remove directories |
+-------+------------------------------------+--------------------------------------------------------------------------------------------------------------+
| πŸ“œ | issue.py | Code to manage the issues YAML files and exclude erroneous time steps during L0 processing |
+-------+------------------------------------+--------------------------------------------------------------------------------------------------------------+
| πŸ“œ | l0_processing.py | Contain the functions to process raw data files to L0A and L0B |
+-------+------------------------------------+--------------------------------------------------------------------------------------------------------------+
| πŸ“œ | l0_reader.py | Contain the functions to check and retrieve the DISDRODB readers |
+-------+------------------------------------+--------------------------------------------------------------------------------------------------------------+
| πŸ“œ | l0a_processing.py | Contain the functions to process raw data files to L0A format (Parquet) |
+-------+------------------------------------+--------------------------------------------------------------------------------------------------------------+
| πŸ“œ | l0b_concat.py | Contain the functions to concatenate multiple L0B files into a single L0B netCDF |
+-------+------------------------------------+--------------------------------------------------------------------------------------------------------------+
| πŸ“œ | l0b_processing.py | Contain the functions to process raw data files to L0B format (netCDF4) |
+-------+------------------------------------+--------------------------------------------------------------------------------------------------------------+
| πŸ“œ | l0b_processing.py | Contain the functions to run the DISDRODB L0 processing |
+-------+------------------------------------+--------------------------------------------------------------------------------------------------------------+
| πŸ“œ | metadata.py | Code to read/write the metadata YAML files |
+-------+------------------------------------+--------------------------------------------------------------------------------------------------------------+
| πŸ“œ | standards.py | Contain the functions to encode the L0 sensor specifications defined in L0.configs |
+-------+------------------------------------+--------------------------------------------------------------------------------------------------------------+
| πŸ“œ | summary.py | Contain the functions to define a summary for each station |
+-------+------------------------------------+--------------------------------------------------------------------------------------------------------------+
| πŸ“œ | template_tools.py | Helpers to Create DISDRODB readers |
+-------+------------------------------------+--------------------------------------------------------------------------------------------------------------+
| πŸ“ | configs | Contains the specifications of various types of disdrometers |
+-------+------------------------------------+--------------------------------------------------------------------------------------------------------------+
| πŸ“ | <sensor_name> | Name of the sensor (e.g. OTT_Parsivel, OTT_Parsivel2, Thies_LPM, RD_80) |
+-------+------------------------------------+--------------------------------------------------------------------------------------------------------------+
| πŸ“œ | *.yml | YAML files defining sensorCharacteristics (e.g. diameter and velocity bins) |
+-------+------------------------------------+--------------------------------------------------------------------------------------------------------------+
| πŸ“ | manuals | Folder for the Official disdrometers documentation |
+-------+------------------------------------+--------------------------------------------------------------------------------------------------------------+
| πŸ“œ | *.pdf | Official disdrometers documentation |
+-------+------------------------------------+--------------------------------------------------------------------------------------------------------------+
| πŸ“ | readers | Folder that contains all the readers functions |
+-------+------------------------------------+--------------------------------------------------------------------------------------------------------------+
| πŸ“ | <data_source> | e.g. GPM, ARM, EPFL, ... |
+-------+------------------------------------+--------------------------------------------------------------------------------------------------------------+
| πŸ“œ | <reader_name>.py | Readers to transform raw data into DISDRODB L0 products |
+-------+------------------------------------+--------------------------------------------------------------------------------------------------------------+
| πŸ“ | scripts | Contains a set of python scripts to beCalled from the terminal to launch the L0 processing |
+-------+------------------------------------+--------------------------------------------------------------------------------------------------------------+
| πŸ“œ | run_disdrodb_l0_station.py | Script launching the L0 processing for a specific station |
+-------+------------------------------------+--------------------------------------------------------------------------------------------------------------+
| πŸ“œ | run_disdrodb_l0 | Script launching the L0 processing for specific portion of the DISDRODB archive |
+-------+------------------------------------+--------------------------------------------------------------------------------------------------------------+
| πŸ“œ | run_disdrodb_l0a.py | Script to run the L0A processing of DISDRODB stations |
+-------+------------------------------------+--------------------------------------------------------------------------------------------------------------+
| πŸ“œ | run_disdrodb_l0a_station.py | Script to run the L0A processing of a specific DISDRODB station from the terminal |
+-------+------------------------------------+--------------------------------------------------------------------------------------------------------------+
| πŸ“œ | run_disdrodb_l0b.py | Script to run the L0B processing of DISDRODB stations |
+-------+------------------------------------+--------------------------------------------------------------------------------------------------------------+
| πŸ“œ | run_disdrodb_l0b_station.py | Script to run the L0B processing of a specific DISDRODB station from the terminal |
+-------+------------------------------------+--------------------------------------------------------------------------------------------------------------+
| πŸ“œ | run_disdrodb_l0b_concat.py | Script to run the L0BConcatenation of available DISDRODB stations |
+-------+------------------------------------+--------------------------------------------------------------------------------------------------------------+
| πŸ“œ | run_disdrodb_l0b_concat_station.py | Script toConcatenate all L0B files of a specific DISDRODB station into a single netCDF |
+-------+------------------------------------+--------------------------------------------------------------------------------------------------------------+
| πŸ“ | l1 | Code not yet implemented. It willContain software to homogenize and qualityCheck DISDRODB L0 products |
+-------+------------------------------------+--------------------------------------------------------------------------------------------------------------+
| πŸ“ | l2 | Code not yet implemented. It willContain software to produce DISDRODB L2 products (i.e. DSD parameters, ...) |
+-------+------------------------------------+--------------------------------------------------------------------------------------------------------------+
| πŸ“ | tests | Folder containing the tests (readers and unit tests) |
+-------+------------------------------------+--------------------------------------------------------------------------------------------------------------+
| πŸ“ | utils | Folder to gather small, reusable functions orClasses |
+-------+------------------------------------+--------------------------------------------------------------------------------------------------------------+
| πŸ“œ | logger.py | Logger functions |
+-------+------------------------------------+--------------------------------------------------------------------------------------------------------------+
| πŸ“œ | scripts.py | Utility functions to run python scripts into the terminal |
+-------+------------------------------------+--------------------------------------------------------------------------------------------------------------+
| πŸ“œ | netcdf.py | Utility function toCheck and merge/concat multiple netCDF4 files |
+-------+------------------------------------+--------------------------------------------------------------------------------------------------------------+



Description of the other folders
================================================

Some other folder are included in the DISDRODB repository. Here is a short description of their content:

* data : sample data to test the DISDRODB L0 l0_processing
* docs : documentation of the DISDRODB L0 processing
* tutorials : Jupyter notebooks to illustrate the DISDRODB L0 processing
Loading

0 comments on commit 2960369

Please sign in to comment.