Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename to surfExp and use deode as engine #8

Merged
merged 51 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
43be6f6
Work in progress
trygveasp Mar 19, 2024
a81eb29
Updates
trygveasp Mar 20, 2024
35fdffc
Install poe and linting
trygveasp Mar 21, 2024
9e22ecc
Yellow boxes and linting
trygveasp Mar 24, 2024
b75acdf
Should work
trygveasp Mar 28, 2024
2ca1560
Fix logging
trygveasp Apr 3, 2024
ee86f6c
Install deode from local ppi path
trygveasp Apr 3, 2024
5b26e33
Adapt to incremental configuration setup in deode
trygveasp Apr 11, 2024
bcc7181
Add configuration for nebula2
trygveasp Apr 23, 2024
5620a1a
From deode
trygveasp Apr 23, 2024
3c21592
Set dirtyp/direct default
trygveasp Apr 23, 2024
8b2313f
Separate snowflux setting
trygveasp Apr 23, 2024
cdf40bf
More testing on PPI IB
trygveasp Sep 9, 2024
2fd5c64
Merge branch 'feature/deode_offline_surfex' of github.com:trygveasp/p…
trygveasp Sep 9, 2024
11de669
Correct decade
trygveasp Sep 9, 2024
3107b67
Using deode develop
trygveasp Sep 25, 2024
0bd33ed
Update LDAS, correct domains start on template plugins
trygveasp Oct 21, 2024
7281a25
Restructure. Create python interface to surExp
trygveasp Oct 22, 2024
e34b3a6
Remove not used unit test
trygveasp Oct 22, 2024
58a864c
Rename project to surfexp
trygveasp Oct 22, 2024
d9c6b34
Documentation
trygveasp Oct 22, 2024
ddf50e2
More docs
trygveasp Oct 22, 2024
e67b3e9
use github branch
trygveasp Oct 22, 2024
d5e0059
Try ssh
trygveasp Oct 22, 2024
a8781db
Update linting.yaml
trygveasp Oct 22, 2024
b934f34
Update tests.yml
trygveasp Oct 22, 2024
bd228e8
Use 3.9
trygveasp Oct 22, 2024
6b362cd
Setup ssh
trygveasp Oct 22, 2024
222e9e9
Setup ssh
trygveasp Oct 22, 2024
4c7b6b3
Setup ssh
trygveasp Oct 22, 2024
712c6fb
Setup ssh
trygveasp Oct 22, 2024
f346162
Setup ssh
trygveasp Oct 22, 2024
ff6224b
Setup ssh
trygveasp Oct 22, 2024
f3b61bf
Setup ssh
trygveasp Oct 22, 2024
4fb26ae
Setup ssh
trygveasp Oct 22, 2024
6d23d6f
Setup ssh
trygveasp Oct 22, 2024
3fd8a0f
Setup ssh
trygveasp Oct 22, 2024
9ba2185
Setup ssh
trygveasp Oct 22, 2024
4a425c7
More debugging
trygveasp Oct 23, 2024
d8c5268
More debugging
trygveasp Oct 23, 2024
9783dbd
More debugging
trygveasp Oct 23, 2024
ea1a06b
More debugging
trygveasp Oct 23, 2024
98b77a5
More debugging
trygveasp Oct 23, 2024
bfd4eb9
More debugging
trygveasp Oct 23, 2024
91a6c43
More debugging
trygveasp Oct 23, 2024
43b7991
Linting
trygveasp Oct 23, 2024
4199d7b
Add a test
trygveasp Oct 23, 2024
d8cb8cc
Bring back coveralls
trygveasp Oct 23, 2024
4020441
Remove deode as installation dependency
trygveasp Oct 23, 2024
2208523
Missing conftest
trygveasp Oct 23, 2024
2187af3
Linting
trygveasp Oct 23, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 0 additions & 49 deletions .flakeheaven.toml

This file was deleted.

9 changes: 5 additions & 4 deletions .github/workflows/linting.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,18 @@ jobs:
if: github.repository_owner == 'metno'
name: Run Linters
runs-on: ubuntu-latest
environment: staging
steps:
#----------------------------------------------
# check-out repo and set-up python
#----------------------------------------------
- name: Check out repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Set up python
id: setup-python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.8'
python-version: '3.9'

