Giter Site home page Giter Site logo

ecmwf / ecpoint-calibrate Goto Github PK

View Code? Open in Web Editor NEW
21.0 9.0 8.0 46.02 MB

Interactive GUI (developed in Python) for calibration and conditional verification of numerical weather prediction model outputs.

License: GNU General Public License v3.0

Python 38.90% Shell 0.24% GLSL 0.23% CSS 0.91% JavaScript 50.72% HTML 0.15% MATLAB 8.84%
python meteorology weather-forecast ecmwf calibration metview decision-trees

ecpoint-calibrate's Introduction

ecPoint-Calibrate

Core unit tests Release Core Release Electron codecov made-with-python

ecPoint-Calibrate is a software that uses conditional verification tools to compare numerical weather prediction (NWP) model outputs against point observations and, in this way, anticipate sub-grid variability and identify biases at grid scale. It provides a dynamic and user-friendly environment to post-process NWP model parameters (such as precipitation, wind, temperature, etc.) and produce probabilistic products for geographical locations (everywhere in the world, and up to medium-range forecasts).

The development of this project was sponsored by the project "ECMWF Summer of Weather Code (ESoWC)" @esowc_ecmwf ECMWF.

Build with Docker

docker build -f Dockerfile.core -t ecmwf/ecpoint-calibrate-core:dev .

Deploy new versions of the Docker containers

./deploy.sh

Create a production AppImage

yarn dist

The appimage won't work on modern machines without manually adding the --no-sandbox electron option and re-packaging.

Install appimagetool

sudo wget https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage -O /usr/local/bin/appimagetool
sudo chmod +x /usr/local/bin/appimagetool

Repackage the AppImage

cd pkg
./ecPoint-Calibrate-0.30.0.AppImage --appimage-extract

This will extract the image into the squashfs-root directory. Open squashfs-root/AppRun and change the exec lines to have the --no-sandbox argument. e.g. exec "$BIN" --no-sandbox

Then repackage:

appimagetool squashfs-root ecPoint-Calibrate-0.30.0.AppImage

Python Backend

We need metview-batch from conda-forge so unfortunately need to use conda with poetry.

Creating the environment

conda create --name ecpoint_calibrate_env --file conda-linux-64.lock
conda activate ecpoint_calibrate_env
poetry install

Activating the environment

conda activate ecpoint_calibrate_env

Updating the environment

Poetry (strongly preferred)

Installing a new package with poetry will update the poetry lockfile.

poetry install $DEP

Conda

You should very rarely need to add a new conda dep.

conda-lock -k explicit --conda mamba
mamba update --file conda-linux-64.lock
poetry update

Run tests

First activate the conda env, then run pytest.

Electron Frontend

You'll need node v 14.5.0.

Installing deps

yarn

Run the app

yarn start

Run tests

npm run test

ecpoint-calibrate's People

Contributors

dependabot[bot] avatar dtip avatar fatimapillosu avatar onyb avatar

Stargazers

 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  avatar  avatar  avatar  avatar  avatar

ecpoint-calibrate's Issues

Integrate computations step with the backend

Currently the backend runs all the computations known to us, since they have been hard-coded. The backend should run only those computations that have been specified by the user.

Integrate computations step with the backend

Currently the backend runs all the computations known to use, since they have been hard-coded. The backend should run only those computations that have been specified by the user.

Migrate to Pipenv

Hopefully, get rid of the setup.py that exists for no good reason. Also remove the (.*-)?requirements.txt files.

Allow user to specify the forecast error to compute

  • Implement component to check Forecast Error (FE) and Forecast Error Ratio (FER) computations.
  • Remove outdated MDL code, and use SemanticUI React.
  • Add the values to the computations Redux state.
  • Integrate with backend

Add Docker support

Why?

The current way of installing ecPoint-PyCal is via a snap. While this is a very convenient, both the installation and execution of the software requires the user to be in the sudoers list.

Docker is a good solution to tackle this problem, provided we figure out a way to forward the display server to the host.

Note: The most complex step would probably be installation of metview inside the container.

Replace ecCodes with Metview-Python framework

This issue involves rewriting all the loaders (for GRIB, NetCDF, Geopoints) used in the project, with the Python bindings for Metview.

Metview will probably be using the C / F90 version of ecCodes package internally, but this fact should be hidden from the user.

The most important aspect of this issue is to use an efficient replacement for the codes_grib_find_nearest function from ecCodes, that supports use of fieldsets. Write a unit test for the same.

Bump Pandas version to 0.24.0

Why?

Newer version of Pandas is faster and provides pre-compiled wheel packages that speeds up the installation process significantly.

What's stopping us?

Newer versions of Pandas have a bug in the justification of the string repr, on which we rely for (reading from) / (writing to) ascii files.

Update 25/09/2018

The bug was recently fixed in https://github.com/pandas-dev/pandas/pull/22505/files which is a candidate for 0.24.0. We can't fix the issue until a new release is cut.

