Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Table of Content Zone

Table of Contents


Set up the environment

EFAS

Retrieve data

These exercises require EFAS model output parameters and auxiliary data. You can retrieve them using the CDS API, as described in the code block below:

...

Code Block
languagepy
titleRetrieve EFAS auxiliary data
collapsetrue


Plot map discharge

In order to plot a map, we are going to use 

Code Block
languagepy
titleDischarge map
collapsetrue
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
import cartopy.feature as cf
import numpy as np
import pandas as pd
import xarray as xr

ds = xr.open_dataset('../data/clim_19910300.nc')


cmap = plt.cm.get_cmap('jet').copy()
cmap.set_under('white')

crs = ccrs.LambertAzimuthalEqualArea(central_longitude=10,central_latitude=52,false_easting=4321000,false_northing=3210000)

# Plot map discharge > 20 m/s
fig, ax = plt.subplots(1,1,subplot_kw={'projection': crs}, figsize=(20,20) )
ax.gridlines(crs=crs, linestyle="-")
ax.coastlines()
ax.add_feature(cf.BORDERS)
sc = ds["dis06"].plot(ax=ax,cmap=cmap,vmin=20,add_colorbar=False)
cbar = plt.colorbar(sc, shrink=.5,)
cbar.set_label(ds.dis06.GRIB_name)

...