# Abs function error

**URL:** <https://forum.ecmwf.int/t/abs-function-error/1775>\
**Category:** Other - Software and tools\
**Tags:** c3s, toolbox\
**Created:** [4 May 2021 09:04 UTC](https://forum.ecmwf.int/t/abs-function-error/1775 "2021-05-04T09:04:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![lichang\_yin](https://forum.ecmwf.int/letter_avatar_proxy/v4/letter/l/bbe5ce/32.png) [@lichang\_yin](https://forum.ecmwf.int/u/lichang_yin)\
**Post date:** [4 May 2021 09:04 UTC](https://forum.ecmwf.int/t/abs-function-error/1775/1 "2021-05-04T09:04:01Z")

</div>

&nbsp; &nbsp; &nbsp; &nbsp;I want to calculate the daily wind speed from the hourly data of&nbsp;reanalysis-era5-land,&nbsp;&nbsp;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.&nbsp;According to the official document, the abs function is used as abs=&nbsp;ct.operation.abs(data).&nbsp;I used temperature as an example to use the absolute value function, but an error occurred.

Has anyone successfully used the function?&nbsp;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
'}
```

---

<div class="post-metadata">

**Author:** ![lichang\_yin](https://forum.ecmwf.int/letter_avatar_proxy/v4/letter/l/bbe5ce/32.png) [@lichang\_yin](https://forum.ecmwf.int/u/lichang_yin)\
**Post date:** [4 May 2021 09:19 UTC](https://forum.ecmwf.int/t/abs-function-error/1775/2 "2021-05-04T09:19:17Z")

</div>

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