[Show Toolbox request] and [Not yet Toolbox compatible] buttons on CDS Download forms

import cdstoolbox as ct

@ct.application(title='Download data')
@ct.output.download()
def download_application():
    data = ct.catalogue.retrieve(
        'reanalysis-era5-single-levels',
        {
            'product_type': 'reanalysis',
            'variable': [
                'mean_wave_direction', 'peak_wave_period', 'significant_height_of_combined_wind_waves_and_swell',
            ],
            'year': '2017',
            'month': '06',
            'day': ['01', '02', '03',],
            'time': ['00:00', '03:00', '06:00', '09:00', '12:00', '15:00', '18:00', '21:00',],
            'grid': [0.25, 0.25], # added
            'area': [-10, 5, -45, 45,],
            'format': 'netcdf', # added
        },
        'download.nc'
    )
    return data


Hi All,

I'm trying to download the 0.25 degree WAM data using the python code about on CDS toolbox but I can't seem to get what I'm looking for?

The data I get is for 'mean_wave_direction parameter only and for 1978. I'm not sure what to do. The old ECMWF MARS had a data of that resolution before.

Could you please assist me with regard?

Kind regards,

Bafana

This applies to some CDS datasets and means that the dataset is not ready to be used in the CDS Toolbox. The most likely reason for this is that the variables in the dataset are not yet compatible with the CDS common data model.

When creating a toolbox request and trying to copy this without any changes to the toolbox editor and then hitting "run" I get a long error message.

Hi,

This has literally been changed right now and the Toolbox request you get from the download form are now "copy-pastable" in the Toolbox.

The Toolbox request will run assuming all the mandatory fields have been ticked.

Always start testing it with small amounts of data to make sure things run.

Regards.

Vivien 

Thank you.

I created a very simple request:

"Show Toolbox request":


import cdstoolbox as ct

data = ct.catalogue.retrieve(
‘reanalysis-era5-single-levels’,
{
‘product_type’:‘reanalysis’,
‘variable’:[
‘10m_u_component_of_wind’,‘10m_v_component_of_wind’
],
‘year’:‘2019’,
‘month’:‘01’,
‘day’:‘01’,
‘time’:‘00:00’,
‘format’:‘grib’
})


>> Post to Toolbox API endpoint:




I get an error in the console:

Traceback (most recent call last):
  File "/opt/cdstoolbox/cdsapp/cdsapp/gaia_rest.py", line 806, in deploy_app
    knowledge.fetch_application(realm, project, version)
  File "/opt/cdstoolbox/cdslib/cdslib/knowledge.py", line 230, in fetch_application
    raise KeyError('Unknown application: %r, %r, %r' % (realm, project, version))
KeyError: "Unknown application: '30125', 'toolbox-request', '212f92d482414d74c7e1a54e5eedd274e533f8a8'"

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/cdstoolbox/cdslib/cdslib/tool_manager.py", line 161, in func
    raise ex
  File "/opt/cdstoolbox/cdslib/cdslib/tool_manager.py", line 190, in add_tools_to_c3s
    import cdscdm  # noqa
ModuleNotFoundError: No module named 'cdscdm'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/hug/interface.py", line 709, in __call__
    self.render_content(self.call_function(input_parameters), request, response, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/hug/interface.py", line 649, in call_function
    return self.interface(**parameters)
  File "/usr/local/lib/python3.6/site-packages/hug/interface.py", line 100, in __call__
    return __hug_internal_self._function(*args, **kwargs)
  File "/opt/cdstoolbox/cdsapp/cdsapp/gaia_rest.py", line 657, in save_app_api
    sdk_version=sdk_version, **kwargs
  File "/opt/cdstoolbox/cdsapp/cdsapp/gaia_rest.py", line 637, in save_app
    sdk_version=sdk_version, **kwargs
  File "/opt/cdstoolbox/cdsapp/cdsapp/gaia_rest.py", line 808, in deploy_app
    app_conf_json = application_config(realm, project, version, request=request, sdk_version=sdk_version, **kwargs)
  File "/opt/cdstoolbox/cdsapp/cdsapp/gaia_rest.py", line 769, in application_config
    workflow_module = runpy.run_path(workflow_path)
  File "/usr/lib64/python3.6/runpy.py", line 263, in run_path
    pkg_name=pkg_name, script_name=fname)
  File "/usr/lib64/python3.6/runpy.py", line 96, in _run_module_code
    mod_name, mod_spec, pkg_name, script_name)
  File "/usr/lib64/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/tmp/30125/toolbox-request/212f92d482414d74c7e1a54e5eedd274e533f8a8/workflows.py", line 14, in <module>
    'format':'grib'
  File "/opt/cdstoolbox/cdslib/cdslib/tool_manager.py", line 163, in func
    raise ValueError("Calling of fake object")
ValueError: Calling of fake object




Hi,


You might have to refresh your browser but the new "Show Toolbox request" should now look like that:


import cdstoolbox as ct

@ct.application(title=‘Download data’)
@ct.output.download()
def download_application():
data = ct.catalogue.retrieve(
‘reanalysis-era5-single-levels’,
{
‘product_type’: ‘reanalysis’,
‘variable’: [
‘10m_u_component_of_wind’, ‘10m_v_component_of_wind’,
],
‘month’: ‘01’,
‘day’: ‘01’,
‘time’: ‘00:00’,
‘year’: ‘2019’,
}
)
return data

The code above runs but only returns the first variable, you can fix this like that:

import cdstoolbox as ct

@ct.application(title=‘Download data’)
@ct.output.download()
@ct.output.download()
def download_application():
data1, data2 = ct.catalogue.retrieve(
‘reanalysis-era5-single-levels’,
{
‘product_type’: ‘reanalysis’,
‘variable’: [
‘10m_u_component_of_wind’, ‘10m_v_component_of_wind’,
],
‘month’: ‘01’,
‘day’: ‘01’,
‘time’: ‘00:00’,
‘year’: ‘2019’,
}
)
return data1, data2

Thank you!

That works now (smile)

The "old" toolbox request also had a line

'format': 'grib' 

So I was hoping to be able to download the file in grib format by adding this to the abovementioned toolbox command. But the download file type remains still NetCFD.

With the web request it is possible to download grib files but there unfortunately no area selection can be made (as in the toolbox API) to reduce file size.


Hi,

the only way to get grib files on a selected area is using the CDS API. The toolbox converts the retrieved data to an internal representation which can then only be downloaded in NetCDF format.


Michela