Versions Compared

Key

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

...

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

var_name = "dis06"

ds = xr.open_dataset('./clim_2020111500.nc')

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

# set the coordinate reference system for EFAS
crs = ccrs.LambertAzimuthalEqualArea(central_longitude=10,central_latitude=52,false_easting=4321000,false_northing=3210000)

# define the filter for visualizing only discharge above that value
vmin = 20

# selecting a date
ds = ds[var_name].isel(time=1)

# 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[var_name].plot(ax=ax,cmap=cmap,vmin=vmin,add_colorbar=False)
ax.set_title(f'{ds[var_name].long_name}> {vmin} $m^{3}s^{-1}$')
cbar = plt.colorbar(sc, shrink=.5,)
cbar.set_label(ds[var_name].GRIB_name)



Plot

...

Code Block
languagepy
titleDischarge timeseries forecasts
collapsetrue
import numpy as np
import xarray as xr

Plot Soil Wetness Index Map


Warning
titleNote for when marsurl is ready in production

In the code block below the soild depth will need to be loaded from the netCDF file:

xr.open_dataset('./sd_1.nc')

xr.open_dataset('./sd_2.nc')

xr.open_dataset('./sd_3.nc')

Update the operations accordingly

...