#----------------------------------------------
# --- configure poetry & install project ----
Expand All @@ -42,7 +43,7 @@ jobs:

- name: Load cached venv (if cache exists)
id: cached-poetry-dependencies
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/pyproject.toml') }}
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
matrix:
os: [ "ubuntu-latest" ]
env: [ "pytest" ]
python-version: [ "3.8" ]
python-version: [ "3.9" ]

name: "${{ matrix.os }}, python=${{ matrix.python-version }}"
runs-on: ${{ matrix.os }}
Expand All @@ -36,7 +36,7 @@ jobs:
# check-out repo
#----------------------------------------------
- name: Check out repository
uses: actions/checkout@v3
uses: actions/checkout@v4

#----------------------------------------------
# add matrix specifics
Expand Down Expand Up @@ -66,7 +66,7 @@ jobs:

- name: Load cached venv (if cache exists)
id: cached-poetry-dependencies
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: .venv
key: venv-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/pyproject.toml') }}
Expand All @@ -92,19 +92,19 @@ jobs:
# files: ./.coverage.xml

- name: Coveralls
if: ${{ matrix.python-version == 3.8 }}
if: ${{ matrix.python-version == 3.9 }}
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
run: |
export COVERALLS_REPO_TOKEN=${{secrets.COVERALLS_REPO_TOKEN}}
poetry run coveralls

