|
1 | | -# python-template |
| 1 | +# copernicusWeather2psdmWeather |
2 | 2 |
|
3 | | -Python template that includes all the basics for your new shiny project. |
| 3 | +Converts [copernicus.eu](https://cds.climate.copernicus.eu/) netCDF4 weather data to [PowerSystemDataModel](https://github.com/ie3-institute/PowerSystemDataModel) weather data format. |
4 | 4 |
|
5 | | -## Setup |
| 5 | +## How To Use |
6 | 6 |
|
7 | | -1. Open a new repository while using this template. |
8 | | -This repository is marked as a template repository. |
9 | | -Github offers you the convenient possibility to open a new repository from a such a template repository. |
10 | | -See [here](https://docs.github.com/en/repositories/creating-and-managing-repositories/creating-a-repository-from-a-template) for details. |
11 | | -2. Clone your new repository |
12 | | -3. Rename the `python-project` package to your project name (this is where your source code should go). |
13 | | -4. Install the dependencies (preferably within a fresh virtual environment) |
14 | | -5. Run `pre-commit install` |
15 | | -6. Enjoy! |
| 7 | +### Config File |
| 8 | +This tool can be used by giving parameters through config file `config.yaml`. |
16 | 9 |
|
17 | | -## What's in here? |
| 10 | +Here the parameter of the PostGreSql-Database can be assigned: |
| 11 | +- `db_user`: Database username, e.g. `postgres` |
| 12 | +- `db_password`: Database password of username, e.g. `postgres` |
| 13 | +- `db_port`: Database port, e.g. `5432` |
| 14 | +- `db_name`: Name of the database, `westfalia_2023_03_24-2023_03_28` |
| 15 | +- `input_dir`: Location of the CDS input files, e.g. `input/samples` |
| 16 | +- `file_name_base`: First part of the input files, see comment below. e.g. `westfalia_2023_03_24-2023_03_28` |
18 | 17 |
|
19 | | -### Formatting |
| 18 | +So far we support the following format of input files: |
| 19 | +- netCDF4 |
20 | 20 |
|
21 | | -To spare you the pain of manually taking care of formatting your code and establish some consistency (remember "äußere Ordnung führt zu innerer Ordnung") it includes [Black](https://black.readthedocs.io/en/stable/) for automated formatting. |
22 | | -Execute `black .` in the terminal at the project's root directory to format your code. |
| 21 | +To start converter |
| 22 | +- Adapt config file |
| 23 | +- Setup PostGreSql database |
| 24 | +- Start `main.py` |
23 | 25 |
|
24 | | -### Testing |
| 26 | +### netCDF4 Input files |
| 27 | +Climate Data Store (CDS) provides the weather data in two files, which file names ends on '_accum.nc' and '_instant.nc'. Sample data can be found in `input/samples`. |
25 | 28 |
|
26 | | -To make sure your code actually does what you think it does! |
27 | | -The template includes [pytest](https://docs.pytest.org/en/7.1.x/) for that purpose. |
28 | | -Include the tests in the `tests` directory. Running `pytest` in the terminal at the project's root directory executes all tests and hopefully replaces hoping that your code works by knowing (at least so far as your actual test all relevant cases and boundary conditions). |
| 29 | +#### File name base |
| 30 | +Weather in netCFD format are provided by Copernicus in two files ending with `_accum.nc` and `_instant.nc`. |
| 31 | +This parameter allows to set the file_name_base. |
| 32 | +E.g. `weather_data_accum.nc` and `weather_data_instant.nc`. file_name_base would be `weather_data`. |
29 | 33 |
|
30 | | -### CI |
31 | | - |
32 | | -To give you a slap on the wrist if you did not apply the formatter or your tests don't pass there is a [Github Actions](https://github.com/features/actions) workflow at `.github/workflows/simple-ci.yml`. |
33 | | -After pushing to the remote repository it checks out your code, installs all the dependencies then runs `flake8` for any code style issues and `black --check` to check the formatting. |
34 | | -Depending on how that went you will see yourself either confronted with a friendly green tick or rather unfriendly red cross at the code window in github (or the `Actions` section of the github repository.) |
35 | | - |
36 | | -### Pre-Commit |
37 | | - |
38 | | -To reduce slaps on the wrist there is [pre-commit](https://pre-commit.com/) having your back. |
39 | | -It installs pre-commit hooks that `black` and `flake8` before the CI gets a chance to complain. |
40 | | -The types of git hooks are configured in `.pre-commit-config.yaml`. |
41 | | -To install the hooks run `pre-commit install` once in the terminal at the project's root directory. |
42 | | - |
43 | | -### Dependabot |
44 | | - |
45 | | -To keep the dust off your dependencies [Dependabot](https://github.blog/2020-06-01-keep-all-your-packages-up-to-date-with-dependabot/) checks for new versions once a day (according to current cofigurations) and opens Pull-Requests in case it finds any newer versions. |
46 | | -The configuration can be changed at `.github/dependabot.yml` |
47 | | -Keep in mind that dependency updates can break your code. |
48 | | -You safeguard yourself against this by making sure you have all your code tested and the dependency pull request does not break any of them. |
49 | 34 |
|
50 | 35 | ## Something Missing? |
51 | 36 |
|
|
0 commit comments