Read-only mirror of https://github.com/MeteoSwiss/obsweatherscale — MeteoSwiss. Issues & pull requests at the source.
  • Python 99.5%
  • Shell 0.5%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Icíar Lloréns Jover 28365e70fc
Merge pull request #10 from MeteoSwiss/feat/mlflow-nested-run-support
Feat/mlflow nested run support
2026-06-29 18:39:29 +02:00
.github Add workflow to build and deploy documentation 2025-10-16 18:00:59 +02:00
doc correct name :D 2025-10-02 14:18:46 +02:00
examples linting example trian script 2026-06-15 10:22:13 +02:00
obsweatherscale make parent run check more reliable 2026-06-22 22:08:10 +02:00
scripts add poetry setup script 2025-05-08 17:28:35 +02:00
test make parent run check more reliable 2026-06-22 22:08:10 +02:00
.gitignore MPC-227: loggers not bounded to training 2026-04-27 16:45:04 +02:00
.python-version first commit 2024-10-03 15:08:14 +02:00
CHANGELOG.rst conform project management to oss template 2025-10-02 14:09:51 +02:00
Jenkinsfile first commit 2024-10-03 15:08:14 +02:00
LICENSE initial structure 2024-10-09 12:14:03 +02:00
poetry.lock update poetry lock 2026-05-05 19:23:43 +02:00
pyproject.toml loosen scoringrules requirements 2026-05-05 19:11:55 +02:00
README.rst fix cuda driver compatibility and update dependencies 2026-03-31 12:23:53 +02:00
sonar-project.properties first commit 2024-10-03 15:08:14 +02:00

=============================
obsweatherscale
=============================

.. raw:: html

   <blockquote style="background-color: #f0f0f0; padding: 10px;">
   <strong>⚠️ WARNING</strong><br>
   This project is in BETA and under active development. Interfaces and functionality are subject to change.
   </blockquote>


**obsweatherscale** is a GPyTorch-based Python library for ML probabilistic interpolation and regression using Gaussian Processes (GPs), with a focus on meteorological applications. It provides an extensible framework for building GP models that incorporate neural networks, designed for tasks involving spatial and temporal surface weather analysis fields.

Gaussian Processes are a nonparametric supervised learning method, particularly well-suited for regression tasks that require uncertainty quantification. In our use case, GPs are employed to interpolate observed surface weather variables recorded at monitoring stations, such as temperature, precipitation, or wind, to arbitrary locations in space. This interpolation is guided by input features, which could include any predictor deemed useful (coordinates, numerical weather prediction (NWP) outputs, topographic information, temporal information, ...).

Possible applications:

- **Downscaling** coarse surface weather analysis fields to fine-scale target grids.
- **Bias correction** of model outputs to better match station observations.
- **Probabilistic interpolation** of observational datasets across space.

Features:

- Neural-augmented GP models leveraging trainable mean and kernel functions.
- Plug-and-play data transformations, including normal standardization and quantile fitting.
- Modular architecture for easy experimentation and extension.
- Training routines with support for random masking and batching.
- Inference routines.
- Built on PyTorch for GPU acceleration and automatic differentiation.

Installation
------------
Stable release
~~~~~~~~~~~~~~~
To install obsweatherscale, run this command in your terminal:

.. code-block:: console

    $ pip install obsweatherscale

This is the preferred method to install obsweatherscale, as it
will always install the most recent stable release.

If you don't have `pip`_ installed, this `Python installation guide`_ can guide
you through the process.

.. _pip: https://pip.pypa.io
.. _Python installation guide: http://docs.python-guide.org/en/latest/starting/installation/


For development
~~~~~~~~~~~~~~~
To set up the project for local development, clone the repository and use the provided Poetry setup script:

.. code-block:: console

    $ git clone git@github.com:MeteoSwiss/obsweatherscale.git
    $ cd obsweatherscale
    $ ./scripts/setup_poetry.sh

This will install Poetry (if not already available), set up the virtual environment, and install all dependencies with extras.

Usage
-----

To use obsweatherscale in a project::

    import obsweatherscale


To get started, check out the example scripts in the repository:

* ``example_train_script.py``: Demonstrates how to preprocess data, build a dataset, construct a model with customized mean and kernel functions, and train a GP model using toy data.
* ``example_inference_script.py``: Shows how to perform inference with a trained model to obtain prior and posterior distributions, and how to sample from the distributions.

These examples can be found in the ``obsweatherscale/examples/`` directory and provide a practical introduction to the library's core functionality.

Documentation
-------------
The official documentation is available `here <https://meteoswiss.github.io/obsweatherscale/>`_.

For local development, you can build the documentation using:

.. code-block:: bash

    poetry run sphinx-build doc doc/_build

Then open ``doc/_build/index.html`` in your browser to view the documentation.

Development
-----------
We welcome contributions, suggestions of developments, and bug reports.

Suggestions of developments and bug reports should use the `Issues page of the github repository <https://github.com/MeteoSwiss/obsweatherscale/issues>`_.

Citation
--------

This library is built upon `GPyTorch <https://gpytorch.ai/>`_, which provides the core functionality for Gaussian process modeling and training.
If you use obsweatherscale in your work, please cite both this library and GPyTorch.

**obsweatherscale**

Lloréns Jover, I., & Zanetta, F (2024).
obswetherscale: observation-conditioned ML downscaling of surface weather fields.
*GitHub repository: https://github.com/MeteoSwiss/obsweatherscale.*

**GPyTorch**

Gardner, J. R., Pleiss, G., Bindel, D., Weinberger, K. Q., & Gordon Wilson, A (2018).
GPyTorch: Blackbox Matrix-Matrix Gaussian Process Inference with GPU Acceleration.
*Advances in Neural Information Processing Systems, 2018.*

.. code-block:: bibtex

    @inproceedings{gardner2018gpytorch,
      title={GPyTorch: Blackbox Matrix-Matrix Gaussian Process Inference with GPU Acceleration},
      author={Gardner, Jacob R and Pleiss, Geoff and Bindel, David and Weinberger, Kilian Q and Wilson, Andrew Gordon},
      booktitle={Advances in Neural Information Processing Systems},
      year={2018}
    }

Acknowledgements
----------------

This work benefited from previous research in Gaussian Process modeling for
weather data as described in:

Zanetta, F., Nerini, D., Buzzi, M., & Moss, H. (2025).
Efficient modeling of sub-kilometer surface wind with Gaussian processes and neural networks.
*Artificial Intelligence for the Earth Systems.*

License
-------

This project is licensed under the BSD 3-Clause License - see the
`LICENSE <https://github.com/MeteoSwiss/obsweatherscale/blob/main/LICENSE>`_
file for details.

Copyright (c) 2024, MeteoSwiss