- name: Create documentation
if: ${{ matrix.python-version == 3.8 }}
if: ${{ matrix.python-version == 3.9 }}
run: |
poetry run sphinx-build . docs/build/html
- name: Commit documentation changes
if: ${{ matrix.python-version == 3.8 && github.event_name != 'pull_request' }}
if: ${{ matrix.python-version == 3.9 && github.event_name != 'pull_request' }}
run: |
git clone https://github.com/metno/pysurfex-experiment.git --branch gh-pages --single-branch gh-pages
cp -r docs/build/html/* gh-pages/
Expand All @@ -117,7 +117,7 @@ jobs:
# the return code.

- name: Push changes
if: ${{ matrix.python-version == 3.8 && github.event_name != 'pull_request' }}
if: ${{ matrix.python-version == 3.9 && github.event_name != 'pull_request' }}
uses: ad-m/github-push-action@master
with:
branch: gh-pages
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# My stuff
*.def
exps
FORCING.nc
.idea
testdata
Expand Down Expand Up @@ -91,6 +93,7 @@ celerybeat-schedule
# virtualenv
venv/
ENV/
.venv

# Spyder project settings
.spyderproject
Expand Down
147 changes: 51 additions & 96 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,28 +1,19 @@
.. _README:

.. image:: https://coveralls.io/repos/github/metno/pysurfex-experiment/badge.svg?branch=master
.. image:: https://coveralls.io/repos/github/metno/surfExp/badge.svg?branch=master

https://coveralls.io/github/metno/pysurfex-experiment
https://coveralls.io/github/metno/surfExp


This repository is a setup to create and run offline SURFEX experiments.
=========================================================================

See online documentation in https://metno.github.io/pysurfex-experiment/
The setup is dependent of pysurfex (https://metno.github.io/pysurfex)
See online documentation in https://metno.github.io/surfExp/
The setup is dependent of pysurfex (https://metno.github.io/pysurfex) and deode workflow (https://github.com/destination-earth-digital-twins/Deode-Workflow / https://github.com/trygveasp/Deode-Workflow)

You need a python3 parser and the following dependencies are needed. Install the non-standard ones e.g. with pip or your system installation system. Requirements can be found in https://github.com/metno/pysurfex-experiment/blob/master/requirements.txt
You need a python3 parser and the following dependencies are needed. Install the non-standard ones e.g. with pip or your system installation system. Requirements can be found in https://github.com/metno/surfExp/blob/master/requirements.txt


General dependencies (from pypi)
---------------------------------

.. code-block:: bash

pysurfex

pysurfex bring extra dependencies like gridpp, titanlib. If you install from pypi with pip these should be handled automatically.

Installation
-------------

Expand All @@ -34,7 +25,7 @@ The recommended installation method is using poetry. First install poetry. This


When you have poetry installed make sure you have it in path. It might be installed in ~/.local/bin.
To install the script system first clone https://github.com/metno/pysurfex-experiment and install it.
To install the script system first clone https://github.com/metno/surfExp and install it.
To run commands interactively in the poetry environment you need to run either "poetry shell" or "poetry run [cmd]"


Expand All @@ -45,10 +36,10 @@ To run commands interactively in the poetry environment you need to run either "
cd projects

# Clone the source code
clone https://github.com/metno/pysurfex-experiment
clone https://github.com/metno/surfExp

# Install the script system
cd pysurfex-experiment
cd surfExp
poetry install

# Enter the environment
Expand All @@ -58,115 +49,79 @@ To run commands interactively in the poetry environment you need to run either "
Usage
---------------------------------------------

There are two ways to set up an experiment. Either in an experiment with the config files inside the experiment,
or as a self contained configuration file with all settings inside.

Approach 1: All sub-config files in an experiment
----------------------------------------------------

Assume you have cloned experiment in pysurfex-experiment-clone-dir. Let us set some variables we can use in the examples in addition to some system settings.
Adjust it to your clone, host-tag and system. First you will set up an experiment. This will merge configuration based on your settings and split them back to configuration files.
You have the following config files in the config directories:

* config_exp.toml
* config_exp_surfex.toml
* config_exp_observations.toml
* config_exp_eps.toml

The altering of the configuration must then be done by applying a defined configuration or a configuration file with patches from original configuration. Examples are local configurations, domains etc.
In addition you will get some other config files used in the tasks. An example on how to use it inside a poetry environment ("poetry shell")

.. code-block:: bash

# First make sure you are in a poetry environment after executing "poetry shell"
cd ~/projects/pysurfex-experiment
cd ~/projects/surfExp
poetry shell

export PYSURFEX_EXPERIMENT_PATH="pysurfex-experiment-clone-dir"
export HOST_TAG="my-host-tag"
export OFFLINE_SOURCE_CODE="path-to-your-offline-source-code"

cd
mkdir -p sfx_home
cd sfx_home
mkdir -p my_exp
cd my_exp

# The -offline argument is optional if you want to run with existing binaries
PySurfexExpSetup -experiment $PYSURFEX_EXPERIMENT_PATH -host $HOST_TAG -offline $OFFLINE_SOURCE_CODE
# This will create a file exp_dependencies.json

# Alternative way of setting up a pre-defined SEKF configuration
PySurfexExpSetup -experiment $PYSURFEX_EXPERIMENT_PATH -host $HOST_TAG -offline $OFFLINE_SOURCE_CODE --config sekf

# To re-configure your config and (re-)create exp_configuration.json
PySurfexExpConfig
surfExp my_config.toml SEKF surfexp/data/config data/config/configurations/sekf.toml

# To start you experiment
PySurfexExp start -dtg 202301010300 -dtgend 202301010600

Alternative 2 is using the poetry run functionality:

.. code-block:: bash
# Use AROME Arctic branch on PPI together with MET-Norway LDAS
surfExp my_config.toml LDAS surfexp/data/config/configurations/metno_ldas.toml surfexp/data/config/mods/arome_arctic_offline_ppi.toml

# First make sure you are in a poetry environment after executing "poetry shell"
cd ~/projects/pysurfex-experiment

export PYSURFEX_EXPERIMENT_PATH="pysurfex-experiment-clone-dir"
export HOST_TAG="my-host-tag"
export OFFLINE_SOURCE_CODE="path-to-your-offline-source-code"
export WD=$HOME/sfx_home/my_exp

# The -offline argument is optional if you want to run with existing binaries
poetry run PySurfexExpSetup -experiment $PYSURFEX_EXPERIMENT_PATH -host $HOST_TAG -offline $OFFLINE_SOURCE_CODE -exp_name my_exp --wd $WD
# This will create a file exp_dependencies.json

# Alternative way of setting up a pre-defined SEKF configuration
WD=$HOME/sfx_home/my_sekf_exp
poetry run PySurfexExpSetup -experiment $PYSURFEX_EXPERIMENT_PATH -host $HOST_TAG -offline $OFFLINE_SOURCE_CODE --config sekf -exp_name my_sekf_exp --wd $WD

# To re-configure your config and (re-)create exp_configuration.json
poetry run PySurfexExpConfig -exp_name my_sekf_exp --wd $WD

# To start you experiment
poetry run PySurfexExp start -dtg 202301010300 -dtgend 202301010600
deode start suite --config-file my_config.toml


The second approach is to create a self-contained configuration file, can be started.
The altering of the configuration must then be done by applying a defined configuration or a configuration file with patches from original configuration.
Here is an example with CARRA2.

Here is an example with CARRA2 using poetry run.

.. code-block:: bash
cd ~/projects/pysurfex-experiment

# Create experiment in file CARRA2_MINI_NEW.json
poetry run PySurfexExpSetup -exp_name CARRA2_MINI -experiment $PWD -offline /perm/sbu/git/carra/CARRA2-Harmonie/ -host ECMWF-atos --config carra2 -o CARRA2_MINI.json

# Run experiment from config file CARRA2_MINI_NEW.json
poetry run PySurfexExp start -exp_name CARRA2_MINI -dtg "2017-09-01T03:00:00Z" -dtgend "2017-09-01T06:00:00Z" -config CARRA2_MINI.json
cd ~/projects/surfExp

# Create experiment in file data/config/CARRA2_MINI.toml
poetry run surfExp CARRA2_MINI.toml CARRA2-MINI surfexp/data/config/configurations/carra2.toml

# Modify times in data/config/CARRA2_MINI.toml
# Run experiment from config file data/config/CARRA2_MINI.toml
poetry run deode start suite --config-file data/config/CARRA2_MINI.toml

Following host tags are tested:

* ECMWF-atos (ATOS at ECMWF)
* ppi-rhel8 (RH8 PPI at met.no)
* nebula (nebula.nsc.liu.se)

The experiment specific file exp_dependencies.json will tell you the location of the system dependent files.
You might want to override them with local copies if needed.

Extra environment on PPI-RHEL8 needed to start experiments
---------------------------------------------------------------

.. code-block:: bash

# ib-dev queue is only in A: ib-dev-a-r8.q
ssh ppi-r8login-a1.int.met.no

# Get surfExp
git clone github.com:trygveasp/surfExp.git --branch feature/deode_offline_surfex surfExp

# conda setup
source /modules/rhel8/user-apps/suv-modules/miniconda3/24.7.1/etc/profile.d/conda.sh
conda create -n surfExp python==3.10 -y
conda install -c conda-forge -n surfExp poetry gdal -y
conda activate surfExp

# Install
poetry install

# MET-Norway LDAS experiment
mkdir -f exps
surfExp exps/LDAS.toml LDAS $PWD/data/config/configurations/metno_ldas.toml $PWD/data/config/domains/MET_NORDIC_1_0.toml $PWD/data/config/mods/arome_arctic_offline_ppi.toml $PWD/data/config/mods/netcdf_input_pgd.toml $PWD/data/config/scheduler/ecflow_ppi_rhel8-$USER.toml

# PPI ECFLOW (in A)
# If your server is not running you should start it!
module use /modules/MET/rhel8/user-modules/
module load ecflow/5.8.1
export ECF_SSL=1
export UDUNITS2_XML_PATH=/usr/share/udunits/udunits2.xml

# Start suite (modify dates)
deode start suite --config-file exps/LDAS.toml


# MET-Norway LDAS single decade
surfExp exps/LDAS_decade.toml LDAS_decade $PWD/data/config/configurations/metno_ldas.toml $PWD/data/config/domains/MET_NORDIC_1_0.toml $PWD/data/config/mods/arome_arctic_offline_ppi.toml $PWD/data/config/mods/netcdf_input_pgd.toml $PWD/data/config/mods/netcdf_input_single_decade.toml $PWD/data/config/mods/metno_ldas_single_decade.toml $PWD/data/config/scheduler/ecflow_ppi_rhel8-$USER.toml
deode start suite --config-file exps/LDAS_decade.toml

Trainings
-----------------------

`Budapest May 2022 <https://github.com/metno/pysurfex-experiment/blob/master/trainings/budapest_may_2022.rst/>`_ (Old version)
`Budapest May 2022 <https://github.com/metno/surfExp/blob/master/trainings/budapest_may_2022.rst/>`_ (Old version)
2 changes: 1 addition & 1 deletion conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

# -- Project information -----------------------------------------------------

project = "Pysurfex-experiment"
project = "surfExp"
copyright = "2020, Trygve Aspelien" # noqa A001
author = "Trygve Aspelien"

Expand Down
Loading