Versions Compared

Key

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

...

Info

One can download the auxiliary data by simplying requesting the data through a CDS API request.

Using the API request shown on the CDS data download form, it is possible to request one variable at a time


Code Block
languagepy
titleRetrieving a single auxiliary file
collapsetrue
import cdsapi

c = cdsapi.Client()

c.retrieve(
    'efas-forecast',
    {
        'variable': 'upstream_area_v4_0',
        'model_levels': 'surface_level',
        'format': 'netcdf',
        'area': [
            72, -35, 24,
            74,
        ],
    },
    'download.nc')
Warning
titleMARS url adaptor

Currently, we are developing a MARS URL adaptor. It is functioning but needs the review process on the content of the overview page. When the marsurl is made available in production, one can download the auxiliary data by simply requesting the data through a CDS API request:

Note: with the marsurl adaptor, the soil depth is now included as part of the auxiliary data.  Therefore you should remove the soil depth from the CDS API request above (forecast volumetric soil moisture and soil depth).


Code Block
languagepy
titleRetrieve multiple auxiliary files
collapsetrue
import cdsapi

c = cdsapi.Client()

c.retrieve(
    'efas-forecast,
    {

    'efas-forecast',
    {
        'variable': ['soil_depth_v4_0','field_capacity_v4_0','wilting_point_v4_0'],
          'formatmodel_levels': 'netcdfsoil_levels',
        'variablesoil_level': [
   '2',
         'field_capacityformat',: 'wilting_pointnetcdf', 'soil_depth'
        ],'area': [
        'soil_level': [
      72, -35, 24,
          '1', '2', '3' 74,
        ],
    },
    'auxiliary.zip')

Note that area sub-selection is not currently possible for the auxiliary (or time-invariant) data. Therefore any 'area' included in the CDS API request will be ignored and the data downloaded will cover the full EFAS domain.

And then unzip the auxiliary.zip

Code Block
languagebash
themeEmacs
titleunzip
$ unzip auxiliary.zip

Archive:  auxiliary.zip
 extracting: thmaxsd_2_1.nc
 extracting: thmin_14.0.nc
 extracting: thmax_2_4.0.nc
 extracting: thmin_2.nc
 extracting: thmax_3.nc
 extracting: thmin_3_4.0.nc



Plot map discharge

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)

...