Changes between Version 7 and Version 8 of Documentation/UserGuide/StudyNetCDF

2020-02-28T12:11:16+01:00 (3 years ago)



  • Documentation/UserGuide/StudyNetCDF

    v7 v8  
    4848ncks -H -d height,20 -d temp_atmos_pres,: 
     54Similar to Ferret (see also How To), CDO can also be used to regrid NetCDF files. It is very straight and fast. Contrary to Ferret I [SL] did not find how to increase the memory allocation for CDO. Thus for very large files Ferret seems to be the software of your choice. 
     56The call has the following structure: 
     58cdo -f nc -regriddingMethod, 
     61There are three regridding methods: remapbil (bilinear interpolation), remapbic (bicubic interpolation), remapnn (nearest neighbour), remapcon (conservative regridding). Use remapnn and remapcon to avoid weird values if your variable is heterogeneous. 
     63For the template file with your target grid, it can be any netcdf with regular lat/lon. A trick here is to use "full paths" and not relative paths to the files in order to work. 
     65Some examples: 
     67cdo -f nc -remapbil,/gpfs/cru/rst08auu/code/ 
     68cdo -f nc -remapnn,/gpfs/cru/rst08auu/code/ 
     73== ncap2 == 
     75The most powerful and quickly evolving tool from the nco set of functions 
     77See the file of exemples : {{:reunions_orchidee:ncap2.pdf| ncap2 file}} or search what you are looking on this growing list of answers [[|forum nco]] 
     79A simple exemple showing different capacities (creation of a variable, use of a mask, call to an attribute, count the total and the size of the field (we can restrict this operation to a dimension as shown on the second line) 
     82 ncap2 -O -s 'missing_flag[$y,$x]=0;where(t2m_daily!=t2m_daily@missing_value) missing_flag=1;missing_count=float(;print(missing_count)'  ~/ 
     83 ncap2 -O -s 'missing_flag[$y,$x]=0;where(t2m_daily!=t2m_daily@missing_value) missing_flag=1;missing_count=float($x))/missing_flag.size($x);print(missing_count)'  ~/ 
     87== cdo == 
     89A command that handle many operations one would like to do when working on outputs of models of the Earth System : 
     90  * changing of time axis 
     91  * regridding (many grid are already implemented and it is an even more versatile tool) 
     92  * complex operations... 
     94See the website of the project {{}} or the doc : {{:reunions_orchidee:cdo-manual.pdf| CDO Manual}} and  the  {{:reunions_orchidee:cdo_refcard.pdf | quickref}} 
     98   cdo -v # print list of available operators [[BR]] 
     99   cdo -V # version (if very old, think of downloading the source and install a new version, as it is a tool that is evolving quickly [[BR]] 
     100   cdo -h remapcon # informations about a command [[BR]] 
     101   cdo remapcon,my_grid # conservative regridding to an other resolution [[BR]] 
     105my_grid could be a file like : 
     108   gridtype  = lonlat 
     109   gridsize  = 220 
     110   xname     = longitude 
     111   xunits    = degrees_east 
     112   yname     = latitude 
     113   yunits    = degrees_north 
     114   xsize     = 20 
     115   ysize     = 11 
     116   xfirst    = -18.75 
     117   xinc      = 3.75 
     118   yfirst    = 20 
     125   cdo sinfov #most info on the file 
     126   cdo griddes #grid description (check that the type is not generic (which means unrecognised and thus not useable for mapping 
     129Sometimes, one just need to add the attribute coordinates (linking to the variables defining the longitude and latitude positions) to enable the recognition of the grid that is used (see 
     131   ncatted -a coordinates,my_var,o,c,"nav_lon nav_lat" 
     134or to correct a wrong spelling of an attribute 
     137   ncatted -a units,latitude,m,c,"degrees_north" 
     140== Operator chaining == 
     141It is one of the main features of CDO. Use it as often as possible. But Note: Operatos with a arbitrary list of input files cannot be combined with other operators 
     143# Simple combination: 
     145   cdo sub -dayavg ifile2 -timavg ifile1 ofile 
     149instead of : 
     152  cdo timavg ifile1 tmp1 
     154  cdo dayavg ifile2 tmp2 
     156  cdo sub tmp2 tmp1 ofile 
     158  rm tmp1 tmp2 
     162== To install a newer version than the default one on asterix/obelix == 
     165   get files from 
     166   ./configure --prefix=/home/users/your_ACCOUNT/ --with-netcdf=/usr 
     168   make clean 
     169   make 
     170   make install 
     173If you installed proj and hdf5 libraries somewhere, their can also be support for these file formats : 
     176   ./configure --prefix=/home/users/your_ACCOUNT/ --with-netcdf=/usr --with-proj=/path/to/install --with-hdf5=/path/where/installed