1 | #!/bin/ksh |
---|
2 | # |
---|
3 | HOMEDIR=`pwd` |
---|
4 | # |
---|
5 | # Name of the grids in the initial files of each grid |
---|
6 | export srcgridini=torc |
---|
7 | export tgtgridini=lmdz |
---|
8 | # Name of the files containing each grid |
---|
9 | export srcgridfile=grid_model1.nc |
---|
10 | export tgtgridfile=grid_model2.nc |
---|
11 | # Name of the grids in the final files grids_und.nc and masks_und.nc (4 characters) |
---|
12 | export srcgridend=tore |
---|
13 | export tgtgridend=lmde |
---|
14 | # |
---|
15 | # WARNING : the coordinates must be double and the masks must be integer |
---|
16 | # |
---|
17 | RUNDIR=$HOMEDIR/wkdir_${srcgridend}_${tgtgridend} |
---|
18 | DATAGRIDS=$HOMEDIR/data |
---|
19 | # |
---|
20 | [ -d $RUNDIR ] || mkdir $RUNDIR |
---|
21 | cd $RUNDIR |
---|
22 | # |
---|
23 | # Copy grid and mask files for each grid in $RUNDIR |
---|
24 | ln -sf $DATAGRIDS/${srcgridfile} $RUNDIR/${srcgridfile} |
---|
25 | ln -sf $DATAGRIDS/${tgtgridfile} $RUNDIR/${tgtgridfile} |
---|
26 | # |
---|
27 | # In case the variables are defined with "_" and not "." |
---|
28 | ncrename -v ${srcgridini}_lon,${srcgridini}.lon $srcgridfile |
---|
29 | ncrename -v ${srcgridini}_lat,${srcgridini}.lat $srcgridfile |
---|
30 | ncrename -v ${srcgridini}_clo,${srcgridini}.clo $srcgridfile |
---|
31 | ncrename -v ${srcgridini}_cla,${srcgridini}.cla $srcgridfile |
---|
32 | ncrename -v ${srcgridini}_msk,${srcgridini}.msk $srcgridfile |
---|
33 | # |
---|
34 | ncrename -v ${tgtgridini}_lon,${tgtgridini}.lon $tgtgridfile |
---|
35 | ncrename -v ${tgtgridini}_lat,${tgtgridini}.lat $tgtgridfile |
---|
36 | ncrename -v ${tgtgridini}_clo,${tgtgridini}.clo $tgtgridfile |
---|
37 | ncrename -v ${tgtgridini}_cla,${tgtgridini}.cla $tgtgridfile |
---|
38 | ncrename -v ${tgtgridini}_msk,${tgtgridini}.msk $tgtgridfile |
---|
39 | # |
---|
40 | # Construct grids_und.nc and masks_und.nc files (with _) |
---|
41 | echo "Running create_aux_files.ncl" |
---|
42 | cp $HOMEDIR/create_aux_files $RUNDIR/create_aux_files |
---|
43 | ./create_aux_files $srcgridfile $tgtgridfile $srcgridini $tgtgridini $srcgridend $tgtgridend |
---|
44 | # |
---|