source: trunk/LMDZ.PLUTO/util/startarchive2icosa/icosa_finalize.bash @ 3545

Last change on this file since 3545 was 3545, checked in by afalco, 36 hours ago

Pluto: scripts to convert from LMDZ lat lon grid to DYNAMICO icosahedral grid.
AF

  • Property svn:executable set to *
File size: 2.3 KB
Line 
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
8module purge
9LMDZ=${LMDZ:-../trunk/}  #You have to adapt to your own path, can be in your bashrc
10source $LMDZ/XIOS/arch.env
11#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
12module load nco
13
14#conversion to netcdf 3 in order to rename and add variables, not properly done with netcdf4 files
15nccopy -k 'classic' startfi_prefinalize.nc startphy_icosa_nc3.nc
16
17# rename lat and lon variables as latitude and longitude and put result in
18# file startphy.nc
19ncrename -v lon,longitude -v lat,latitude -d cell,physical_points\
20         startphy_icosa_nc3.nc startphy_nc3.nc
21#Temporay soildepth array from Dynamico restartfi
22ncks -A -v soildepth restartfi.nc startphy_nc3.nc #You have to adapt to your own path
23# ncks -A -v subslope_dist restartfi.nc startphy_nc3.nc
24# ncks -A -v def_slope restartfi.nc startphy_nc3.nc
25
26nccopy -k 4 startphy_nc3.nc startfi.nc
27
28#Temporary Time variable from start2archive; should be added with xios
29ncks -O -x -v time_counter startfi.nc startfi.nc_tmp
30ncks -A -v Time start.nc startfi.nc_tmp
31# ncks -A -v flux_geo restartfi.nc startfi.nc_tmp
32# ncks -A -v wstar restartfi.nc startfi.nc_tmp
33# ncks -A -v hmons restartfi.nc startfi.nc_tmp
34# ncks -A -v summit restartfi.nc startfi.nc_tmp
35# ncks -A -v base restartfi.nc startfi.nc_tmp
36cp startfi.nc_tmp startfi.nc
37
38./rearrange_startphy.e > rearrange_startphy.out 2>&1
39
40# make a proper start.nc file based on start_icosa.nc
41cp start_icosa_prefinalize.nc start_icosa.nc
42
43# add u,u_lat,u_lon,bounds_lat_u and bound_lon_u from start_icosa_ref.nc
44ncks -A -v u,lon_u,lat_u,bounds_lon_u,bounds_lat_u \
45     start_icosa_ref.nc start_icosa.nc
46ncrename -d cell,cell_mesh \
47         start_icosa.nc
48ncrename -d nvertex,nvertex_mesh \
49         start_icosa.nc
50ncks -A -v xcell,ycell,zcell \
51     start_icosa_ref.nc start_icosa.nc
52
53ncks -A -v W,geopot,q,nq start_icosa_ref.nc start_icosa.nc
54
55# In the current version of Dynamico, the variable q for tracer is needed but unused.
56# To create this unused variable simply run this short python code
57
58# cleanup
59rm -rf startphy_icosa_nc3.nc startphy_nc3.nc
Note: See TracBrowser for help on using the repository browser.