source: trunk/LMDZ.MARS/util/startarchive2icosa/icosa_finalize.bash @ 2883

Last change on this file since 2883 was 2813, checked in by romain.vande, 2 years ago

DYNAMICO MARS
Update startarchive2icosa repertory for new version of Dynamico
RV

  • Property svn:executable set to *
File size: 2.6 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
9source /scratch/cnt0027/lmd1167/adelavois/models/code/XIOS/arch.env #You have to adapt to your own path
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
11module load nco
12
13#conversion to netcdf 3 in order to rename and add variables, not properly done with netcdf4 files
14nccopy -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
18ncrename -v lon,longitude -v lat,latitude -d cell,physical_points\
19         startphy_icosa_nc3.nc startphy_nc3.nc
20# Temporarily added because program is not yet able to read topography
21# SSO parameters are now taken from a dedicated startarchive.nc
22# see start2archive_SSO.f90
23#ncks -A -v albedodat,ZMEA,ZSTD,ZSIG,ZGAM,ZTHE \
24#         startphy_icosa_ref.nc startphy_nc3.nc
25#Temporay soildepth array from Dynamico restartfi
26ncks -A -v soildepth \
27         ../../mars_dynamico_update_basic/startfi_0.nc startphy_nc3.nc #You have to adapt to your own path
28
29nccopy -k 4 startphy_nc3.nc startfi.nc
30
31#Temporary Time variable from start2archive; should be added with xios
32#ncks -A -v Time \
33#         start_archive_nc4.nc startfi.nc
34ncks -O -x -v time_counter startfi.nc startfi.nc_tmp
35ncks -A -v Time start.nc startfi.nc_tmp
36cp startfi.nc_tmp startfi.nc
37
38rearrange_startphy > 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
53# In the current version of Dynamico, the variable q for tracer is needed but unused.
54# To create this unused variable simply run this short python code
55
56#import numpy as np
57#import netCDF4 as nc
58
59#fn = 'start_icosa.nc'
60#ds = nc.Dataset(fn, 'a', format='NETCDF4')
61#nq = ds.createDimension('nq', 7)
62
63#q = ds.createVariable('q', 'f8', ('nq','lev', 'cell_mesh',))
64#nqq = ds.createVariable('nq', 'f8', ('nq',))
65#q[:,:,:]=0.
66#q.online_operation = "once"
67#q.coordinates = "lat lon"
68#ds.close()
69
70# cleanup
71rm -rf startphy_icosa_nc3.nc startphy_nc3.nc
Note: See TracBrowser for help on using the repository browser.