Project

General

Profile

Zonal mean

Added by Florencia Iacovone over 2 years ago

Hi everyone!
I have a netCDF file of sea level pressure. I want to calculate the zonal average for a specific latitude (40°S). Do you know how to solve it?

I use zonmean but it calculates: for every latitude the mean over all longitudes is computed. With that I got an average value for every latitude, and I want it for a particular latitude.

I hope you can help me! Thanks.

Florencia


Replies (5)

RE: Zonal mean - Added by Florencia Iacovone over 2 years ago

Florencia Iacovone wrote:

Hi everyone!
I have a netCDF file of sea level pressure. I want to calculate the zonal average for a specific latitude (40°S). Do you know how to solve it?

I use zonmean but it calculates: for every latitude the mean over all longitudes is computed. With that I got an average value for every latitude, and I want it for a particular latitude.

I hope you can help me! Thanks.

Florencia

RE: Zonal mean - Added by Karin Meier-Fleischer about 2 years ago

Hi Florencia,

you can select the wanted latitude by the operator sellonlatbox. You have to give CDO a latmin and latmax which range contains only one latitude value (in your case 40°S) within. Here is an example

cdo -zonmean -sellonlatbox,-180.,180.,39.,41. infile outfile

RE: Zonal mean - Added by Florencia Iacovone about 2 years ago

Hi Karin !
Thank you for your response. Unfortunately it does not work because: " cdo sellonlatbox (Abort): Latitudinal dimension is too small! ".

I attached the file that I need to manipulated.

RE: Zonal mean - Added by Karin Meier-Fleischer about 2 years ago

The lon and lat values of anom_psl_ACCESS-CM2_1979_D.nc:

 lon = 0.9375, 2.8125, 4.6875, 6.5625, 8.4375, 10.3125, 12.1875, 14.0625, 
    15.9375, 17.8125, 19.6875, 21.5625, 23.4375, 25.3125, 27.1875, 29.0625, 
    30.9375, 32.8125, 34.6875, 36.5625, 38.4375, 40.3125, 42.1875, 44.0625, 
    45.9375, 47.8125, 49.6875, 51.5625, 53.4375, 55.3125, 57.1875, 59.0625, 
    60.9375, 62.8125, 64.6875, 66.5625, 68.4375, 70.3125, 72.1875, 74.0625, 
    75.9375, 77.8125, 79.6875, 81.5625, 83.4375, 85.3125, 87.1875, 89.0625, 
    90.9375, 92.8125, 94.6875, 96.5625, 98.4375, 100.3125, 102.1875, 
    104.0625, 105.9375, 107.8125, 109.6875, 111.5625, 113.4375, 115.3125, 
    117.1875, 119.0625, 120.9375, 122.8125, 124.6875, 126.5625, 128.4375, 
    130.3125, 132.1875, 134.0625, 135.9375, 137.8125, 139.6875, 141.5625, 
    143.4375, 145.3125, 147.1875, 149.0625, 150.9375, 152.8125, 154.6875, 
    156.5625, 158.4375, 160.3125, 162.1875, 164.0625, 165.9375, 167.8125, 
    169.6875, 171.5625, 173.4375, 175.3125, 177.1875, 179.0625, 180.9375, 
    182.8125, 184.6875, 186.5625, 188.4375, 190.3125, 192.1875, 194.0625, 
    195.9375, 197.8125, 199.6875, 201.5625, 203.4375, 205.3125, 207.1875, 
    209.0625, 210.9375, 212.8125, 214.6875, 216.5625, 218.4375, 220.3125, 
    222.1875, 224.0625, 225.9375, 227.8125, 229.6875, 231.5625, 233.4375, 
    235.3125, 237.1875, 239.0625, 240.9375, 242.8125, 244.6875, 246.5625, 
    248.4375, 250.3125, 252.1875, 254.0625, 255.9375, 257.8125, 259.6875, 
    261.5625, 263.4375, 265.3125, 267.1875, 269.0625, 270.9375, 272.8125, 
    274.6875, 276.5625, 278.4375, 280.3125, 282.1875, 284.0625, 285.9375, 
    287.8125, 289.6875, 291.5625, 293.4375, 295.3125, 297.1875, 299.0625, 
    300.9375, 302.8125, 304.6875, 306.5625, 308.4375, 310.3125, 312.1875, 
    314.0625, 315.9375, 317.8125, 319.6875, 321.5625, 323.4375, 325.3125, 
    327.1875, 329.0625, 330.9375, 332.8125, 334.6875, 336.5625, 338.4375, 
    340.3125, 342.1875, 344.0625, 345.9375, 347.8125, 349.6875, 351.5625, 
    353.4375, 355.3125, 357.1875, 359.0625 ;

 lat = -89.375, -88.125, -86.875, -85.625, -84.375, -83.125, -81.875, 
    -80.625, -79.375, -78.125, -76.875, -75.625, -74.375, -73.125, -71.875, 
    -70.625, -69.375, -68.125, -66.875, -65.625, -64.375, -63.125, -61.875, 
    -60.625, -59.375, -58.125, -56.875, -55.625, -54.375, -53.125, -51.875, 
    -50.625, -49.375, -48.125, -46.875, -45.625, -44.375, -43.125, -41.875, 
    -40.625, -39.375, -38.125, -36.875, -35.625, -34.375, -33.125, -31.875, 
    -30.625, -29.375, -28.125, -26.875, -25.625, -24.375, -23.125, -21.875, 
    -20.625, -19.375, -18.125, -16.875, -15.625, -14.375, -13.125, -11.875, 
    -10.625, -9.375, -8.125, -6.875, -5.625, -4.375, -3.125, -1.875, -0.625, 
    0.625, 1.875, 3.125, 4.375, 5.625, 6.875, 8.125, 9.375, 10.625, 11.875, 
    13.125, 14.375, 15.625, 16.875, 18.125, 19.375, 20.625, 21.875, 23.125, 
    24.375, 25.625, 26.875, 28.125, 29.375, 30.625, 31.875, 33.125, 34.375, 
    35.625, 36.875, 38.125, 39.375, 40.625, 41.875, 43.125, 44.375, 45.625, 
    46.875, 48.125, 49.375, 50.625, 51.875, 53.125, 54.375, 55.625, 56.875, 
    58.125, 59.375, 60.625, 61.875, 63.125, 64.375, 65.625, 66.875, 68.125, 
    69.375, 70.625, 71.875, 73.125, 74.375, 75.625, 76.875, 78.125, 79.375, 
    80.625, 81.875, 83.125, 84.375, 85.625, 86.875, 88.125, 89.375 ;

