3 |
michaesp |
1 |
program getmima
|
|
|
2 |
C ===============
|
|
|
3 |
|
|
|
4 |
C Get the minimum and maximum of a variable either
|
|
|
5 |
C in the whole 3d data domain, or an a specified pressure or
|
|
|
6 |
C theta level.
|
|
|
7 |
C The program is invoked by the shell-script getmima.
|
|
|
8 |
C
|
|
|
9 |
C August 96 H. Wernli
|
|
|
10 |
|
|
|
11 |
implicit none
|
|
|
12 |
|
|
|
13 |
integer nzmax,ntmax
|
|
|
14 |
parameter(nzmax=100,ntmax=200)
|
|
|
15 |
|
|
|
16 |
real,allocatable, dimension (:) :: sp,varf,field,varl,tt
|
|
|
17 |
integer stat
|
|
|
18 |
|
|
|
19 |
real time(ntmax),level
|
|
|
20 |
character*80 cdfnam,cstnam,varnam,tvar,clev
|
|
|
21 |
character*20 vnam(100)
|
|
|
22 |
character*1 mode
|
|
|
23 |
integer cdfid,cstid,ierr,ndim,vardim(4)
|
|
|
24 |
real dx,dy,mdv,varmin(4),varmax(4),stag(4)
|
|
|
25 |
real aklev(nzmax),bklev(nzmax),aklay(nzmax),bklay(nzmax),
|
|
|
26 |
> ak(nzmax),bk(nzmax)
|
|
|
27 |
logical prelev
|
|
|
28 |
integer nx,ny,nz,ntimes,ipom,nvars
|
|
|
29 |
real pollon,pollat,xphys,yphys
|
|
|
30 |
integer i,n
|
|
|
31 |
integer imin,jmin,imax,jmax,minind,maxind,kmin,kmax,hmin,hmax
|
|
|
32 |
real min,max,lonmin,latmin,lonmax,latmax,pmin,pmax,tmin,tmax
|
|
|
33 |
|
|
|
34 |
real lmstolm,phstoph
|
|
|
35 |
|
|
|
36 |
integer iargc
|
|
|
37 |
character*(80) arg
|
|
|
38 |
integer flag
|
|
|
39 |
|
|
|
40 |
c check for sufficient requested arguments
|
|
|
41 |
if (iargc().lt.2) then
|
|
|
42 |
print*,'USAGE: getmima filename var ',
|
|
|
43 |
> '[lev in the form Pval or Tval]'
|
|
|
44 |
call exit(1)
|
|
|
45 |
endif
|
|
|
46 |
|
|
|
47 |
c read and transform input
|
|
|
48 |
call getarg(1,arg)
|
|
|
49 |
cdfnam=trim(arg)
|
|
|
50 |
|
|
|
51 |
call getarg(2,arg)
|
|
|
52 |
varnam=trim(arg)
|
|
|
53 |
|
|
|
54 |
if (iargc().eq.3) then
|
|
|
55 |
call getarg(3,arg)
|
|
|
56 |
mode=arg(1:1)
|
|
|
57 |
clev=arg(2:len(arg))
|
|
|
58 |
call checkchar(clev,".",flag)
|
|
|
59 |
if (flag.eq.0) clev=trim(clev)//"."
|
|
|
60 |
read(clev,'(f10.2)') level
|
|
|
61 |
else
|
|
|
62 |
mode='X'
|
|
|
63 |
level=0.
|
|
|
64 |
endif
|
|
|
65 |
|
|
|
66 |
prelev=.true.
|
|
|
67 |
|
|
|
68 |
min= 1.e19
|
|
|
69 |
max=-1.e19
|
|
|
70 |
|
|
|
71 |
C Open files and get infos about data domain
|
|
|
72 |
|
|
|
73 |
call cdfopn(trim(cdfnam),cdfid,ierr)
|
|
|
74 |
call getcfn(cdfid,cstnam,ierr)
|
|
|
75 |
call cdfopn(trim(cstnam),cstid,ierr)
|
|
|
76 |
call getdef(cdfid,trim(varnam),ndim,mdv,vardim,
|
|
|
77 |
> varmin,varmax,stag,ierr)
|
|
|
78 |
if (ierr.ne.0) goto 920
|
|
|
79 |
|
|
|
80 |
C Get the data array and the levels
|
|
|
81 |
|
|
|
82 |
nx=vardim(1)
|
|
|
83 |
ny=vardim(2)
|
|
|
84 |
call gettimes(cdfid,time,ntimes,ierr)
|
|
|
85 |
|
|
|
86 |
call getgrid(cstid,dx,dy,ierr)
|
|
|
87 |
call getlevs(cstid,nz,aklev,bklev,aklay,bklay,ierr)
|
|
|
88 |
call getpole(cstid,pollon,pollat,ierr)
|
|
|
89 |
|
|
|
90 |
C Get memory for dynamic arrays
|
|
|
91 |
|
|
|
92 |
allocate(sp(nx*ny),stat=stat)
|
|
|
93 |
if (stat.ne.0) print*,'*** error allocating array sp ***'
|
|
|
94 |
allocate(varf(nx*ny),stat=stat)
|
|
|
95 |
if (stat.ne.0) print*,'*** error allocating array varf ***'
|
|
|
96 |
allocate(varl(nx*ny*nz),stat=stat)
|
|
|
97 |
if (stat.ne.0) print*,'*** error allocating array varl ***'
|
|
|
98 |
allocate(tt(nx*ny*nz),stat=stat)
|
|
|
99 |
if (stat.ne.0) print*,'*** error allocating array tt ***'
|
|
|
100 |
allocate(field(nx*ny*nz),stat=stat)
|
|
|
101 |
if (stat.ne.0) print*,'*** error allocating array field ***'
|
|
|
102 |
|
|
|
103 |
do n=1,ntimes
|
|
|
104 |
|
|
|
105 |
call getdat(cdfid,trim(varnam),time(n),0,field,ierr)
|
|
|
106 |
|
|
|
107 |
C Define the appropriate ak and bk-arrays
|
|
|
108 |
|
|
|
109 |
if (stag(3).eq.0.) then
|
|
|
110 |
do i=1,nz
|
|
|
111 |
ak(i)=aklev(i)
|
|
|
112 |
bk(i)=bklev(i)
|
|
|
113 |
enddo
|
|
|
114 |
else
|
|
|
115 |
do i=1,nz
|
|
|
116 |
ak(i)=aklay(i)
|
|
|
117 |
bk(i)=bklay(i)
|
|
|
118 |
enddo
|
|
|
119 |
endif
|
|
|
120 |
|
|
|
121 |
do i=1,nz
|
|
|
122 |
if (bk(i).ne.0.) prelev=.false.
|
|
|
123 |
enddo
|
|
|
124 |
|
|
|
125 |
if (.not.prelev) call getdat(cdfid,'PS',time(n),0,sp,ierr)
|
|
|
126 |
|
|
|
127 |
C Determine name of "temperature variable"
|
|
|
128 |
|
|
|
129 |
call getvars(cdfid,nvars,vnam,ierr)
|
|
|
130 |
tvar="T"
|
|
|
131 |
do i=1,nvars
|
|
|
132 |
if (vnam(i).eq."THETA") tvar="THETA"
|
|
|
133 |
if (vnam(i).eq."TH") tvar="TH"
|
|
|
134 |
enddo
|
|
|
135 |
|
|
|
136 |
C If required do interpolation on pressure or theta level
|
|
|
137 |
|
|
|
138 |
if (mode.eq.'P') then
|
|
|
139 |
call pres(varl,sp,nx,ny,nz,ak,bk)
|
|
|
140 |
call vipo(field,varl,level,varf,nx,ny,nz,mdv,ipom)
|
|
|
141 |
else if (mode.eq.'T') then
|
|
|
142 |
if (tvar.eq.'T') then
|
|
|
143 |
call getdat(cdfid,'T',time(n),0,tt,ierr)
|
|
|
144 |
call pottemp(varl,tt,sp,nx,ny,nz,ak,bk)
|
|
|
145 |
call thipo(field,varl,level,varf,nx,ny,nz,mdv,ipom)
|
|
|
146 |
else
|
|
|
147 |
call getdat(cdfid,tvar,time(n),0,varl,ierr)
|
|
|
148 |
call thipo(field,varl,level,varf,nx,ny,nz,mdv,ipom)
|
|
|
149 |
endif
|
|
|
150 |
endif
|
|
|
151 |
|
|
|
152 |
C Determine minimum and maximum and calculate their location
|
|
|
153 |
|
|
|
154 |
if (mode.ne.'X') then
|
|
|
155 |
do i=1,nx*ny
|
|
|
156 |
if ((varf(i).ne.mdv).and.(varf(i).lt.min)) then
|
|
|
157 |
min=varf(i)
|
|
|
158 |
minind=i
|
|
|
159 |
tmin=time(n)
|
|
|
160 |
else if ((varf(i).ne.mdv).and.(varf(i).gt.max)) then
|
|
|
161 |
max=varf(i)
|
|
|
162 |
maxind=i
|
|
|
163 |
tmax=time(n)
|
|
|
164 |
endif
|
|
|
165 |
enddo
|
|
|
166 |
imin=mod(minind-1,nx)+1
|
|
|
167 |
jmin=int((minind-1)/nx)+1
|
|
|
168 |
imax=mod(maxind-1,nx)+1
|
|
|
169 |
jmax=int((maxind-1)/nx)+1
|
|
|
170 |
lonmin=varmin(1)+(imin-1)*dx
|
|
|
171 |
latmin=varmin(2)+(jmin-1)*dy
|
|
|
172 |
pmin=level
|
|
|
173 |
lonmax=varmin(1)+(imax-1)*dx
|
|
|
174 |
latmax=varmin(2)+(jmax-1)*dy
|
|
|
175 |
pmax=level
|
|
|
176 |
else
|
|
|
177 |
do i=1,nx*ny*nz
|
|
|
178 |
if ((field(i).ne.mdv).and.(field(i).lt.min)) then
|
|
|
179 |
min=field(i)
|
|
|
180 |
minind=i
|
|
|
181 |
tmin=time(n)
|
|
|
182 |
else if ((field(i).ne.mdv).and.(field(i).gt.max)) then
|
|
|
183 |
max=field(i)
|
|
|
184 |
maxind=i
|
|
|
185 |
tmax=time(n)
|
|
|
186 |
endif
|
|
|
187 |
enddo
|
|
|
188 |
imin=mod(mod(minind-1,nx*ny),nx)+1
|
|
|
189 |
jmin=int(mod(minind-1,nx*ny)/nx)+1
|
|
|
190 |
imax=mod(mod(maxind-1,nx*ny),nx)+1
|
|
|
191 |
jmax=int(mod(maxind-1,nx*ny)/nx)+1
|
|
|
192 |
kmin=int((minind-1)/(nx*ny))+1
|
|
|
193 |
kmax=int((maxind-1)/(nx*ny))+1
|
|
|
194 |
hmin=imin+(jmin-1)*nx
|
|
|
195 |
hmax=imax+(jmax-1)*ny
|
|
|
196 |
lonmin=varmin(1)+(imin-1)*dx
|
|
|
197 |
latmin=varmin(2)+(jmin-1)*dy
|
|
|
198 |
pmin=ak(kmin)+bk(kmin)*sp(hmin)
|
|
|
199 |
lonmax=varmin(1)+(imax-1)*dx
|
|
|
200 |
latmax=varmin(2)+(jmax-1)*dy
|
|
|
201 |
pmax=ak(kmax)+bk(kmax)*sp(hmax)
|
|
|
202 |
endif
|
|
|
203 |
|
|
|
204 |
if ((pollon.ne.0.).or.(pollat.ne.90.)) then
|
|
|
205 |
xphys=lmstolm(latmin,lonmin,pollat,pollon)
|
|
|
206 |
yphys=phstoph(latmin,lonmin,pollat,pollon)
|
|
|
207 |
lonmin=xphys
|
|
|
208 |
latmin=yphys
|
|
|
209 |
xphys=lmstolm(latmax,lonmax,pollat,pollon)
|
|
|
210 |
yphys=phstoph(latmax,lonmax,pollat,pollon)
|
|
|
211 |
lonmax=xphys
|
|
|
212 |
latmax=yphys
|
|
|
213 |
endif
|
|
|
214 |
|
|
|
215 |
enddo
|
|
|
216 |
|
|
|
217 |
write(*,101)min,max,lonmin,latmin,nint(pmin),tmin,
|
|
|
218 |
> lonmax,latmax,nint(pmax),tmax
|
|
|
219 |
101 format(2f10.3,2f8.2,i6,f6.1,2f8.2,i6,f6.1)
|
|
|
220 |
|
|
|
221 |
call clscdf(cdfid,ierr)
|
|
|
222 |
call clscdf(cstid,ierr)
|
|
|
223 |
|
|
|
224 |
goto 999
|
|
|
225 |
|
|
|
226 |
920 stop '*** error: variable not found on file ***'
|
|
|
227 |
999 continue
|
|
|
228 |
end
|
|
|
229 |
|
|
|
230 |
subroutine vipo(var3d,varl,lev,var,nx,ny,nz,mdv,ipom)
|
|
|
231 |
C =====================================================
|
|
|
232 |
|
|
|
233 |
C Interpolates the 3d variable var3d on the surface defined
|
|
|
234 |
C by lev of the variable varl. The interpolated field is
|
|
|
235 |
C returned as var.
|
|
|
236 |
C ipom determines the way of vertical interpolation:
|
|
|
237 |
C ipom=0 is for linear interpolation
|
|
|
238 |
C ipom=1 is for logarithmic interpolation
|
|
|
239 |
|
|
|
240 |
integer nx,ny,nz,ipom
|
|
|
241 |
real lev,mdv
|
|
|
242 |
real var3d(nx,ny,nz),varl(nx,ny,nz),var(nx,ny)
|
|
|
243 |
|
|
|
244 |
integer i,j,k
|
|
|
245 |
real kind
|
|
|
246 |
real int3dm
|
|
|
247 |
|
|
|
248 |
do i=1,nx
|
|
|
249 |
do j=1,ny
|
|
|
250 |
|
|
|
251 |
do k=1,nz-1
|
|
|
252 |
if ((varl(i,j,k).ge.lev).and.(varl(i,j,k+1).le.lev)) then
|
|
|
253 |
kind=float(k)+(varl(i,j,k)-lev)/
|
|
|
254 |
> (varl(i,j,k)-varl(i,j,k+1))
|
|
|
255 |
goto 100
|
|
|
256 |
endif
|
|
|
257 |
enddo
|
|
|
258 |
100 continue
|
|
|
259 |
|
|
|
260 |
var(i,j)=int3dm(var3d,nx,ny,nz,float(i),float(j),kind,mdv)
|
|
|
261 |
|
|
|
262 |
enddo
|
|
|
263 |
enddo
|
|
|
264 |
|
|
|
265 |
return
|
|
|
266 |
end
|
|
|
267 |
|
|
|
268 |
subroutine thipo(var3d,th3d,lev,var,nx,ny,nz,mdv,mode)
|
|
|
269 |
C ======================================================
|
|
|
270 |
|
|
|
271 |
C Interpolates the 3d variable var3d on the isentropic surface
|
|
|
272 |
C defined by lev. The interpolated field is returned as var.
|
|
|
273 |
C th3d denotes the 3d theta array.
|
|
|
274 |
C mode determines the way of vertical interpolation:
|
|
|
275 |
C mode=0 is for linear interpolation
|
|
|
276 |
C mode=1 is for logarithmic interpolation
|
|
|
277 |
|
|
|
278 |
integer nx,ny,nz,mode
|
|
|
279 |
real lev,mdv
|
|
|
280 |
real var3d(nx,ny,nz),th3d(nx,ny,nz),var(nx,ny)
|
|
|
281 |
|
|
|
282 |
integer i,j,k
|
|
|
283 |
real kind
|
|
|
284 |
real int3dm
|
|
|
285 |
|
|
|
286 |
do i=1,nx
|
|
|
287 |
do j=1,ny
|
|
|
288 |
|
|
|
289 |
do k=1,nz-1
|
|
|
290 |
if ((th3d(i,j,k).le.lev).and.(th3d(i,j,k+1).ge.lev)) then
|
|
|
291 |
kind=float(k)+(th3d(i,j,k)-lev)/
|
|
|
292 |
> (th3d(i,j,k)-th3d(i,j,k+1))
|
|
|
293 |
goto 100
|
|
|
294 |
endif
|
|
|
295 |
enddo
|
|
|
296 |
100 continue
|
|
|
297 |
|
|
|
298 |
var(i,j)=int3dm(var3d,nx,ny,nz,float(i),float(j),kind,mdv)
|
|
|
299 |
|
|
|
300 |
enddo
|
|
|
301 |
enddo
|
|
|
302 |
|
|
|
303 |
return
|
|
|
304 |
end
|
|
|
305 |
|
|
|
306 |
subroutine checkchar(string,char,flag)
|
|
|
307 |
C ======================================
|
|
|
308 |
|
|
|
309 |
character*(*) string
|
|
|
310 |
character*(1) char
|
|
|
311 |
integer n,flag
|
|
|
312 |
|
|
|
313 |
flag=0
|
|
|
314 |
do n=1,len(string)
|
|
|
315 |
if (string(n:n).eq.char) then
|
|
|
316 |
flag=n
|
|
|
317 |
return
|
|
|
318 |
endif
|
|
|
319 |
enddo
|
|
|
320 |
end
|
|
|
321 |
|
|
|
322 |
real function int3d(ar,n1,n2,n3,rid,rjd,rkd)
|
|
|
323 |
c-----------------------------------------------------------------------
|
|
|
324 |
c Purpose:
|
|
|
325 |
c This subroutine interpolates a 3d-array to an arbitrary
|
|
|
326 |
c location within the grid.
|
|
|
327 |
c Arguments:
|
|
|
328 |
c ar real input surface pressure, define as ar(n1,n2,n3)
|
|
|
329 |
c n1,n2,n3 int input dimensions of ar
|
|
|
330 |
c ri,rj,rk real input grid location to be interpolated to
|
|
|
331 |
c History:
|
|
|
332 |
c-----------------------------------------------------------------------
|
|
|
333 |
|
|
|
334 |
c argument declarations
|
|
|
335 |
integer n1,n2,n3
|
|
|
336 |
real ar(n1,n2,n3), rid,rjd,rkd
|
|
|
337 |
|
|
|
338 |
c local declarations
|
|
|
339 |
integer i,j,k,ip1,jp1,kp1,ih,jh,kh
|
|
|
340 |
real frac0i,frac0j,frac0k,frac1i,frac1j,frac1k,ri,rj,rk
|
|
|
341 |
|
|
|
342 |
c do linear interpolation
|
|
|
343 |
ri=amax1(1.,amin1(float(n1),rid))
|
|
|
344 |
rj=amax1(1.,amin1(float(n2),rjd))
|
|
|
345 |
rk=amax1(1.,amin1(float(n3),rkd))
|
|
|
346 |
ih=nint(ri)
|
|
|
347 |
jh=nint(rj)
|
|
|
348 |
kh=nint(rk)
|
|
|
349 |
|
|
|
350 |
c Check for interpolation in i
|
|
|
351 |
* if (abs(float(ih)-ri).lt.1.e-3) then
|
|
|
352 |
* i =ih
|
|
|
353 |
* ip1=ih
|
|
|
354 |
* else
|
|
|
355 |
i =min0(int(ri),n1-1)
|
|
|
356 |
ip1=i+1
|
|
|
357 |
* endif
|
|
|
358 |
|
|
|
359 |
c Check for interpolation in j
|
|
|
360 |
if (abs(float(jh)-rj).lt.1.e-3) then
|
|
|
361 |
j =jh
|
|
|
362 |
jp1=jh
|
|
|
363 |
else
|
|
|
364 |
j =min0(int(rj),n2-1)
|
|
|
365 |
jp1=j+1
|
|
|
366 |
endif
|
|
|
367 |
|
|
|
368 |
c Check for interpolation in k
|
|
|
369 |
* if (abs(float(kh)-rk).lt.1.e-3) then
|
|
|
370 |
* k =kh
|
|
|
371 |
* kp1=kh
|
|
|
372 |
* else
|
|
|
373 |
k =min0(int(rk),n3-1)
|
|
|
374 |
kp1=k+1
|
|
|
375 |
* endif
|
|
|
376 |
|
|
|
377 |
if (k.eq.kp1) then
|
|
|
378 |
c no interpolation in k
|
|
|
379 |
if ((i.eq.ip1).and.(j.eq.jp1)) then
|
|
|
380 |
c no interpolation at all
|
|
|
381 |
int3d=ar(i,j,k)
|
|
|
382 |
c print *,'int3d 00: ',rid,rjd,rkd,int3d
|
|
|
383 |
else
|
|
|
384 |
c horizontal interpolation only
|
|
|
385 |
frac0i=ri-float(i)
|
|
|
386 |
frac0j=rj-float(j)
|
|
|
387 |
frac1i=1.-frac0i
|
|
|
388 |
frac1j=1.-frac0j
|
|
|
389 |
int3d = ar(i ,j ,k ) * frac1i * frac1j
|
|
|
390 |
& + ar(i ,jp1,k ) * frac1i * frac0j
|
|
|
391 |
& + ar(ip1,j ,k ) * frac0i * frac1j
|
|
|
392 |
& + ar(ip1,jp1,k ) * frac0i * frac0j
|
|
|
393 |
c print *,'int3d 10: ',rid,rjd,rkd,int3d
|
|
|
394 |
endif
|
|
|
395 |
else
|
|
|
396 |
frac0k=rk-float(k)
|
|
|
397 |
frac1k=1.-frac0k
|
|
|
398 |
if ((i.eq.ip1).and.(j.eq.jp1)) then
|
|
|
399 |
c vertical interpolation only
|
|
|
400 |
int3d = ar(i ,j ,k ) * frac1k
|
|
|
401 |
& + ar(i ,j ,kp1) * frac0k
|
|
|
402 |
c print *,'int3d 01: ',rid,rjd,rkd,int3d
|
|
|
403 |
else
|
|
|
404 |
c full 3d interpolation
|
|
|
405 |
frac0i=ri-float(i)
|
|
|
406 |
frac0j=rj-float(j)
|
|
|
407 |
frac1i=1.-frac0i
|
|
|
408 |
frac1j=1.-frac0j
|
|
|
409 |
int3d = ar(i ,j ,k ) * frac1i * frac1j * frac1k
|
|
|
410 |
& + ar(i ,jp1,k ) * frac1i * frac0j * frac1k
|
|
|
411 |
& + ar(ip1,j ,k ) * frac0i * frac1j * frac1k
|
|
|
412 |
& + ar(ip1,jp1,k ) * frac0i * frac0j * frac1k
|
|
|
413 |
& + ar(i ,j ,kp1) * frac1i * frac1j * frac0k
|
|
|
414 |
& + ar(i ,jp1,kp1) * frac1i * frac0j * frac0k
|
|
|
415 |
& + ar(ip1,j ,kp1) * frac0i * frac1j * frac0k
|
|
|
416 |
& + ar(ip1,jp1,kp1) * frac0i * frac0j * frac0k
|
|
|
417 |
c print *,'int3d 11: ',rid,rjd,rkd,int3d
|
|
|
418 |
endif
|
|
|
419 |
endif
|
|
|
420 |
end
|
|
|
421 |
real function int3dm(ar,n1,n2,n3,rid,rjd,rkd,misdat)
|
|
|
422 |
c-----------------------------------------------------------------------
|
|
|
423 |
c Purpose:
|
|
|
424 |
c This subroutine interpolates a 3d-array to an arbitrary
|
|
|
425 |
c location within the grid. The interpolation includes the
|
|
|
426 |
c testing of the missing data flag 'misdat'.
|
|
|
427 |
c Arguments:
|
|
|
428 |
c ar real input surface pressure, define as ar(n1,n2,n3)
|
|
|
429 |
c n1,n2,n3 int input dimensions of ar
|
|
|
430 |
c ri,rj,rk real input grid location to be interpolated to
|
|
|
431 |
c misdat real input missing data flag (on if misdat<>0)
|
|
|
432 |
c Warning:
|
|
|
433 |
c This routine has not yet been seriously tested
|
|
|
434 |
c History:
|
|
|
435 |
c-----------------------------------------------------------------------
|
|
|
436 |
|
|
|
437 |
c argument declarations
|
|
|
438 |
integer n1,n2,n3
|
|
|
439 |
real ar(n1,n2,n3), rid,rjd,rkd, misdat
|
|
|
440 |
|
|
|
441 |
c local declarations
|
|
|
442 |
integer i,j,k,ip1,jp1,kp1,ih,jh,kh
|
|
|
443 |
real frac0i,frac0j,frac0k,frac1i,frac1j,frac1k,ri,rj,rk,int3d
|
|
|
444 |
|
|
|
445 |
c check if routine without missing data checking can be called instead
|
|
|
446 |
if (misdat.eq.0.) then
|
|
|
447 |
int3dm=int3d(ar,n1,n2,n3,rid,rjd,rkd)
|
|
|
448 |
return
|
|
|
449 |
endif
|
|
|
450 |
|
|
|
451 |
c do linear interpolation
|
|
|
452 |
ri=amax1(1.,amin1(float(n1),rid))
|
|
|
453 |
rj=amax1(1.,amin1(float(n2),rjd))
|
|
|
454 |
rk=amax1(1.,amin1(float(n3),rkd))
|
|
|
455 |
ih=nint(ri)
|
|
|
456 |
jh=nint(rj)
|
|
|
457 |
kh=nint(rk)
|
|
|
458 |
|
|
|
459 |
c Check for interpolation in i
|
|
|
460 |
* if (abs(float(ih)-ri).lt.1.e-3) then
|
|
|
461 |
* i =ih
|
|
|
462 |
* ip1=ih
|
|
|
463 |
* else
|
|
|
464 |
i =min0(int(ri),n1-1)
|
|
|
465 |
ip1=i+1
|
|
|
466 |
* endif
|
|
|
467 |
|
|
|
468 |
c Check for interpolation in j
|
|
|
469 |
* if (abs(float(jh)-rj).lt.1.e-3) then
|
|
|
470 |
* j =jh
|
|
|
471 |
* jp1=jh
|
|
|
472 |
* else
|
|
|
473 |
j =min0(int(rj),n2-1)
|
|
|
474 |
jp1=j+1
|
|
|
475 |
* endif
|
|
|
476 |
|
|
|
477 |
c Check for interpolation in k
|
|
|
478 |
* if (abs(float(kh)-rk).lt.1.e-3) then
|
|
|
479 |
* k =kh
|
|
|
480 |
* kp1=kh
|
|
|
481 |
* else
|
|
|
482 |
k =min0(int(rk),n3-1)
|
|
|
483 |
kp1=k+1
|
|
|
484 |
* endif
|
|
|
485 |
|
|
|
486 |
if (k.eq.kp1) then
|
|
|
487 |
c no interpolation in k
|
|
|
488 |
if ((i.eq.ip1).and.(j.eq.jp1)) then
|
|
|
489 |
c no interpolation at all
|
|
|
490 |
if (misdat.eq.ar(i,j,k)) then
|
|
|
491 |
int3dm=misdat
|
|
|
492 |
else
|
|
|
493 |
int3dm=ar(i,j,k)
|
|
|
494 |
endif
|
|
|
495 |
c print *,'int3dm 00: ',rid,rjd,rkd,int3dm
|
|
|
496 |
else
|
|
|
497 |
c horizontal interpolation only
|
|
|
498 |
if ((misdat.eq.ar(i ,j ,k )).or.
|
|
|
499 |
& (misdat.eq.ar(i ,jp1,k )).or.
|
|
|
500 |
& (misdat.eq.ar(ip1,j ,k )).or.
|
|
|
501 |
& (misdat.eq.ar(ip1,jp1,k ))) then
|
|
|
502 |
int3dm=misdat
|
|
|
503 |
else
|
|
|
504 |
frac0i=ri-float(i)
|
|
|
505 |
frac0j=rj-float(j)
|
|
|
506 |
frac1i=1.-frac0i
|
|
|
507 |
frac1j=1.-frac0j
|
|
|
508 |
int3dm = ar(i ,j ,k ) * frac1i * frac1j
|
|
|
509 |
& + ar(i ,jp1,k ) * frac1i * frac0j
|
|
|
510 |
& + ar(ip1,j ,k ) * frac0i * frac1j
|
|
|
511 |
& + ar(ip1,jp1,k ) * frac0i * frac0j
|
|
|
512 |
c print *,'int3dm 10: ',rid,rjd,rkd,int3dm
|
|
|
513 |
endif
|
|
|
514 |
endif
|
|
|
515 |
else
|
|
|
516 |
frac0k=rk-float(k)
|
|
|
517 |
frac1k=1.-frac0k
|
|
|
518 |
if ((i.eq.ip1).and.(j.eq.jp1)) then
|
|
|
519 |
c vertical interpolation only
|
|
|
520 |
if ((misdat.eq.ar(i ,j ,k )).or.
|
|
|
521 |
& (misdat.eq.ar(i ,j ,kp1))) then
|
|
|
522 |
int3dm=misdat
|
|
|
523 |
else
|
|
|
524 |
int3dm = ar(i ,j ,k ) * frac1k
|
|
|
525 |
& + ar(i ,j ,kp1) * frac0k
|
|
|
526 |
c print *,'int3dm 01: ',rid,rjd,rkd,int3dm
|
|
|
527 |
endif
|
|
|
528 |
else
|
|
|
529 |
c full 3d interpolation
|
|
|
530 |
if ((misdat.eq.ar(i ,j ,k )).or.
|
|
|
531 |
& (misdat.eq.ar(i ,jp1,k )).or.
|
|
|
532 |
& (misdat.eq.ar(ip1,j ,k )).or.
|
|
|
533 |
& (misdat.eq.ar(ip1,jp1,k )).or.
|
|
|
534 |
& (misdat.eq.ar(i ,j ,kp1)).or.
|
|
|
535 |
& (misdat.eq.ar(i ,jp1,kp1)).or.
|
|
|
536 |
& (misdat.eq.ar(ip1,j ,kp1)).or.
|
|
|
537 |
& (misdat.eq.ar(ip1,jp1,kp1))) then
|
|
|
538 |
int3dm=misdat
|
|
|
539 |
else
|
|
|
540 |
frac0i=ri-float(i)
|
|
|
541 |
frac0j=rj-float(j)
|
|
|
542 |
frac1i=1.-frac0i
|
|
|
543 |
frac1j=1.-frac0j
|
|
|
544 |
int3dm = ar(i ,j ,k ) * frac1i * frac1j * frac1k
|
|
|
545 |
& + ar(i ,jp1,k ) * frac1i * frac0j * frac1k
|
|
|
546 |
& + ar(ip1,j ,k ) * frac0i * frac1j * frac1k
|
|
|
547 |
& + ar(ip1,jp1,k ) * frac0i * frac0j * frac1k
|
|
|
548 |
& + ar(i ,j ,kp1) * frac1i * frac1j * frac0k
|
|
|
549 |
& + ar(i ,jp1,kp1) * frac1i * frac0j * frac0k
|
|
|
550 |
& + ar(ip1,j ,kp1) * frac0i * frac1j * frac0k
|
|
|
551 |
& + ar(ip1,jp1,kp1) * frac0i * frac0j * frac0k
|
|
|
552 |
c print *,'int3dm 11: ',rid,rjd,rkd,int3dm
|
|
|
553 |
endif
|
|
|
554 |
endif
|
|
|
555 |
endif
|
|
|
556 |
end
|
|
|
557 |
|
|
|
558 |
|
|
|
559 |
subroutine pottemp(pt,t,sp,ie,je,ke,ak,bk)
|
|
|
560 |
c ==========================================
|
|
|
561 |
|
|
|
562 |
c argument declaration
|
|
|
563 |
integer ie,je,ke
|
|
|
564 |
real pt(ie,je,ke),t(ie,je,ke),sp(ie,je),
|
|
|
565 |
> ak(ke),bk(ke)
|
|
|
566 |
|
|
|
567 |
c variable declaration
|
|
|
568 |
integer i,j,k
|
|
|
569 |
real rdcp,tzero
|
|
|
570 |
data rdcp,tzero /0.286,273.15/
|
|
|
571 |
|
|
|
572 |
c statement-functions for the computation of pressure
|
|
|
573 |
real pp,psrf
|
|
|
574 |
integer is
|
|
|
575 |
pp(is)=ak(is)+bk(is)*psrf
|
|
|
576 |
|
|
|
577 |
c computation of potential temperature
|
|
|
578 |
do i=1,ie
|
|
|
579 |
do j=1,je
|
|
|
580 |
psrf=sp(i,j)
|
|
|
581 |
do k=1,ke
|
|
|
582 |
c distinction of temperature in K and deg C
|
|
|
583 |
if (t(i,j,k).lt.100.) then
|
|
|
584 |
pt(i,j,k)=(t(i,j,k)+tzero)*( (1000./pp(k))**rdcp )
|
|
|
585 |
else
|
|
|
586 |
pt(i,j,k)=t(i,j,k)*( (1000./pp(k))**rdcp )
|
|
|
587 |
endif
|
|
|
588 |
enddo
|
|
|
589 |
enddo
|
|
|
590 |
enddo
|
|
|
591 |
end
|
|
|
592 |
|
|
|
593 |
subroutine pres(pr,sp,ie,je,ke,ak,bk)
|
|
|
594 |
c =====================================
|
|
|
595 |
c argument declaration
|
|
|
596 |
integer ie,je,ke
|
|
|
597 |
real,intent(OUT) :: pr(ie,je,ke)
|
|
|
598 |
real,intent(IN) :: sp(ie,je)
|
|
|
599 |
real,intent(IN) :: ak(ke),bk(ke)
|
|
|
600 |
|
|
|
601 |
c variable declaration
|
|
|
602 |
integer i,j,k
|
|
|
603 |
|
|
|
604 |
c computation pressure
|
|
|
605 |
do i=1,ie
|
|
|
606 |
do j=1,je
|
|
|
607 |
do k=1,ke
|
|
|
608 |
pr(i,j,k)=ak(k)+bk(k)*sp(i,j)
|
|
|
609 |
enddo
|
|
|
610 |
enddo
|
|
|
611 |
enddo
|
|
|
612 |
end
|
|
|
613 |
REAL FUNCTION PHTOPHS (PHI, LAM, POLPHI, POLLAM)
|
|
|
614 |
C
|
|
|
615 |
C%Z% Modul %M%, V%I% vom %G%, extrahiert am %H%
|
|
|
616 |
C
|
|
|
617 |
C**** PHTOPHS - FC:UMRECHNUNG DER WAHREN GEOGRAPHISCHEN BREITE PHI
|
|
|
618 |
C**** AUF EINEM PUNKT MIT DEN KOORDINATEN (PHIS, LAMS)
|
|
|
619 |
C**** IM ROTIERTEN SYSTEM. DER NORDPOL DES SYSTEMS HAT
|
|
|
620 |
C**** DIE WAHREN KOORDINATEN (POLPHI, POLLAM)
|
|
|
621 |
C** AUFRUF : PHI = PHTOPHS (PHI, LAM, POLPHI, POLLAM)
|
|
|
622 |
C** ENTRIES : KEINE
|
|
|
623 |
C** ZWECK : UMRECHNUNG DER WAHREN GEOGRAPHISCHEN BREITE PHI AUF
|
|
|
624 |
C** EINEM PUNKT MIT DEN KOORDINATEN (PHIS, LAMS) IM
|
|
|
625 |
C** ROTIERTEN SYSTEM. DER NORDPOL DIESES SYSTEMS HAT
|
|
|
626 |
C** DIE WAHREN KOORDINATEN (POLPHI, POLLAM)
|
|
|
627 |
C** VERSIONS-
|
|
|
628 |
C** DATUM : 03.05.90
|
|
|
629 |
C**
|
|
|
630 |
C** EXTERNALS: KEINE
|
|
|
631 |
C** EINGABE-
|
|
|
632 |
C** PARAMETER: PHI REAL BREITE DES PUNKTES IM GEOGR. SYSTEM
|
|
|
633 |
C** LAM REAL LAENGE DES PUNKTES IM GEOGR. SYSTEM
|
|
|
634 |
C** POLPHI REAL GEOGR.BREITE DES N-POLS DES ROT. SYSTEMS
|
|
|
635 |
C** POLLAM REAL GEOGR.LAENGE DES N-POLS DES ROT. SYSTEMS
|
|
|
636 |
C** AUSGABE-
|
|
|
637 |
C** PARAMETER: ROTIERTE BREITE PHIS ALS WERT DER FUNKTION
|
|
|
638 |
C** ALLE WINKEL IN GRAD (NORDEN>0, OSTEN>0)
|
|
|
639 |
C**
|
|
|
640 |
C** COMMON-
|
|
|
641 |
C** BLOECKE : KEINE
|
|
|
642 |
C**
|
|
|
643 |
C** FEHLERBE-
|
|
|
644 |
C** HANDLUNG : KEINE
|
|
|
645 |
C** VERFASSER: G. DE MORSIER
|
|
|
646 |
|
|
|
647 |
REAL LAM,PHI,POLPHI,POLLAM
|
|
|
648 |
|
|
|
649 |
DATA ZRPI18 , ZPIR18 / 57.2957795 , 0.0174532925 /
|
|
|
650 |
|
|
|
651 |
ZSINPOL = SIN(ZPIR18*POLPHI)
|
|
|
652 |
ZCOSPOL = COS(ZPIR18*POLPHI)
|
|
|
653 |
ZLAMPOL = ZPIR18*POLLAM
|
|
|
654 |
ZPHI = ZPIR18*PHI
|
|
|
655 |
ZLAM = LAM
|
|
|
656 |
IF(ZLAM.GT.180.0) ZLAM = ZLAM - 360.0
|
|
|
657 |
ZLAM = ZPIR18*ZLAM
|
|
|
658 |
ZARG = ZCOSPOL*COS(ZPHI)*COS(ZLAM-ZLAMPOL) + ZSINPOL*SIN(ZPHI)
|
|
|
659 |
|
|
|
660 |
PHTOPHS = ZRPI18*ASIN(ZARG)
|
|
|
661 |
|
|
|
662 |
RETURN
|
|
|
663 |
END
|
|
|
664 |
REAL FUNCTION PHSTOPH (PHIS, LAMS, POLPHI, POLLAM)
|
|
|
665 |
C
|
|
|
666 |
C%Z% Modul %M%, V%I% vom %G%, extrahiert am %H%
|
|
|
667 |
C
|
|
|
668 |
C**** PHSTOPH - FC:BERECHNUNG DER WAHREN GEOGRAPHISCHEN BREITE FUER
|
|
|
669 |
C**** EINEN PUNKT MIT DEN KOORDINATEN (PHIS, LAMS) IM
|
|
|
670 |
C**** ROTIERTEN SYSTEM. DER NORDPOL DIESES SYSTEMS HAT
|
|
|
671 |
C**** DIE WAHREN KOORDINATEN (POLPHI, POLLAM)
|
|
|
672 |
C** AUFRUF : PHI = PHSTOPH (PHIS, LAMS, POLPHI, POLLAM)
|
|
|
673 |
C** ENTRIES : KEINE
|
|
|
674 |
C** ZWECK : BERECHNUNG DER WAHREN GEOGRAPHISCHEN BREITE FUER
|
|
|
675 |
C** EINEN PUNKT MIT DEN KOORDINATEN (PHIS, LAMS) IM
|
|
|
676 |
C** ROTIERTEN SYSTEM. DER NORDPOL DIESES SYSTEMS HAT
|
|
|
677 |
C** DIE WAHREN KOORDINATEN (POLPHI, POLLAM)
|
|
|
678 |
C** VERSIONS-
|
|
|
679 |
C** DATUM : 03.05.90
|
|
|
680 |
C**
|
|
|
681 |
C** EXTERNALS: KEINE
|
|
|
682 |
C** EINGABE-
|
|
|
683 |
C** PARAMETER: PHIS REAL GEOGR. BREITE DES PUNKTES IM ROT.SYS.
|
|
|
684 |
C** LAMS REAL GEOGR. LAENGE DES PUNKTES IM ROT.SYS.
|
|
|
685 |
C** POLPHI REAL WAHRE GEOGR. BREITE DES NORDPOLS
|
|
|
686 |
C** POLLAM REAL WAHRE GEOGR. LAENGE DES NORDPOLS
|
|
|
687 |
C** AUSGABE-
|
|
|
688 |
C** PARAMETER: WAHRE GEOGRAPHISCHE BREITE ALS WERT DER FUNKTION
|
|
|
689 |
C** ALLE WINKEL IN GRAD (NORDEN>0, OSTEN>0)
|
|
|
690 |
C**
|
|
|
691 |
C** COMMON-
|
|
|
692 |
C** BLOECKE : KEINE
|
|
|
693 |
C**
|
|
|
694 |
C** FEHLERBE-
|
|
|
695 |
C** HANDLUNG : KEINE
|
|
|
696 |
C** VERFASSER: D.MAJEWSKI
|
|
|
697 |
|
|
|
698 |
REAL LAMS,PHIS,POLPHI,POLLAM
|
|
|
699 |
|
|
|
700 |
DATA ZRPI18 , ZPIR18 / 57.2957795 , 0.0174532925 /
|
|
|
701 |
|
|
|
702 |
SINPOL = SIN(ZPIR18*POLPHI)
|
|
|
703 |
COSPOL = COS(ZPIR18*POLPHI)
|
|
|
704 |
ZPHIS = ZPIR18*PHIS
|
|
|
705 |
ZLAMS = LAMS
|
|
|
706 |
IF(ZLAMS.GT.180.0) ZLAMS = ZLAMS - 360.0
|
|
|
707 |
ZLAMS = ZPIR18*ZLAMS
|
|
|
708 |
ARG = COSPOL*COS(ZPHIS)*COS(ZLAMS) + SINPOL*SIN(ZPHIS)
|
|
|
709 |
|
|
|
710 |
PHSTOPH = ZRPI18*ASIN(ARG)
|
|
|
711 |
|
|
|
712 |
RETURN
|
|
|
713 |
END
|
|
|
714 |
REAL FUNCTION LMTOLMS (PHI, LAM, POLPHI, POLLAM)
|
|
|
715 |
C
|
|
|
716 |
C%Z% Modul %M%, V%I% vom %G%, extrahiert am %H%
|
|
|
717 |
C
|
|
|
718 |
C**** LMTOLMS - FC:UMRECHNUNG DER WAHREN GEOGRAPHISCHEN LAENGE LAM
|
|
|
719 |
C**** AUF EINEM PUNKT MIT DEN KOORDINATEN (PHIS, LAMS)
|
|
|
720 |
C**** IM ROTIERTEN SYSTEM. DER NORDPOL DES SYSTEMS HAT
|
|
|
721 |
C**** DIE WAHREN KOORDINATEN (POLPHI, POLLAM)
|
|
|
722 |
C** AUFRUF : LAM = LMTOLMS (PHI, LAM, POLPHI, POLLAM)
|
|
|
723 |
C** ENTRIES : KEINE
|
|
|
724 |
C** ZWECK : UMRECHNUNG DER WAHREN GEOGRAPHISCHEN LAENGE LAM AUF
|
|
|
725 |
C** EINEM PUNKT MIT DEN KOORDINATEN (PHIS, LAMS) IM
|
|
|
726 |
C** ROTIERTEN SYSTEM. DER NORDPOL DIESES SYSTEMS HAT
|
|
|
727 |
C** DIE WAHREN KOORDINATEN (POLPHI, POLLAM)
|
|
|
728 |
C** VERSIONS-
|
|
|
729 |
C** DATUM : 03.05.90
|
|
|
730 |
C**
|
|
|
731 |
C** EXTERNALS: KEINE
|
|
|
732 |
C** EINGABE-
|
|
|
733 |
C** PARAMETER: PHI REAL BREITE DES PUNKTES IM GEOGR. SYSTEM
|
|
|
734 |
C** LAM REAL LAENGE DES PUNKTES IM GEOGR. SYSTEM
|
|
|
735 |
C** POLPHI REAL GEOGR.BREITE DES N-POLS DES ROT. SYSTEMS
|
|
|
736 |
C** POLLAM REAL GEOGR.LAENGE DES N-POLS DES ROT. SYSTEMS
|
|
|
737 |
C** AUSGABE-
|
|
|
738 |
C** PARAMETER: WAHRE GEOGRAPHISCHE LAENGE ALS WERT DER FUNKTION
|
|
|
739 |
C** ALLE WINKEL IN GRAD (NORDEN>0, OSTEN>0)
|
|
|
740 |
C**
|
|
|
741 |
C** COMMON-
|
|
|
742 |
C** BLOECKE : KEINE
|
|
|
743 |
C**
|
|
|
744 |
C** FEHLERBE-
|
|
|
745 |
C** HANDLUNG : KEINE
|
|
|
746 |
C** VERFASSER: G. DE MORSIER
|
|
|
747 |
|
|
|
748 |
REAL LAM,PHI,POLPHI,POLLAM
|
|
|
749 |
|
|
|
750 |
DATA ZRPI18 , ZPIR18 / 57.2957795 , 0.0174532925 /
|
|
|
751 |
|
|
|
752 |
ZSINPOL = SIN(ZPIR18*POLPHI)
|
|
|
753 |
ZCOSPOL = COS(ZPIR18*POLPHI)
|
|
|
754 |
ZLAMPOL = ZPIR18*POLLAM
|
|
|
755 |
ZPHI = ZPIR18*PHI
|
|
|
756 |
ZLAM = LAM
|
|
|
757 |
IF(ZLAM.GT.180.0) ZLAM = ZLAM - 360.0
|
|
|
758 |
ZLAM = ZPIR18*ZLAM
|
|
|
759 |
|
|
|
760 |
ZARG1 = - SIN(ZLAM-ZLAMPOL)*COS(ZPHI)
|
|
|
761 |
ZARG2 = - ZSINPOL*COS(ZPHI)*COS(ZLAM-ZLAMPOL)+ZCOSPOL*SIN(ZPHI)
|
|
|
762 |
IF (ABS(ZARG2).LT.1.E-30) THEN
|
|
|
763 |
IF (ABS(ZARG1).LT.1.E-30) THEN
|
|
|
764 |
LMTOLMS = 0.0
|
|
|
765 |
ELSEIF (ZARG1.GT.0.) THEN
|
|
|
766 |
LMTOLMS = 90.0
|
|
|
767 |
ELSE
|
|
|
768 |
LMTOLMS = -90.0
|
|
|
769 |
ENDIF
|
|
|
770 |
ELSE
|
|
|
771 |
LMTOLMS = ZRPI18*ATAN2(ZARG1,ZARG2)
|
|
|
772 |
ENDIF
|
|
|
773 |
|
|
|
774 |
RETURN
|
|
|
775 |
END
|
|
|
776 |
REAL FUNCTION LMSTOLM (PHIS, LAMS, POLPHI, POLLAM)
|
|
|
777 |
C
|
|
|
778 |
C%Z% Modul %M%, V%I% vom %G%, extrahiert am %H%
|
|
|
779 |
C
|
|
|
780 |
C**** LMSTOLM - FC:BERECHNUNG DER WAHREN GEOGRAPHISCHEN LAENGE FUER
|
|
|
781 |
C**** EINEN PUNKT MIT DEN KOORDINATEN (PHIS, LAMS)
|
|
|
782 |
C**** IM ROTIERTEN SYSTEM. DER NORDPOL DES SYSTEMS HAT
|
|
|
783 |
C**** DIE WAHREN KOORDINATEN (POLPHI, POLLAM)
|
|
|
784 |
C** AUFRUF : LAM = LMSTOLM (PHIS, LAMS, POLPHI, POLLAM)
|
|
|
785 |
C** ENTRIES : KEINE
|
|
|
786 |
C** ZWECK : BERECHNUNG DER WAHREN GEOGRAPHISCHEN LAENGE FUER
|
|
|
787 |
C** EINEN PUNKT MIT DEN KOORDINATEN (PHIS, LAMS)
|
|
|
788 |
C** IM ROTIERTEN SYSTEM. DER NORDPOL DIESES SYSTEMS HAT
|
|
|
789 |
C** DIE WAHREN KOORDINATEN (POLPHI, POLLAM)
|
|
|
790 |
C** VERSIONS-
|
|
|
791 |
C** DATUM : 03.05.90
|
|
|
792 |
C**
|
|
|
793 |
C** EXTERNALS: KEINE
|
|
|
794 |
C** EINGABE-
|
|
|
795 |
C** PARAMETER: PHIS REAL GEOGR. BREITE DES PUNKTES IM ROT.SYS.
|
|
|
796 |
C** LAMS REAL GEOGR. LAENGE DES PUNKTES IM ROT.SYS.
|
|
|
797 |
C** POLPHI REAL WAHRE GEOGR. BREITE DES NORDPOLS
|
|
|
798 |
C** POLLAM REAL WAHRE GEOGR. LAENGE DES NORDPOLS
|
|
|
799 |
C** AUSGABE-
|
|
|
800 |
C** PARAMETER: WAHRE GEOGRAPHISCHE LAENGE ALS WERT DER FUNKTION
|
|
|
801 |
C** ALLE WINKEL IN GRAD (NORDEN>0, OSTEN>0)
|
|
|
802 |
C**
|
|
|
803 |
C** COMMON-
|
|
|
804 |
C** BLOECKE : KEINE
|
|
|
805 |
C**
|
|
|
806 |
C** FEHLERBE-
|
|
|
807 |
C** HANDLUNG : KEINE
|
|
|
808 |
C** VERFASSER: D.MAJEWSKI
|
|
|
809 |
|
|
|
810 |
REAL LAMS,PHIS,POLPHI,POLLAM
|
|
|
811 |
|
|
|
812 |
DATA ZRPI18 , ZPIR18 / 57.2957795 , 0.0174532925 /
|
|
|
813 |
|
|
|
814 |
ZSINPOL = SIN(ZPIR18*POLPHI)
|
|
|
815 |
ZCOSPOL = COS(ZPIR18*POLPHI)
|
|
|
816 |
ZLAMPOL = ZPIR18*POLLAM
|
|
|
817 |
ZPHIS = ZPIR18*PHIS
|
|
|
818 |
ZLAMS = LAMS
|
|
|
819 |
IF(ZLAMS.GT.180.0) ZLAMS = ZLAMS - 360.0
|
|
|
820 |
ZLAMS = ZPIR18*ZLAMS
|
|
|
821 |
|
|
|
822 |
ZARG1 = SIN(ZLAMPOL)*(- ZSINPOL*COS(ZLAMS)*COS(ZPHIS) +
|
|
|
823 |
1 ZCOSPOL* SIN(ZPHIS)) -
|
|
|
824 |
2 COS(ZLAMPOL)* SIN(ZLAMS)*COS(ZPHIS)
|
|
|
825 |
ZARG2 = COS(ZLAMPOL)*(- ZSINPOL*COS(ZLAMS)*COS(ZPHIS) +
|
|
|
826 |
1 ZCOSPOL* SIN(ZPHIS)) +
|
|
|
827 |
2 SIN(ZLAMPOL)* SIN(ZLAMS)*COS(ZPHIS)
|
|
|
828 |
IF (ABS(ZARG2).LT.1.E-30) THEN
|
|
|
829 |
IF (ABS(ZARG1).LT.1.E-30) THEN
|
|
|
830 |
LMSTOLM = 0.0
|
|
|
831 |
ELSEIF (ZARG1.GT.0.) THEN
|
|
|
832 |
LMSTOLAM = 90.0
|
|
|
833 |
ELSE
|
|
|
834 |
LMSTOLAM = -90.0
|
|
|
835 |
ENDIF
|
|
|
836 |
ELSE
|
|
|
837 |
LMSTOLM = ZRPI18*ATAN2(ZARG1,ZARG2)
|
|
|
838 |
ENDIF
|
|
|
839 |
|
|
|
840 |
RETURN
|
|
|
841 |
END
|