[2532] | 1 | #!/usr/bin/bash |
---|
| 2 | # |
---|
| 3 | # Bash script to post-process files startphy_icosa.nc and start_icosa.nc |
---|
| 4 | # generated by start_archive2icosa and create files |
---|
| 5 | # start.nc and startphy.nc (usable as inputs for icosa_lmdz.exe) |
---|
| 6 | |
---|
| 7 | # load nco module |
---|
| 8 | module purge |
---|
[2941] | 9 | source ../trunk/XIOS/arch.env #You have to adapt to your own path |
---|
[2813] | 10 | #module load nco/4.7.9-gcc-4.8.5-hdf5-1.8.18-openmpi-2.0.4 #Example of version of the module needed |
---|
| 11 | module load nco |
---|
[2532] | 12 | |
---|
| 13 | #conversion to netcdf 3 in order to rename and add variables, not properly done with netcdf4 files |
---|
| 14 | nccopy -k 'classic' startfi_prefinalize.nc startphy_icosa_nc3.nc |
---|
| 15 | |
---|
| 16 | # rename lat and lon variables as latitude and longitude and put result in |
---|
| 17 | # file startphy.nc |
---|
| 18 | ncrename -v lon,longitude -v lat,latitude -d cell,physical_points\ |
---|
| 19 | startphy_icosa_nc3.nc startphy_nc3.nc |
---|
| 20 | #Temporay soildepth array from Dynamico restartfi |
---|
[2941] | 21 | ncks -A -v soildepth restartfi.nc startphy_nc3.nc #You have to adapt to your own path |
---|
| 22 | ncks -A -v subslope_dist restartfi.nc startphy_nc3.nc |
---|
| 23 | ncks -A -v def_slope restartfi.nc startphy_nc3.nc |
---|
[2532] | 24 | |
---|
[2813] | 25 | nccopy -k 4 startphy_nc3.nc startfi.nc |
---|
[2532] | 26 | |
---|
| 27 | #Temporary Time variable from start2archive; should be added with xios |
---|
[2813] | 28 | ncks -O -x -v time_counter startfi.nc startfi.nc_tmp |
---|
| 29 | ncks -A -v Time start.nc startfi.nc_tmp |
---|
[2941] | 30 | ncks -A -v flux_geo restartfi.nc startfi.nc_tmp |
---|
| 31 | ncks -A -v wstar restartfi.nc startfi.nc_tmp |
---|
| 32 | ncks -A -v hmons restartfi.nc startfi.nc_tmp |
---|
| 33 | ncks -A -v summit restartfi.nc startfi.nc_tmp |
---|
| 34 | ncks -A -v base restartfi.nc startfi.nc_tmp |
---|
[2813] | 35 | cp startfi.nc_tmp startfi.nc |
---|
[2532] | 36 | |
---|
[2941] | 37 | ./rearrange_startphy > rearrange_startphy.out 2>&1 |
---|
[2532] | 38 | |
---|
| 39 | # make a proper start.nc file based on start_icosa.nc |
---|
| 40 | cp start_icosa_prefinalize.nc start_icosa.nc |
---|
| 41 | |
---|
| 42 | # add u,u_lat,u_lon,bounds_lat_u and bound_lon_u from start_icosa_ref.nc |
---|
| 43 | ncks -A -v u,lon_u,lat_u,bounds_lon_u,bounds_lat_u \ |
---|
| 44 | start_icosa_ref.nc start_icosa.nc |
---|
| 45 | ncrename -d cell,cell_mesh \ |
---|
| 46 | start_icosa.nc |
---|
| 47 | ncrename -d nvertex,nvertex_mesh \ |
---|
| 48 | start_icosa.nc |
---|
| 49 | ncks -A -v xcell,ycell,zcell \ |
---|
| 50 | start_icosa_ref.nc start_icosa.nc |
---|
| 51 | |
---|
[2941] | 52 | ncks -A -v W,geopot,q,nq start_icosa_ref.nc start_icosa.nc |
---|
| 53 | |
---|
[2813] | 54 | # In the current version of Dynamico, the variable q for tracer is needed but unused. |
---|
| 55 | # To create this unused variable simply run this short python code |
---|
| 56 | |
---|
[2532] | 57 | # cleanup |
---|
| 58 | rm -rf startphy_icosa_nc3.nc startphy_nc3.nc |
---|