Subversion Repositories lagranto.ocean

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
3 michaesp 1
#!/bin/bash
2
#-----------------
3
 
4
# -- load netcdf
5
module 'load netcdf/4.3.2'
6
 
7
# -- set environment
8
export LAGRANTO="${HOME}/lagranto.ocean/"
9
 
10
# -- set data dir
11
ddir="/atmosdyn/schemms/oras5/cdf"
12
 
13
# -- experiement data dir
14
odir=${ddir}/"2009.2010/backward"
15
mkdir -pv $odir
16
cd $odir 
17
 
18
find -type l -delete
19
 
20
echo "working in: " $PWD
21
 
22
# ---- start date
23
date="20091217_00"
24
 
25
# -- lats/lons
26
lons=( $(seq -50 -1 -60 ) )
27
lats=( $(seq  50  1  60 ) )
28
 
29
# --- LOOP
30
for lat in ${lats[@]}; do
31
for lon in ${lons[@]}; do
32
 
33
 
34
# ---- end date 
35
fdat=$( tim2dat -d -120 $date )
36
fdat=$( tim2dat -d -5 $fdat  )
37
 
38
# --- link bathymetry file
39
ln -s ${ddir}/bath .
40
 
41
# -- current start date of trajectories
42
idat=$date
43
 
44
# -- link all necessary fields for time period
45
while [[ ${idat} != ${fdat} ]]; do
46
 
47
            echo $idat
48
            # -- date of this file
49
            y=$(echo $idat | cut -c1-4)
50
            m=$(echo $idat | cut -c5-6)
51
            d=$(echo $idat | cut -c7-8)
52
            h=$(echo $idat | cut -c9-10)
53
 
54
            # -- link start file
55
            ln -s ${ddir}/P${idat} . &> /dev/null
56
            ln -s ${ddir}/S${idat} . &> /dev/null
57
 
58
            # -- go to next time step
59
            idat=$( tim2dat -d -5 $idat )
60
 
61
done
62
fdat=$( tim2dat -d +5 $fdat  )
63
 
64
# ---- create the startfile
65
 
66
# -- Examples
67
#create_startf.ocean ${date} startf.2 'box.grid(-52,-53,55,55)@profile(0.6,10,20)@m'
68
#create_startf.ocean ${date} startf.2 'line(-55,-47,54,59,40)@profile(0.6,10,20)@m'
69
#create_startf.ocean ${date} startf.2 'circle.grid(-58,58,50)@profile(0.6,3,6)@m'
70
create_startf.ocean ${date} startf.2 'circle.grid('${lon}','${lat}',25)@grid(0,2)@m'
71
 
72
# --- start calculation and output all 24 hours / computing time steps is 12h instead of 10h
73
caltra.ocean ${date} ${fdat} startf.2 traj.1 -j -o 1440
74
 
75
# --- Create the Tracevars file ---
76
\rm tracevars  &> /dev/null
77
cat >> tracevars << end_trace
78
U    1.  0 P
79
V    1.  0 P
80
T    1.  0 P
81
HGT  1.  0 S
82
HFLX 1.  0 S
83
SST  1.  0 S
84
ICE  1.  0 S
85
SSS  1.  0 S
86
WFLX 1.  0 S
87
W10M 1.  0 S
88
SAFLX 1. 0 S
89
THCL 1. 0 S
90
end_trace
91
 
92
# -- trace some variables
93
trace.ocean traj.1 LSL${date}_${lon}_${lat}_backward
94
 
95
# ---
96
find -type l -delete
97
 
98
# --- END
99
done
100
done
101
 
102
exit 0