Skip to main content

Python API to SURFEX

Project description

An API in python to the external surface model SURFEX.
  • Prepare input and namelists to a SURFEX binary

  • Create atmospheric forcing for offline SURFEX runs

  • Read SURFEX output

  • Quality control of observations with titanlib

  • Optimal interpolation with gridpp

  • Monitor the observations usage

See online documentation in https://metno.github.io/pysurfex/

Installation of pregenerated packages from pypi (pip)

All releases will trigger an autmomatic pre-built package on pypi which can be installed by pip

pip3 install pysurfex

User installation:

pip3 install pysurfex --user

Run pysurfex from pre-built container

Releases also trigger an update of the pysurfex container in the github container registry. Below is an example to run pgd without any arguments.

podman run -it ghcr.io/metno/pysurfex:latest pgd

Installation on debian based Linux system

The following depencies are needed. Install the non-standard ones e.g. with pip or your system installation system.

General dependencies (from pypi)

numpy
pyproj
pyyaml
f90nml

To read NetCDF files:

NetCDF4
cfunits

To read grib files:

eccodes

from ECMWF https://software.ecmwf.int/wiki/display/ECC/Releases installed with ENABLE_PYTHON=ON

To read FA files:

falfilfa4py
epygram

To plot:

matplotlib

To get observations from frost.met.no API:

requests

For Quality control of observations

titanlib

For optimal interpolation and observation operators

gridpp

For testing:

pytest

Install pysurfex

An environment manager like miniconda or micromamba is recommended to ensure consistency between the packages. After installing this you need to set it up for the current session or permanently add it to your shell. Now it is easy to create a suitable environment for pysurfex. Below is a recipie for micromamba.

# Install micromamba (linux, https://mamba.readthedocs.io/en/latest/installation/micromamba-installation.html)
"${SHELL}" <(curl -L micro.mamba.pm/install.sh)

# specify a installation location for micromamba and add it to your path afterwards. Default it will install in $HOME/.local/bin
export PATH=$HOME/.local/bin:$PATH  # Use your PATH

# initialize your shell (needed in all shells), e.g:
eval "$(micromamba shell hook --shell bash)"

micromamba create env pysurfex
micromamba activate pysurfex
micromamba install python==3.12 poetry

Download the source code, then install pysurfex by executing the following inside the extracted folder:

poetry install

If not already in a conda/manba environment, this will install pysurfex in a poetry environment and this environment can be activated interactively by:

poetry shell

or

Run pysurfex client applications

poetry run [command]
# e.g.
poetry run python # will run python inside the pysurfex poetry environment

Examples

See https://metno.github.io/pysurfex/#examples

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pysurfex-0.1.2.tar.gz (127.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pysurfex-0.1.2-py3-none-any.whl (142.5 kB view details)

Uploaded Python 3

File details

Details for the file pysurfex-0.1.2.tar.gz.

File metadata

  • Download URL: pysurfex-0.1.2.tar.gz
  • Upload date:
  • Size: 127.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.12.3 Linux/6.11.0-1015-azure

File hashes

Hashes for pysurfex-0.1.2.tar.gz
Algorithm Hash digest
SHA256 c03c9e0bf75557de8cd1aa7f103cec1f3f8fb93e9b9a91d0a5d167c426345de7
MD5 8877e19fbb08b95d5896986f45eeff36
BLAKE2b-256 d8bf01dec3401e95f0756fb29a7dcf9996297c668a9f22bfefd398ae750a7a67

See more details on using hashes here.

File details

Details for the file pysurfex-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: pysurfex-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 142.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.12.3 Linux/6.11.0-1015-azure

File hashes

Hashes for pysurfex-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 8a68d1ff039a17c1f707ee332742364e1abf859eb3590ac0451bb2cee74057ed
MD5 ef6452d5a6955090d155263e6e90f4e4
BLAKE2b-256 a459d0d1a021f5f4eb33b5c2918c5ca630ffa6e17815691cd872325133c77202

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page