Compute the zonal mean for lat=40.625

cdo -zonmean -sellonlatbox,0.9375,359.0625,40.,41. anom_psl_ACCESS-CM2_1979_D.nc out.nc
cdo(1) sellonlatbox: Process started
cdo(1) sellonlatbox: Processed 27648 values from 1 variable over 1 timestep.
cdo    zonmean: Processed 192 values from 1 variable over 1 timestep [0.02s 20MB].
cdo sinfon out.nc
   File format : NetCDF4 classic
    -1 : Institut Source   T Steptype Levels Num    Points Num Dtype : Parameter name
     1 : unknown  ACCESS-CM2 v instant       1   1         1   1  F32  : psl           
   Grid coordinates :
     1 : lonlat                   : points=1 (1x1)
                              lon : 0 degrees_east
                              lat : 40.625 degrees_north
   Vertical coordinates :
     1 : surface                  : levels=1
   Time coordinate :
                             time : 1 step
     RefTime =  1850-01-01 00:00:00  Units = days  Calendar = proleptic_gregorian  Bounds = true
  YYYY-MM-DD hh:mm:ss  YYYY-MM-DD hh:mm:ss  YYYY-MM-DD hh:mm:ss  YYYY-MM-DD hh:mm:ss
  1979-12-16 12:00:00
cdo infon out.nc
    -1 :       Date     Time   Level Gridsize    Miss :     Minimum        Mean     Maximum : Parameter name
     1 : 1979-12-16 12:00:00       0        1       0 :                  1.3444             : psl

RE: Zonal mean - Added by Florencia Iacovone about 2 years ago

Thank you very much, it works !

    (1-5/5)