Changes between Initial Version and Version 1 of Users/SetupNewConfiguration/Data-utilities-with-netcdf
- Timestamp:
- 2017-03-06T15:28:30+01:00 (7 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Users/SetupNewConfiguration/Data-utilities-with-netcdf
v1 v1 1 '''Data utilities with netcdf''' 2 3 You can find here an example of bash script to manipulate netcdf files (in this example forcing core2 files). 4 5 (In this example we extract coordinates and put them in grid_orca2.nc file and then we apply ncpdq to choosen variable). 6 7 This is necessary because "npdq" command change all variables, but in this case we don't want to have glamt, gphit, time "short" type. 8 9 10 {{{ 11 # remove useless variable from file 12 ncks -O -x -v V_10.15JUNE2009_orca2.nc v_10.15JUNE2009_orca2.nc 13 14 }}} 15 16 {{{ 17 18 # exctracting coordinates variables from file, put in output file (grid_orca2.nc) 19 ncks -v glamt,gphit,time v_10.15JUNE2009_orca2.nc grid_orca2.nc 20 }}} 21 22 23 24 {{{ 25 # exctracting variables from file 26 ncks -O -C -v V_10_MOD v_10.15JUNE2009_orca2.nc v_10.15JUNE2009_orca2.nc 27 }}} 28 29 30 31 {{{ 32 # compress all variables of v_10.15JUNE2009_orca2.nc file, 33 # now variables of v_10.15JUNE2009_orca2.nc are "short" type 34 # (add offset and scale factor) 35 ncpdq -O -C -P all_xst v_10.15JUNE2009_orca2.nc v_10.15JUNE2009_orca2.nc 36 }}} 37 38 39 40 {{{ 41 # append grid_orca2.nc file to v_10.15JUNE2009_orca2.nc file to have initial file 42 # with variable V_10_MOD "short" type and coordinates variables unchanged 43 ncks -A grid_orca2.nc v_10.15JUNE2009_orca2.nc 44 }}}