Refactor Predictands and Predictors logic

  • s/Predictant/Predictand/g
  • Indicate that predictand should always be singular.
  • Split database component into Predictand and Predictors components.
  • Add a radio field for specifying if predictand is an accumulated or instantaneous variable.
  • Move Predictand Errors from Step 2 to Step 1, in the Predictand component.
  • Move accumulation field from Parameters component to Predictand component.

Encode the DB structure in a config file

Structure of the database

Forecasts: /vol/ecpoint/ecPoint_DB/Forecasts/[origin]/[predictant & predictors]/[date-time]/
Observations: /vol/ecpoint/ecPoint_DB/Observations/[predictant]/[type]/[date]/

Name of the files

Forecasts: [variable]_[date]_[time]_[step]
Observations: [variable]_[type]_[date]_[end-of-period]

The structure of the database is IMPORTANT because it will be interrogated by the calibration software.

Allow a choice between FE and FER, but not both

It doesn't make sense for user to compute both the Forecast Error and Forecast Error Ratio at the same time.

On the UI, it should be enough to simply convert the checkbox to a radio. However, we may need to perform some refactoring in the computations framework.

Allow users to define units in the computations UI

Units will mainly serve two purposes:

  • Documentation
  • Assert the fact that some scaling factor was consciously applied to the computations. The user is responsible for making sure that the units correspond well to the scaled values.

The units should be displayed for each computation in the metadata section of the ASCII table.

Improve subprocess management

The Python process, which does the heavy-lifting (sometimes spawning parallel processes) must be the main process. The Electron process must therefore either be:

  • spawned as a subprocess of Python
  • managed independently by an external shell script

List of presentational improvements until the Processing step

Summary of things to fix until Processing step of ecPoint-PyCal, as detailed out by @FatimaPillosu. I'm using this issue to share my progress on each one of those.

General feedback

Create a new section called Model Data, that would contain two sections: Predictand and Predictors. Move the whole section "Select the data type to load" at the very top, and put it in the joint section "Model Data". This is because the fact that we are uploading GRIB applies not only to the predictor, but to both, the predictand and the predictor. See mockup below:

mockup

Input Parameters

  • Select directory of the predictand (rainfall, temperature, etc.) Select the directory that contains the predictand.
  • Code Predictand Code (given by the name of the directory that contains the predictand).
  • Predictand error to compute Type of error that will be computed
  • Enter accumulation (in hours) of the parameter to post-process Enter an accumulation period, in hours, for the predictand (e.g. insert the value "24" for a 24-hourly accumulation period)
    • Allow accumulation periods other than 6, 12, and 24 as well.
  • Select a minimum value to consider, to prevent division by zero. Chosen value must be consistent with units of computed values (defined later) Enter a minimum value for the predictand to prevent dividing by zero (e.g. insert the value "1" for 1 mm/12h). The chosen value must be consistent with the units in which the predictand is represented (1 mm/12h or 0.001 m/12h).
    • This sentence should be on written before the blank space where the user inserts the value.

Observations

  • Select observations Observational data
  • Move this section to the very top, so it would be clear from the beginning which parameter is going to be post-processed.
  • Select directory containing the observations Select the directory that contains the observations
    • Ani's remark: Not sure if this makes things any better. Shorter sentences are usually more likely to be read, and softwares often go for syntactically incomplete sentences to maximize the quantum of meaning communicated per unit word.

Predictors

  • Select directory containing the predictors Select the directory that contains the model data for the calculation of the predictors
  • Code Predictors short names (given by the name of the directory that contains the predictors)
  • Select the data type to load Select the model data type

Parameters

  • Nuke this whole section and move it to the new Model Data.
  • Move the date picker to Model Data and call it Calibration Period, since it has nothing to do with observations.
  • Modified field for Spin-up (see mockup)
  • Modified field for Leadtime (see mockup)

Computations

  • Rename this section to Predictors Selection or Predictors Computation.

Processing

  • Rename this section to Calculations and ASCII Table Generation.
    • Ani's remark: Too long
  • Add more comments to let the user know why we are not using that particular forecast (e.g. t+0 is within the spin-up window). Example below:
    unnamed
  • Do not hard-code list of predictors in the processing logs.
  • Provide a way to retrieve the ASCII file generated inside the Docker container.

Upgrade Electron runtime to v5

Use the latest and the greatest Electron runtime along with Chromium 73+, Node.js 12, and newer V8. This could be a breaking change.

Implement a data loader for NetCDF files

  • Investigate the maturity of MetviewPython's handling of NetCDF files.
  • Write a loader for .nc files using MetviewPython.
  • Implement unit tests.
  • Cleanup legacy NetCDF parser that used dataframes.
  • Update the frontend to choose NetCDF files as input.

Handle errors in Database component

Reproducing the bug: selecting a database path for predictors that is non-standard, crashes the UI.

TODO: The Database component must make sure that the predictors path indeed contains GRIB/NetCDF data.

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.