Coder Social home page Coder Social logo

ppnn's Introduction

Post-processing with neural networks

This repository provides Python and R code accompanying the paper

Rasp, S. and Lerch, S. (2018). Neural networks for post-processing ensemble weather forecasts. Monthly Weather Review, 146, 3885-3900 https://doi.org/10.1175/MWR-D-18-0187.1 (preprint version available at https://arxiv.org/abs/1805.09091)

In particular, code for data retrieval and processing as well as implementation and evaluation of benchmark and network models is available.

This study demonstrates how neural networks can be used for post-processing of ensemble weather forecasts in a distributional regression framework. The neural network models significantly outperform state-of-the-art post-processing techniques while being computationally more efficient. The main advantages of using neural networks include the capability of capturing nonlinear relations between arbitrary predictors and distribution parameters without having to specify appropriate link functions, and the ease of adding station information in a global model by using embeddings.

Data

The data needed to reproduce the results (see RL18_replication.ipynb for an implementation of the main model) can be found here:

Rasp, Stephan (2021): PPNN full data (feather format). figshare. Dataset. https://doi.org/10.6084/m9.figshare.13516301.v1

Forecasts

ECMWF forecasts from TIGGE dataset

https://software.ecmwf.int/wiki/display/TIGGE/Models

  • Variables: T2M and various additional predictors
  • Time period: 2007-01-02 -- 2017-01-02 (forecasts for forecast initializations between 2007-01-01 and 2016-12-31)
  • Forecast initialization time: 00UTC
  • Members: 50
  • Forecast lead time: 36h and 48h (valid at 12 and 00UTC)
  • area: -10E to 30E; 30N to 70N (large part of Europe centered around Germany)
  • resolution: 0.5 degrees

Observations

DWD SYNOP stations

  • Number of stations: 537
  • Variables: T2M (longitude, latitude and altitude for each station)

Post-processing

All models are estimated based on two training datasets based on data from year 2015 only, and from years 2007--2015.

Benchmark models

  • standard EMOS models estimated globally and locally
  • local EMOS model with gradient boosting to include additional predictors
  • local quantile regression forest model

The implementations are available in the directory: benchmark_postprocessing_models.

Network models

  • fully connected linear network models
    • including auxiliary predictors
    • including station embeddings
    • including both auxiliary predictors and station embeddings
  • neural network models with one hidden layer
    • including auxiliary predictors
    • including both auxiliary predictors and station embeddings

All network models are estimated by minimizing the CRPS using stochastic gradient descent. Implementations are available in the directory: nn_postprocessing.

Overview of results

Models with values in parentheses are not included in the paper. Detailed results and code for forecast evaluation is available in the directory: results.

Training 2015 only

Model variant CRPS computation time (minutes)
EMOS global 1.01 0.03
(global, window) (1.00) (3)
local 0.90 0.1
(local, window) (0.90) (10)
EMOS + boosting local 0.85 14
QRF local 0.95 8
--- --- --- ---
Linear network fc 1.01 0.2
fc_aux 0.92 0.7
fc_emb 0.91 0.8
fc_aux_emb 0.88 0.8
Neural network nn_aux_emb 0.82 9

Training 2007-2015

Model variant CRPS computation time (minutes)
EMOS global 1.00 0.3
(global, window) (1.00) (12)
local 0.90 1
(local, window) (0.88) (45)
EMOS + boosting local 0.80 48
QRF local 0.81 430
--- --- --- ---
Linear network fc 1.01 1
fc_aux 0.91 2
fc_emb 0.91 3
fc_aux_emb 0.87 3
Neural network nn_aux 0.87 25
nn_aux_emb 0.78 16

ppnn's People

Contributors

raspstephan avatar slerch avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

ppnn's Issues

Import Error

Hi Slerch,

I am trying to run your code in Anaconda Python 3.8 version. I am experiencing the following import issues when the run_experiment.py and run_all.py files are run:

(1) run_experiment.py
Traceback (most recent call last):
File "run_experiment.py", line 6, in
from nn_src.imports import *
File "G:\ppnn-master\nn_postprocessing\nn_src\imports.py", line 4, in
from .losses import *
File "G:\ppnn-master\nn_postprocessing\nn_src\losses.py", line 9, in
from tensorflow import erf
ImportError: cannot import name 'erf' from 'tensorflow' (C:\Users\user\anaconda3\lib\site-packages\tensorflow_init_.py)

(2) run_experiment.py
Traceback (most recent call last):
File "run_experiment.py", line 6, in
from nn_src.imports import *
File "G:\ppnn-master\nn_postprocessing\nn_src\imports.py", line 25, in
limit_mem()
File "G:\ppnn-master\nn_postprocessing\nn_src\imports.py", line 22, in limit_mem
config = tf.ConfigProto()
AttributeError: module 'tensorflow' has no attribute 'ConfigProto'

(3)run_experiment.py
Traceback (most recent call last):
File "run_experiment.py", line 6, in
from nn_src.imports import *
File "G:\ppnn-master\nn_postprocessing\nn_src\imports.py", line 25, in
limit_mem()
File "G:\ppnn-master\nn_postprocessing\nn_src\imports.py", line 24, in limit_mem
keras.backend.tensorflow_backend.set_session(tf.Session(config=config))
AttributeError: module 'keras.backend' has no attribute 'tensorflow_backend'

(4) run_experiment.py
WARNING:tensorflow:From G:\ppnn-master\nn_postprocessing\nn_src\imports.py:26: The name tf.keras.backend.set_session is deprecated. Please use tf.compat.v1.keras.backend.set_session instead.

2021-11-12 16:24:21.778641: I tensorflow/core/platform/cpu_feature_guard.cc:142] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN)to use the following CPU instructions in performance-critical operations: AVX AVX2
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
Traceback (most recent call last):
File "run_experiment.py", line 292, in
main(args)
File "run_experiment.py", line 29, in main
train_set, test_set = get_train_test_sets(
File "G:\ppnn-master\nn_postprocessing\nn_src\utils.py", line 87, in get_train_test_sets
raw_data = load_raw_data(data_dir, aux_dict, full_ensemble_t)
File "G:\ppnn-master\nn_postprocessing\nn_src\utils.py", line 157, in load_raw_data
rg = Dataset(data_dir + 'data_interpolated_00UTC.nc')
File "netCDF4_netCDF4.pyx", line 2358, in netCDF4._netCDF4.Dataset.init
File "netCDF4_netCDF4.pyx", line 1926, in netCDF4._netCDF4._ensure_nc_success
FileNotFoundError: [Errno 2] No such file or directory: b'/project/meteo/w2w/C7/ppnn_data/data_interpolated_00UTC.nc'

(5) run_all.py
Traceback (most recent call last):
File "run_all.py", line 14, in
raise Exception('Working directory not recognized.')
Exception: Working directory not recognized.
Moreover, what type of data is present in the data_dir = '/Volumes/STICK/data/ppnn_data/'

Could you please address the issues?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.