Skip to content
Snippets Groups Projects
Commit da3bcc06 authored by Niklas Selke's avatar Niklas Selke
Browse files

Added a 'CHANGELOG.md' and a 'LICENSE' file. Modified the 'README.md' and...

Added a 'CHANGELOG.md' and a 'LICENSE' file. Modified the 'README.md' and added files for packaging. Created package version 0.1.0.
parent 0b9724de
No related branches found
No related tags found
No related merge requests found
# Ignore compiled files
*.pyc
# Ignore package build directory
/toarstats.egg-info/
# Changelog
All notable changes to this project will be documented in this file.
## v0.1.0 - 2021-09-05 - first experimental release of the package
### general:
* first working version is implemented
* 50 statistics and metrics are included
LICENSE 0 → 100644
MIT License
Copyright (c) 2021 Forschungszentrum Jülich GmbH
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
......@@ -5,23 +5,94 @@ calculated on **hourly** data. The statistics in the `ozone_metrics.py`
file are specific to ozone data. The statistics in the `stats.py` file
can be calculated for other variables as well.
To use this functionality import `toarstats` with:
## Installation
To install the package in a specific version and all dependencies run
the following command from within the `dist` folder of this repository:
```
from toarstats import toarstats
python3 -m pip install toarstats-<version>-py3-none-any.whl
```
It is advised to set up a virtual environment beforehand.
## Usage
### Import
To use the package import `toarstats` with:
```
from toarstats import toarstats # or
from toarstats import * # or
import toarstats
```
### Interface
The `toarstats` interface is defined like this:
```
toarstats(sampling, statistics, data, metadata, seasons=None,
crops=None, data_capture=None)
"""Calculate the given statistics with the given sampling.
This function is the public interface for the toarstats package and
acts as a wrapper around all statistics and metrics included in the
package.
:param sampling: temporal aggregation, one of ``daily``,
``monthly``, ``seasonal``, ``vegseason``,
``summer``, ``xsummer``, or ``annual``;
``summer`` will pick the 6-months summer season in
the hemisphere where the station is located;
``xsummer`` does the same for a 7-months summer
season;
``vegseason`` requires also the crops argument and
will then determine the appropriate growing seasons
based on the ``climatic_zone`` metadata and crop
type
:param statistics: a list of statistics and metrics to call, these
must be defined in ``stats.py`` or
``ozone_metrics.py``;
a single string can also be given
:param data: a data frame with datetime values with hourly
resolution and a column with parameter values on which
to calculate the requested statistics and metrics
:param metadata: a named tuple with metadata information for
``station_lat``, ``station_lon``, and
``station_climatic_zone``
:param seasons: a list of season names for seasonal statistics;
for a definition of seasons, see ``stats_utils.py``;
if ``None`` is passed, seasonal statistics will be
computed for the default seasons of the respective
metrics, normally, these are the four meteorological
seasons ``DJF``, ``MAM``, ``JJA`` and ``SON``;
if sampling is set to ``summer`` or ``xsummer``, the
correct season will be determined based on the
``station_lat`` metadata;
if sampling is ``vegseason`` and the crops argument
is given, the appropriate growing seasons will be
selected based on the crop type and
``climatic_zone`` metadata;
the growing seasons for wheat and rice will also be
selected if sampling is ``seasonal`` and the chosen
metrics contains ``aot40`` or ``w126``
:param crops: a list of crop types for ``vegseason`` statistics;
default is ``["wheat", "rice"]``;
a single string can also be given
:param data_capture: a fractional value which will be used to
identify valid data periods;
the default is 0.75 for most statistics,
meaning that 75% of hourly values must be
present in a given interval in order to mark a
result as valid;
note that the ``value_count``, ``mean`` and
``standard_deviation`` statistics do not use
this capture criterion, ``value_count`` counts
all values, ``mean`` and ``standard_deviation``
are calculated when there are at least 10 valid
hourly values in an interval;
the fraction may not always be applied to
original hourly values, but could for example
also be used to count the number of valid days
for a ``monthly``, ``seasonal``, or ``annual``
statistic
"""
```
Arguments:<br>
sampling: temporal aggregation, e.g. 'daily', 'monthly', 'annual'<br>
statistics: a list of statistics which should be calculated, names must
be defined in `ozone_metrics.py` or `stats.py`<br>
data: a data frame containing the hourly data<br>
metadata: a named tuple containing the dataset metadata<br>
seasons: a list of season names for seasonal statistics<br>
crops: a list of crop types for 'vegseason' statistics<br>
data_capture: a fractional value which will be used to identify valid
data periods
File added
[build-system]
requires = [
"setuptools>=42",
"wheel"
]
build-backend = "setuptools.build_meta"
[metadata]
name = toarstats
version = 0.1.0
author = Niklas Selke
author_email = n.selke@fz-juelich.de
description = Collection of statistics for the TOAR community
long_description = file: README.md
long_description_content_type = text/markdown
url = https://gitlab.jsc.fz-juelich.de/esde/toar-public/toarstats
classifiers =
Programming Language :: Python :: 3
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
License :: OSI Approved :: MIT License
Operating System :: OS Independent
[options]
packages = toarstats
python_requires = >=3.6
install_requires =
pandas>=1.0
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment