Project

General

Profile

Printing CDO results to the terminal?

Added by Walter Hannah about 9 years ago

I'd really like to have a set of commands to quickly check some basic things about some climate model output. The most basic thing is to print the monthly or yearly global averages of surface temperature from a series of netcdf files.

I realize I can't just do:

cdo yearmean output.*.nc

because it wants an output file.

I also tried using something like this:

cdo infon -fldmean -selvar,TS output.*.nc

And this works for a single file, but for multiple files it just spits out the spatial average for every time.

I also tried messing around with the "output" cdo command, but so far this hasn't worked either.

Does anyone have a good way to achieve this?

Thanks,
Walter Hannah


Replies (1)

RE: Printing CDO results to the terminal? - Added by Ralf Mueller about 9 years ago

Try wildcards with quotation:

cdo -s -infov  -fldmean -yearmean -select,name=water_u 'year_201*'

This prints
ram@luthien:~/local/data/cdo cdo -s infov  -fldmean -yearmean -select,name=water_u 'year_201*'                                                                                                                                                                                                                                                                                                                                                                             [10:12:59|15-09-08]
    -1 :       Date     Time   Level Gridsize    Miss :     Minimum        Mean     Maximum : Parameter name
     1 : 2013-05-01 00:00:00       0        1       0 :               -0.026452             : water_u       
     2 : 2014-05-01 00:00:00       0        1       0 :               -0.026955             : water_u       

For minimal output, you could use the outputkey operator

ram@luthien:~/local/data/cdo cdo -s outputkey,date,time,value  -fldmean -yearmean -select,name=water_u 'year_201*'                                                                                                                                                                                                                                                                                                                                                         [10:14:57|15-09-08]
#      date     time    value 
 2013-05-01 00:00:00 -0.0264521 
 2014-05-01 00:00:00 -0.0269546 

input files look like this:
ram@luthien:~/local/data/cdo cdo sinfov year_201*                                                                                                                                                                                                                                                                                                                                                                                                                          [10:13:03|15-09-08]
   File format : netCDF
    -1 : Institut Source   Ttype    Levels Num    Points Num Dtype : Parameter name
     1 : unknown  HYCOM    instant       1   1     64800   1  I16  : water_temp    
     2 : unknown  HYCOM    instant       1   1     64800   1  I16  : salinity      
     3 : unknown  HYCOM    instant       1   2     64800   1  I16  : surf_el       
     4 : unknown  HYCOM    instant       1   1     64800   1  I16  : water_u       
     5 : unknown  HYCOM    instant       1   1     64800   1  I16  : water_v       
   Grid coordinates :
     1 : lonlat                   : points=64800 (360x180)
                              lon : 0 to 359 by 1 degrees_east  circular
                              lat : -89.5 to 89.5 by 1 degrees_north
   Vertical coordinates :
     1 : generic                  : levels=1
                            depth : 0 meter
     2 : surface                  : levels=1
   Time coordinate :  1 step
     RefTime =  2000-01-01 00:00:00  Units = hours  Calendar = standard
  YYYY-MM-DD hh:mm:ss  YYYY-MM-DD hh:mm:ss  YYYY-MM-DD hh:mm:ss  YYYY-MM-DD hh:mm:ss
  2013-05-01 00:00:00
   File format : netCDF
    -2 : Institut Source   Ttype    Levels Num    Points Num Dtype : Parameter name
     1 : unknown  HYCOM    instant       1   1     64800   1  I16  : water_temp    
     2 : unknown  HYCOM    instant       1   1     64800   1  I16  : salinity      
     3 : unknown  HYCOM    instant       1   2     64800   1  I16  : surf_el       
     4 : unknown  HYCOM    instant       1   1     64800   1  I16  : water_u       
     5 : unknown  HYCOM    instant       1   1     64800   1  I16  : water_v       
   Grid coordinates :
     1 : lonlat                   : points=64800 (360x180)
                              lon : 0 to 359 by 1 degrees_east  circular
                              lat : -89.5 to 89.5 by 1 degrees_north
   Vertical coordinates :
     1 : generic                  : levels=1
                            depth : 0 meter
     2 : surface                  : levels=1
   Time coordinate :  1 step
     RefTime =  2000-01-01 00:00:00  Units = hours  Calendar = standard
  YYYY-MM-DD hh:mm:ss  YYYY-MM-DD hh:mm:ss  YYYY-MM-DD hh:mm:ss  YYYY-MM-DD hh:mm:ss
  2014-05-01 00:00:00
cdo sinfon: Processed 10 variables over 2 timesteps ( 0.00s )

hth
ralf

    (1-1/1)