I receive an error trying to download some variables of CERRA single level reanalysis using CDS toolbox using the suggested toolbox request. For example, the following request for "2m_temperature":
import cdstoolbox as ct @ct.application(title='Download data') @ct.output.download() def download_application(): data = ct.catalogue.retrieve( 'reanalysis-cerra-single-levels', { 'variable': '2m_temperature', 'level_type': 'surface_or_atmosphere', 'data_type': 'reanalysis', 'product_type': 'analysis', 'year': '2020', 'month': '01', 'day': '01', 'time': '00:00', } ) return data
Returns the following error:
Traceback (most recent call last):
File "/opt/cdstoolbox/cdscompute/cdscompute/cdshandlers/services/handler.py", line 59, in handle_request
result = cached(context.method, proc, context, context.args, context.kwargs)
File "/opt/cdstoolbox/cdscompute/cdscompute/caching.py", line 108, in cached
result = proc(context, *context.args, **context.kwargs)
File "/opt/cdstoolbox/cdscompute/cdscompute/services.py", line 124, in __call__
return p(*args, **kwargs)
File "/opt/cdstoolbox/cdscompute/cdscompute/services.py", line 60, in __call__
return self.proc(context, *args, **kwargs)
File "/home/cds/cdsservices/services/retrieve.py", line 200, in execute
**retrieve_kwargs
File "/opt/cdstoolbox/cdscompute/cdscompute/context.py", line 301, in call
return c.call(service, *args, **kwargs).value
File "/opt/cdstoolbox/cdsworkflows/cdsworkflows/future.py", line 76, in value
raise self._result
cdsworkflows.error.ClientError: {'traceback': 'Traceback (most recent call last):
File "/opt/cdstoolbox/cdscdm/cdscdm/gridded.py", line 204, in convert_variable
var, convert_to, convert_from
File "/opt/cdstoolbox/cdscdm/cdscdm/units.py", line 67, in convert_units
target.values, source_units=source_units, target_units=target_units)
File "/opt/cdstoolbox/cdscdm/cdscdm/udunits2.py", line 147, in convert_units
_convert_units_custom(source, source_units, target_units)
File "/opt/cdstoolbox/cdscdm/cdscdm/udunits2.py", line 114, in _convert_units_custom
convert_units_inplace(values, source_units, target_units)
File "/opt/cdstoolbox/cdscdm/cdscdm/udunits2.py", line 125, in convert_units_inplace
converter = get_converter(source_units, target_units)
File "/opt/cdstoolbox/cdscdm/cdscdm/udunits2.py", line 80, in get_converter
raise ValueError("Can't convert %r to %r." % (source_units, target_units))
ValueError: Can't convert 'K' to '1'.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File “/opt/cds/cdsinf/python/lib/cdsinf/runner/dispatcher.py”, line 617, in handle_request
context.get(“method_config”, None))
File “/opt/cdstoolbox/cdscompute/cdscompute/cdshandlers/services/handler.py”, line 59, in handle_request
result = cached(context.method, proc, context, context.args, context.kwargs)
File “/opt/cdstoolbox/cdscompute/cdscompute/caching.py”, line 108, in cached
result = proc(context, *context.args, **context.kwargs)
File “/opt/cdstoolbox/cdscompute/cdscompute/services.py”, line 124, in call
return p(*args, **kwargs)
File “/opt/cdstoolbox/cdscompute/cdscompute/services.py”, line 60, in call
return self.proc(context, *args, **kwargs)
File “/home/cds/cdsservices/services/cdm_translate.py”, line 66, in execute
retrieve_kwargs=retrieve_kwargs
File “/opt/cdstoolbox/cdscdm/cdscdm/gridded.py”, line 755, in open_dataset
strict=strict, remove_grib=remove_grib
File “/opt/cdstoolbox/cdscdm/cdscdm/gridded.py”, line 546, in transform_dataset
var = transform_variable(var, var_spec)
File “/opt/cdstoolbox/cdscdm/cdscdm/gridded.py”, line 237, in transform_variable
raise ValueError(‘Conversion error for variable %r (%r)’ % (var.name, original_var_name)) from exc
ValueError: Conversion error for variable ‘t2m’ (‘t2m’)
'}
The same error is returned when trying to download '10m_wind_speed', except it includes in the error message:
ValueError: Can't convert 'm s**-1' to '1'.
Downloading 'snow_depth', and 'surface_pressure' had also failed. However, the suggested toolbox request does work for some other variables (eg. tested on 'medium_cloud_cover' and 'liquid_volumetric_soil_moisture').
The error message suggests that there is an error in converting the units, however my code does not call for unit conversion. It seems like something on the client side (i.e., request handler for the dataset). Concerningly, the the same error message has been reported using when downloading UERRA - Access to wind direction, however, their request does work for me as of 2023-08-14.
The issue may also be related to this post for ERA-5 variables, however I do not know how to obtain the request request based on the Request ID (0ee966ba-5a47-42a9-acde-0265378f2185).