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