A versatile, configurable, extendable tool for reference/target data validation.
git clone https://gitlab.perfacct.eu/perfacct/naaice/rtv.gitThe end goal is to get a python environment with all the packages listed in
requirements.txt. The set of actions/commands to execute may differ depending
on your toolset for managing evnironments and python packages.
Here is an example using venv package for virtual environments and pip for
package management.
Create a virtual environment:
python -m venv <path/to/environment/directory>Activate created environment:
source <path/to/environment/directory>/bin/activateInstall reqruirements:
cd <path/to/rtv/source/directory>
pip install -r requirements.txtAfter you've finished working withing the environment you would probably want
to deactivate it. With venv you can do it by simply running:
deactivateThis step is optional, and also can be an alternative to the previous one
(or you can also install the package to the virtual environment),
since your package installer will most probably handle all requirements
automatically based on pyproject.toml.
The actions/commands sequence may differ depending on your toolset for python package management.
Here is the example using pip:
pip install <path/to/rtv/source/directory>You can also make an editable installation:
pip install -e <path/to/rtv/source/directory>This repository holds an examples directory with some configuration files
and scripts that you can use to test/explore the RTV's functionality and
features. The directory contains nested README file describing specific
example scripts and/or configuration files in detail.
First of all you need to set up an environment variable RTV_EXAMPLE_PATH
with the absolute path to the example directory, like this:
export RTV_EXAMPLE_PATH=</path/to/rtv/source/directory>/exampleFrom now you should be able to run example scripts and configuration files.
With a script the approach is as simple as just running:
python <path/to/the/script.py>Important: If you haven't install rtv as a package into your environment,
you would probably need to modify PYTHONPATH by adding RTV's src directory
to it, like this:
PYTHONPATH=</path/to/rtv/source/directory>/src python <path/to/the/script.py>With running the RTV's example configuration files you have the following approaches available:
-
Execute main script from source (inplace PYTHONPATH modification in case you do not have
rtvinstalled as a package).PYTHONPATH=<path/to/rtv/source/directory>/src \ python <path/to/rtv/source/directory>/src/rtv/__main__.py \ <path/to/example/configuration/file>
-
Execute as python module (export PYTHONPATH).
export PYTHONPATH=<path/to/rtv/source/directory>/src python -m rtv <path/to/example/configuration/file>
-
Execute as installed package.
rtv <path/to/example/configuration/file>
Further details on specific examples can be found in the example directory's
readme.
RTVs error output is written into the working directory as files with names
like rtv-error-<timestamp>.log. You will also see some info logs and
warnings in your stdout during the execution.
export RTV_USER_CODE_PATH=<path/to/your/code/directory>mkdir $RTV_USER_CODE_PATH
cd $RTV_USER_CODE_PATH
touch <filename>.pyAdd code to the py-files and add custom pipeline steps.
e.g. Transformer needs at least
from rtv.core.base import BaseEntity
from rtv.interfaces import ITransformerIf some custom parameter are required add:
from pydantic import BaseModelMinimum smallest custom class that uses params:
class MyTransformer(BaseEntity, ITransformer):
class Params(BaseModel): # for custom params
param1:str = '' # for custom params
def transform(self, collection, params = None):
# custom transformation code using `self.params.param1`
return transformed_collectionThe development of RTV is funded by the BMFTR Germany in the context of the NAAICE project (GreenHPC grant).
