Changes between Version 13 and Version 14 of Documentation/UserGuide/StudyNetCDF
- Timestamp:
- 2020-05-11T16:04:59+02:00 (4 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Documentation/UserGuide/StudyNetCDF
v13 v14 5 5 Last revision: 2020/02/28, B. Guenet [[BR]] 6 6 7 == nco==7 == **nco** == 8 8 9 9 10 10 nco 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 12 We just summarize here some of the most useful nco commands often used in the orchidee context. 13 14 === ncdump 14 15 This command print all the informations stored in your netcdf file. Some prefix can extract only the information you need. 15 16 … … 32 33 }}} 33 34 34 * '''ncrename''' 35 === ncrename 35 36 36 37 This command change the name of a given variable/dimension depending on the prefix you are using … … 41 42 }}} 42 43 43 * To rename a variable a creatinga 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) 44 45 {{{ 45 46 ncrename -v fluxlat,latent_heat_flux myJob_20060101_20061231_1M_sechiba_history.nc mynewfile.nc … … 51 52 }}} 52 53 53 * To rename a variable a creatinga new file (here for 'lon', the longitude)54 * To rename a variable and create a new file (here for 'lon', the longitude) 54 55 {{{ 55 56 ncrename -d lon,longitude myJob_20060101_20061231_1M_sechiba_history.nc mynewfile.nc 56 57 }}} 57 58 58 * '''ncks''' 59 === ncks 60 61 The nco [https://linux.die.net/man/1/ncks "kitchen sink"] offers a wealth of possibilities. 62 63 A very simple example is to append file f1.nc into f2.nc: 64 65 {{{ 66 ncks –A f1.nc f2.c 67 }}} 68 69 You can do do the same for only variables var1 and var2 from f1.nc (f1.nc is not modified in doing so): 70 71 {{{ 72 ncks –v var1,var2 f1.nc var.c 73 }}} 59 74 60 75 If 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 … … 64 79 }}} 65 80 66 * '''ncap2''' 81 === ncrcat, ncra 82 83 These tools are are very useful if you forgot the post-processing of your sechiba output. 84 85 To 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 {{{ 88 ncrcat *nc new.nc 89 }}} 90 91 To restrict the operation to selected variables (var1 and var2 in the example): 92 93 {{{ 94 ncrcat *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 67 100 68 101 The most powerful and quickly evolving tool from the nco set of functions … … 77 110 }}} 78 111 79 80 * '''ncatted''' 112 === ncatted 81 113 82 114 Sometimes, 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