# ACTRIS PTRMS converter

Tool to convert PTRMS level 0 data to ACTRIS NASA Ames level 1 and 2 files.

## Informations

* Original dev repository: https://git.icare.univ-lille1.fr/dev/actris_ptrms_concentration_converter
* Original dev repository of the submodule ptrms_lib: git@gitlab.in2p3.fr:ipsl/sirta/actris-cigas/cigas-ptr-ms.git
* version: 0.0.0

## Copyright (©) 2024

* Université de Lille
* Centre national de la recherche scientifique (CNRS)

## Authors

* Scientific development : Valerie Gros, Lorna Foliot (LSCE/IPSL)
* Convertion algorithm development : Marc-Antoine Drouin, Christophe Boitel (LMD/IPSL)
* Software development : Nicolas Pascal, Aurélien Chauvigné (AERIS/ICARE)

## License

This project is licensed under the GNU AFFERO General Public License v3 - see the [LICENSE](LICENSE) file for details

## Prerequisites

- Python3
- numpy < 2
- pandas
- scipy
- pysftp-extension
- click
- matplotlib
- pycurl
- toml
- tomli

## Install

### Recover the project and submodule

from AERIS/ICARE gitlab

```bash
git clone https://git.icare.univ-lille1.fr/dev/actris_ptrms_concentration_converter
```

from NILU gitlab

```bash
git clone git@git.nilu.no:ebas-data-processing/cigas-processing-software/ptr-ms.git
```

Go into the code directory and then you need to update the submodule

```bash
git submodule update --init --recursive
```

### Environment

Code should be working with any python >= 3.8

- pip

    ```bash
    pip install -r requirements.txt
    ```

- conda

    ```bash
    conda create --name ptrms -c conda-forge --file requirements.txt python
    ```

### Configuration

For concentration conversion, parameters are needed in algo/ptrms_lib/conf/conf_ptrms.toml and may be adapted according station/instrument.

## Running

### raw -> lev0: runs at stations

### lev0 -> lev1: runs at NILU

```
* For a a list of files

Usage: python3 src/converter/PtrmsConverter.py [options] <conf-file> <infiles>

Args:
  <infiles> : list of files to process
  <conf-file> : path of the configuration file

Options:
  -h, --help            show this help message and exit
  -l LEVELS, --prod-id=LEVELS
                        Processed levels
  -p PROD_ID, --prod-id=PROD_ID
                        Process only this product. All by default
  -o OUT_DIR, --out_dir=OUT_DIR
                        force a specific output directory
  -d CACHE_DIR, --cache_dir=CACHE_DIR
                        Directory of the temporary files

```

### Input/Output format

* Inputs

PTR-MS measurements in NASA Ames format with data and metadata as requested by EBAS (https://ebas-submit.nilu.no/templates/VOC/PTR-MS_lev0).

* Outputs

NASA Ames level 1 files as shown in tests/SIRTA/results.