3 |
michaesp |
1 |
|
|
|
2 |
SUBROUTINE special (flag,cmd,tra,ntim,ncol,
|
|
|
3 |
> vars,times,param,nparam)
|
|
|
4 |
|
|
|
5 |
c ***************************************************************************
|
|
|
6 |
c * *
|
|
|
7 |
c * OUTPUT: flag -> 1 if trajectory is selected, 0 if not *
|
|
|
8 |
c * *
|
|
|
9 |
c * INPUT: cmd <- command string *
|
|
|
10 |
c * tra(ntim,ncol) <- single trajectory: indices time,column *
|
|
|
11 |
c * ntim <- number of times *
|
|
|
12 |
c * ncol <- number of columns (including time,lon,lat,p) *
|
|
|
13 |
c * vars(ncol) <- names of columns *
|
|
|
14 |
c * times(ntim) <- List of times
|
|
|
15 |
c * param(nparam) <- parameter values *
|
|
|
16 |
c * nparam <- number of parameters *
|
|
|
17 |
c * *
|
|
|
18 |
c ***************************************************************************
|
|
|
19 |
|
|
|
20 |
implicit none
|
|
|
21 |
|
|
|
22 |
c ---------------------------------------------------------------------------
|
|
|
23 |
c Declaration of subroutine parameters
|
|
|
24 |
c ---------------------------------------------------------------------------
|
|
|
25 |
|
|
|
26 |
integer flag ! Boolean flag whether trajectory is selected
|
|
|
27 |
character*80 cmd ! Command string
|
|
|
28 |
integer ntim,ncol ! Dimension of single trajectory
|
|
|
29 |
real tra(ntim,ncol) ! Single trajectory
|
|
|
30 |
character*80 vars(ncol) ! Name of columns
|
|
|
31 |
real times(ntim) ! List of times
|
|
|
32 |
integer nparam ! # parameters
|
|
|
33 |
real param(nparam) ! List of parameters
|
|
|
34 |
|
|
|
35 |
c ---------------------------------------------------------------------------
|
|
|
36 |
c Declaration of local variables
|
|
|
37 |
c ---------------------------------------------------------------------------
|
|
|
38 |
|
|
|
39 |
integer i
|
|
|
40 |
integer ip,i0,i1
|
|
|
41 |
|
|
|
42 |
c -------------------------------------------------------------------------- %)
|
|
|
43 |
c SPECIAL:WCB:ascent,first,last %)
|
|
|
44 |
c : Detect Warm Conveyor Belts (WCB); the air stream must ascend at least %)
|
|
|
45 |
c : <ascent=param(1)> hPa between the two times <first=param(2)> and %)
|
|
|
46 |
c : <last=param(3)>. Note, the lowest pressure is allowed to occur at any %)
|
|
|
47 |
c : time between <first> and <last>. %)
|
|
|
48 |
c --------------------------------------------------------------------------- %)
|
|
|
49 |
|
|
|
50 |
c if ( cmd.eq.'WCB' ) then
|
|
|
51 |
|
|
|
52 |
c Reset the flag for selection
|
|
|
53 |
c flag = 0
|
|
|
54 |
|
|
|
55 |
c Pressure is in the 4th column
|
|
|
56 |
c ip = 4
|
|
|
57 |
|
|
|
58 |
c Get times
|
|
|
59 |
c i0 = 0
|
|
|
60 |
c i1 = 0
|
|
|
61 |
c do i=1,ntim
|
|
|
62 |
c if ( param(2).eq.times(i) ) i0 = i
|
|
|
63 |
c if ( param(3).eq.times(i) ) i1 = i
|
|
|
64 |
c enddo
|
|
|
65 |
c if ( (i0.eq.0).or.(i1.eq.0) ) then
|
|
|
66 |
c print*,' ERROR: invalid times in SPECIAL:WCB... Stop'
|
|
|
67 |
c stop
|
|
|
68 |
c endif
|
|
|
69 |
|
|
|
70 |
c Check for ascent
|
|
|
71 |
c do i=i0+1,i1
|
|
|
72 |
c if ( ( tra(i0,ip)-tra(i,ip) ) .gt. param(1) ) flag = 1
|
|
|
73 |
c enddo
|
|
|
74 |
|
|
|
75 |
c endif
|
|
|
76 |
|
|
|
77 |
c ----OCEAN ------------------------------------------------------------------ %)
|
|
|
78 |
c SPECIAL:CB:ascent,first,last %)
|
|
|
79 |
c : Detect Conveyor Belts (CB);
|
|
|
80 |
c --------------------------------------------------------------------------- %)
|
|
|
81 |
|
|
|
82 |
if ( cmd.eq.'CB' ) then
|
|
|
83 |
|
|
|
84 |
c Reset the flag for selection
|
|
|
85 |
flag = 0
|
|
|
86 |
|
|
|
87 |
c depth is in the 4th column
|
|
|
88 |
ip = 4
|
|
|
89 |
|
|
|
90 |
c Get times
|
|
|
91 |
i0 = 0
|
|
|
92 |
i1 = 0
|
|
|
93 |
do i=1,ntim
|
|
|
94 |
if ( param(2).eq.times(i) ) i0 = i
|
|
|
95 |
if ( param(3).eq.times(i) ) i1 = i
|
|
|
96 |
enddo
|
|
|
97 |
if ( (i0.eq.0).or.(i1.eq.0) ) then
|
|
|
98 |
print*,' ERROR: invalid times in SPECIAL:CB... Stop'
|
|
|
99 |
stop
|
|
|
100 |
endif
|
|
|
101 |
|
|
|
102 |
c Check for ascent
|
|
|
103 |
do i=i0+1,i1
|
|
|
104 |
if ( ( tra(i0,ip)-tra(i,ip) ) .gt. param(1) ) flag = 1
|
|
|
105 |
enddo
|
|
|
106 |
|
|
|
107 |
endif
|
|
|
108 |
|
|
|
109 |
c ---------------------------------------------------------------------------
|
|
|
110 |
|
|
|
111 |
|
|
|
112 |
end
|