I want to calculate the daily wind speed from the hourly data of reanalysis-era5-land,  but the wind speed data has positive and negative values, and the positive and negative values express different directions.

So the data needs to be absolute. According to the official document, the abs function is used as abs= ct.operation.abs(data). I used temperature as an example to use the absolute value function, but an error occurred.

Has anyone successfully used the function? The source code is as follows:

import cdstoolbox as ct

@ct.application(title='Hello World!')
@ct.output.download()
def application():
data = ct.catalogue.retrieve(
'reanalysis-era5-land',
{
'variable': '2m_temperature',
'product_type': 'reanalysis',
'year': '2017',
'month': '01',
'day': '01',
'time': '1:00'
}

)
abs = ct.operation.abs(data)
return abs

the error is as following:

Traceback (most recent call last):
  File "/opt/cdstoolbox/cdscompute/cdscompute/cdshandlers/services/handler.py", line 55, 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 118, in __call__
    return p(*args, **kwargs)
  File "/opt/cdstoolbox/cdscompute/cdscompute/services.py", line 59, in __call__
    return self.proc(context, *args, **kwargs)
  File "/home/cds/cdsservices/services/retrieve.py", line 167, in execute
    remote = context.call_resource(name, request)
  File "/opt/cdstoolbox/cdscompute/cdscompute/context.py", line 295, in call_resource
    return c.call_resource(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/cdscompute/cdscompute/cdshandlers/services/handler.py", line 55, 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 118, in __call__
    return p(*args, **kwargs)
  File "/opt/cdstoolbox/cdscompute/cdscompute/services.py", line 59, in __call__
    return self.proc(context, *args, **kwargs)
  File "/home/cds/cdsservices/services/mars.py", line 347, in internal
    return mars(context, request, **kwargs)
  File "/home/cds/cdsservices/services/mars.py", line 48, in mars
    execute_mars(context, requests)
  File "/home/cds/cdsservices/services/mars.py", line 192, in execute_mars
    context.run_command("/usr/local/bin/mars", tmp, exception=MarsException)
  File "/opt/cdstoolbox/cdscompute/cdscompute/context.py", line 207, in run_command
    raise exception(call, proc.returncode, output)
home.cds.cdsservices.services.mars.py.MarsException: Mars server task finished in error - BadValue: Invalid time 1:00 [mars] - Error code is -2 - Request failed - Some errors reported
'}


1 Comment

  1. In addition, does the positive and negative wind speed data indicate different directions?