Skip to content

bxrgem/bris-fiab

 
 

Repository files navigation

Bris in Forecast-in-a-Box

WIP - this is not yet ready to be used for anything.

This contains the neccessary components to run the bris model in anemoi inference and Forecast-in-a-Box. It consists of several parts:

  • Plugins for anemoi-inference
  • A tool to adapt a checkpoint so it can run in anemoi-inference
  • Later, docs for how to add this to Forecast-in-a-Box will be added

Getting started

In order to get started, you need access to a bris checkpoint, such as Cloudy Skies.

Setting up

uv sync

Running inference

uv run main.py

This works around bugs related to running on a mac, at the cost of a little flexibility.

In the future

uv run anemoi-inference run config.yaml

Checkpoint

In order to run, you need a bris checkpoint, and a geotiff file containing orograpghy data for your target area.

Preparing

The original bris checkpoint needs a little manual massaging before it can run with anemoi inference:

uv run anemoi-inference metadata --edit bris-checkpoint.ckpt --editor vim

Find dataset.variables_metadata, and replace with this yaml. Note that there are lots of keys called variables_metadata around the document. Make sure to change the correct one.

Note This will change (not copy) your checkpoint file.

Setting area

You need to modify your checkpoint's graph in order to run for a specific area. For this to work, you need to have a file with orography data for that area.

Getting detailed orography information

One way to get orography data is by adapting data from opentopography. Make sure you download for your exact area.

To help with downloading the orography use:

uv run download_orography.py --area-latlon -8 30 -22 43 --dest-path <hires_topography.tif>

For this to work you need an api-key to access the rest api on opentopography

To create an account on opentopography.org go to https://portal.opentopography.org/login. You will find the API key by pressing menu item MyOpenTopo. Save the key in $HOME/..opentopographyrc. This is a json file with format:

{
  "api_key": "THE API KEY"
}

After having downloaded data from there, you can run a command like this to generate an orography file with the resolution:

gdalwarp -tr 0.05 0.05 -r average <hires_topography.tif> orography.tif

Updating checkpoint

Run the following command to generate a new checkpoint:

uv run update_checkpoint.py \
    --topography-file orography.tif \
    --original-checkpoint bris-checkpoint.ckpt \
    --create-checkpoint new-checkpoint.ckpt

About

Running the bris model in Forecast-in-a-Box

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Python 100.0%