Changes between Version 13 and Version 14 of Documentation/UserGuide/StudyNetCDF


Ignore:
Timestamp:
2020-05-11T16:04:59+02:00 (4 years ago)
Author:
aducharne
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Documentation/UserGuide/StudyNetCDF

    v13 v14  
    55Last revision: 2020/02/28, B. Guenet [[BR]] 
    66 
    7 == nco == 
     7== **nco** == 
    88 
    99 
    1010nco is a very powerful tool to print data, modify variable names, concatenate, etc on netcdf file. A detailled documentation can be found here http://nco.sourceforge.net/ 
    11 We will just summarize here some of the most useful nco commands often used in the orchidee context. 
    12  
    13  * '''ncdump'''  
     11 
     12We just summarize here some of the most useful nco commands often used in the orchidee context. 
     13 
     14=== ncdump 
    1415This command print all the informations stored in your netcdf file. Some prefix can extract only the information you need. 
    1516 
     
    3233}}} 
    3334 
    34  * '''ncrename'''  
     35=== ncrename 
    3536 
    3637This command change the name of a given variable/dimension depending on the prefix you are using 
     
    4142}}} 
    4243 
    43    * To rename a variable a creating a new file (here for 'fluxlat', the latent heat flux) 
     44   * To rename a variable and create a new file (here for 'fluxlat', the latent heat flux) 
    4445{{{ 
    4546ncrename -v fluxlat,latent_heat_flux myJob_20060101_20061231_1M_sechiba_history.nc mynewfile.nc 
     
    5152}}} 
    5253 
    53    * To rename a variable a creating a new file (here for 'lon', the longitude) 
     54   * To rename a variable and create a new file (here for 'lon', the longitude) 
    5455{{{ 
    5556ncrename -d lon,longitude myJob_20060101_20061231_1M_sechiba_history.nc mynewfile.nc 
    5657}}} 
    5758 
    58   * '''ncks'''  
     59=== ncks 
     60 
     61The nco [https://linux.die.net/man/1/ncks "kitchen sink"] offers a wealth of possibilities. 
     62 
     63A very simple example is to append file f1.nc into f2.nc: 
     64 
     65{{{ 
     66ncks –A f1.nc f2.c  
     67}}} 
     68 
     69You can do do the same for only variables var1 and var2 from f1.nc (f1.nc is not modified in doing so): 
     70 
     71{{{ 
     72ncks –v var1,var2 f1.nc var.c  
     73}}} 
    5974 
    6075If you would like to remove a certain time series from a netcdf file (for instance, in this example, all data from 'temp_atmos_pres' in the file jamescdf.nc for which the height dimension is 20) with the output written to jamestest.nc 
     
    6479}}} 
    6580 
    66  * '''ncap2'''  
     81=== ncrcat, ncra 
     82 
     83These tools are are very useful if you forgot the post-processing of your sechiba output.  
     84 
     85To concatenate several nc files over time, you can use [https://linux.die.net/man/1/ncrcat ncrcat]. The example below can be used on all the sechiba_history.nc files in your Output directory to create a large nc file combining all variables and all years. You get a multi-variable TS file: 
     86 
     87{{{ 
     88ncrcat *nc new.nc  
     89}}} 
     90 
     91To restrict the operation to selected variables (var1 and var2 in the example): 
     92 
     93{{{ 
     94ncrcat *nc –v var1,var2 new.nc  
     95}}} 
     96 
     97[https://linux.die.net/man/1/ncra ncra] does the same with a time average, to get climatologies. 
     98 
     99=== ncap2  
    67100 
    68101The most powerful and quickly evolving tool from the nco set of functions 
     
    77110}}} 
    78111 
    79  
    80  * '''ncatted''' 
     112=== ncatted 
    81113 
    82114Sometimes, 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. In that cases the ncatted command might be useful