Skip to content

Commit

Permalink
Update README, Added Quick start section
Browse files Browse the repository at this point in the history
  • Loading branch information
Karko93 authored Oct 13, 2023
1 parent 28a1c80 commit d01db16
Showing 1 changed file with 54 additions and 45 deletions.
99 changes: 54 additions & 45 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
PyFlexPlot is a Python-based tool to visualize FLEXPART dispersion simulation results stored in NetCDF format.
## Table of Contents
- [Prerequisites and Cloning the Repository](#prerequisites-and-cloning-the-repository)
- [Getting Started](#getting-started)
- [Quick Start](#quick-start)
- [Usage](#usage)
- [Usage Example](#usage-example)
- [Developer Notes](#developer-notes)
- [The Developer's Guide through the Project](#the-developers-guide-through-the-project)
- [Getting Started](#getting-started)
- [Implemented Debugging Features](#implemented-debugging-features)
- [Roadmap to your first Contribution](#roadmap-to-your-first-contribution)
- [Testing and Coding Standards](#testing-and-coding-standards)
Expand All @@ -22,45 +23,15 @@ To get a local copy of this repository, run following commands and naviate into
git clone https://github.com/MeteoSwiss-APN/pyflexplot <custom_directory_name>
cd <custom_directory_name>
```

## Getting Started

Once you created or cloned this repository, make sure the installation is running properly. Install the package dependencies with the provided script `setup_env.sh`.
Check available options with
```bash
tools/setup_env.sh -h
```
We distinguish pinned installations based on exported (reproducible) environments and free installations where the installation
is based on top-level dependencies listed in `requirements/requirements.yml`. If you start developing, you might want to do an unpinned installation and export the environment:

```bash
tools/setup_env.sh -u -e -n <custom_environment_name>
```
*Hint*: If you are the package administrator, it is a good idea to understand what this script does, you can do everything manually with `conda` instructions.

*Hint*: Use the flag `-m` to speed up the installation using mamba. Of course you will have to install mamba first (we recommend to install mamba into your base
environment `conda install -c conda-forge mamba`. If you install mamba in another (maybe dedicated) environment, environments installed with mamba will be located
in `<miniconda_root_dir>/envs/mamba/envs`, which is not very practical.

The package itself is installed with `pip`. For development, install in editable mode:

```bash
conda activate <custom_environment_name>
pip install --editable .
```

*Warning:* Make sure you use the right pip, i.e. the one from the installed conda environment (`which pip` should point to something like `path/to/miniconda/envs/<custom_environment_name>/bin/pip`).

Once your package is installed, navigate to the root directory and run the tests by typing:

## Quick Start
For a quick setup to use pyflexplot, run the following commands within the root folder:
1. Install pinned environment: ```tools/setup_env.sh```
2. Activate the environment and build the package:
```bash
cd <custom_directory_name>
conda activate <custom_environment_name>
pytest
conda activate pyflexplot
pip install --no-deps .
```

If the tests pass, you are good to go. If not, contact the package administrator Stefan Ruedisuehli. Make sure to update your requirement files and export your environments after installation
every time you add new imports while developing. Check the next section to find some guidance on the development process if you are new to Python and/or SEN.
3. To check if the tool runs properly you can run the tests by running ```pytest tests```

## Usage
To utilize pyflexplot, first ensure you are in the root directory of the project and have activated the necessary conda environment:
Expand All @@ -84,13 +55,12 @@ To utilize all available CPUs for the command, use the option:
### Usage Example
After you've set up pyflexplot ([Prerequisites and cloning the repository](#prerequisites-and-cloning-the-repository) and [Getting started](#getting-started)),
you'll need to specify a configuration file and an output directory.
Create an output directory using:
Define an output directory:
```bash
dest=test_output/
```
Note: The directory will be automatically created if it doesn't already exist.
Note: The directory will be created on run time if it doesn't already exist.
There are several default config files available under ```src/pyflexplot/data/presets/opr```.
Furthermore, there are already several default config files available in the directory ```src/pyflexplot/data/presets/opr```.
To run the program for all presets in the PDF graphics format with the default input data, use:
```bash
Expand All @@ -111,7 +81,46 @@ After selecting a preset, run pyflexplot interactively:
pyflexplot --preset "$preset" --merge-pdfs --dest=$dest
```
## Developer Notes
## The Developer's Guide through the Project

### Getting Started

Once you created or cloned this repository, make sure the installation is running properly. Install the package dependencies with the provided script `setup_env.sh`.
Check available options with
```bash
tools/setup_env.sh -h
```
We distinguish pinned installations based on exported (reproducible) environments and free installations where the installation
is based on top-level dependencies listed in `requirements/requirements.yml`. If you start developing, you might want to do an unpinned installation and export the environment:

```bash
tools/setup_env.sh -u -e -n <custom_environment_name>
```
*Hint*: If you are the package administrator, it is a good idea to understand what this script does, you can do everything manually with `conda` instructions.

*Hint*: Use the flag `-m` to speed up the installation using mamba. Of course you will have to install mamba first (we recommend to install mamba into your base
environment `conda install -c conda-forge mamba`. If you install mamba in another (maybe dedicated) environment, environments installed with mamba will be located
in `<miniconda_root_dir>/envs/mamba/envs`, which is not very practical.

The package itself is installed with `pip`. For development, install in editable mode:

```bash
conda activate <custom_environment_name>
pip install --editable .
```

*Warning:* Make sure you use the right pip, i.e. the one from the installed conda environment (`which pip` should point to something like `path/to/miniconda/envs/<custom_environment_name>/bin/pip`).

Once your package is installed, navigate to the root directory and run the tests by typing:

```bash
cd <custom_directory_name>
conda activate <custom_environment_name>
pytest
```

If the tests pass, you are good to go. Make sure to update your requirement files and export your environments after installation
every time you add new imports while developing. Check the next section to find some guidance on the development process if you are new to Python and/or SEN.

As this package was created with the SEN Python blueprint, it comes with a stack of development tools, which are described in more detail on the [Website](https://meteoswiss-apn.github.io/mch-python-blueprint/). Here, we give a brief overview on what is implemented.

Expand All @@ -130,8 +139,8 @@ Here are some of the key debugging features:

### Roadmap to your first Contribution

Generally, the source code of your library is located in `src/<library_name>`. The blueprint will generate some example code in `mutable_number.py`, `utils.py` and `cli.py`. `cli.py` thereby serves as an entry
point for functionalities you want to execute from the command line, it is based on the Click library. If you do not need interactions with the command line, you should remove `cli.py`. Moreover, of course there exist other options for command line interfaces,
Generally, the source code of your library is located in `src/<library_name>`. `cli.py` thereby serves as an entry
point for functionalities you want to execute from the command line and it is based on the Click library. If you do not need interactions with the command line, you should remove `cli.py`. Moreover, of course there exist other options for command line interfaces,
a good overview may be found [here](https://realpython.com/comparing-python-command-line-parsing-libraries-argparse-docopt-click/), we recommend however to use click. The provided example
code should provide some guidance on how the individual source code files interact within the library. In addition to the example code in `src/<library_name>`, there are examples for
unit tests in `tests/<library_name>/`, which can be triggered with `pytest` from the command line. Once you implemented a feature (and of course you also
Expand Down

0 comments on commit d01db16

Please sign in to comment.