Project

General

Profile

ymonmean average of 0-360 degree field

Added by Fred W almost 5 years ago

Hello,

I have data which contains wind/wave direction variables with units "degree" and values from 0 to 360.
When creating a climatology using ymonmean will the cdo code properly deal with averaging degree values?
(e.g. the numerical average of 6 and 358 is 182, but the average of the angles 6° and 358° is 2°)

This is the ncdump of the variable in question:

        short VMDR(time, latitude, longitude) ;
                VMDR:long_name = "Mean wave direction from (Mdir)" ;
                VMDR:units = "degree" ;
                VMDR:add_offset = 180.f ;
                VMDR:scale_factor = 0.01f ;
                VMDR:_FillValue = -32767s ;
                VMDR:standard_name = "sea_surface_wave_from_direction" ;
                VMDR:cell_methods = "time:point area:mean" ;
                VMDR:type_of_analysis = "spectral analysis" ;
                VMDR:WMO_code = 200 ;
                VMDR:_ChunkSizes = 1, 681, 1440 ;

Thank you
Fred


Replies (4)

RE: ymonmean average of 0-360 degree field - Added by Karin Meier-Fleischer almost 5 years ago

Hi Fred,

can you upload the data.

-Karin

RE: ymonmean average of 0-360 degree field - Added by Fred W almost 5 years ago

Attached is a cropped file containing 6 time steps only
The command to reproduce my scenario would be:

cdo ymonmean global-analysis-forecast-wav-001-027_T_y2019_m04_CROP.nc global-analysis-forecast-wav-001-027_T_y2019_m04_YMONMEAN.nc

I am trying to find out whether the angles are correctly averaged...

Thanks

RE: ymonmean average of 0-360 degree field - Added by Uwe Schulzweida almost 5 years ago

The unit of a variable is not considered in the averaging.
So the average of 6 and 358 is 182 with the operator ymonmean.

RE: ymonmean average of 0-360 degree field - Added by Fred W almost 5 years ago

Could I file a feature request please?
I would like to be able to specify that certain variables should averaged as angles.
Either automatically (based on the unit "degree" or "degrees"), or manually (e.g. a command line options --vardegree VMDR or similar)

With code similar to what's shown here:
[https://rosettacode.org/wiki/Averages/Mean_angle]

If that's not possible,

Could you think of a work around? Convert the degrees into U/V components, average those and then convert back?

Thank you
Fred

    (1-4/4)