TOAR Gridding Tool
====

# About 

The TOARgridding projects data from the TOAD database (https://toar-data.fz-juelich.de/) onto a grid. 
The mean and standard deviation of all stations within a cell are computed. 

The tool handles the request to the database over the REST API and the subsequent processing.
The results are provided as xarray objects for subsequent processing by the user.

This project is in beta with the intended basic functionalities. 
The documentation is work in progress.

# Requirements

TBD, see pyproject.toml

# Installation

Move to the folder you want to create download this project to.

Clone the project from its git repository
```
git clone https://gitlab.jsc.fz-juelich.de/esde/toar-public/toargridding.git 
```

The handling of required packages is done with poetry.
For installing them go to the new created directory and run poetry
```
cd toargridding
poetry install
```

# Example

There are at the moment three example provided as jupyter notebooks:
##  High level function
```
tests/produce_data.ipynb 
```
Provides an example on how to download data, apply gridding and save the results as netCDF files.
## Retrieving data
get_sample_data.ipynb 
Downloads data from the TOAR database. 
## Retriving data and visualization
```
quality_controll.ipynb
```
Notebook for downloading and visualization of data. 
The data are downloaded and reused for subsequent executions of this notebook.

# Supported Grids

The first supported grid is the Cartesian grid.

# Supported Variables

At the moment only a limited number of variables from the TOAR database is supported. 


# Documentation of Source Code:

At the moment Carsten Hinz is working on a documentation of the source code, while getting familiar with it.
The aim is a brief overview on the functionalities and the arguments. As he personally does not like repetitions, 
the documentations might not match other style guides. 
It will definitely be possible to extend the documentation:-)

```
class example:
    """An example class

    A more detailed explanation of the purpose of this example class.
    """

    def __init__(self, varA : int, varB : str):
        """Constructor

        Attributes:
        varA:
            brief details and more context
        varB:
            same here.
        """
        [implementation]    
    
    def func1(self, att1, att2):
        """Brief

        details

        Attributes:
        -----------
        att1:
            brief/details
        att2:
            brief/details
        """

        [implementation]
        
```

```
@dataclass
class dataClass:
    """Brief description

    optional details

    Parameters
    ----------
    anInt:
        brief description
    anStr:
        brief description
    secStr:
        brief description (explanation of default value, if this seems necessary)
    """
    anInt : int
    anStr : str
    secStr : str = "Default value"
```