99 NO,RLAT,RLON,IBO,LO,GO,IRET)
100 class(ip_grid),
intent(in) :: grid_in, grid_out
101 INTEGER,
INTENT(IN ) :: IPOPT(20)
102 INTEGER,
INTENT(IN ) :: MI,MO,KM
103 INTEGER,
INTENT(IN ) :: IBI(KM)
104 INTEGER,
INTENT(INOUT) :: NO
105 INTEGER,
INTENT( OUT) :: IRET, IBO(KM)
107 LOGICAL*1,
INTENT(IN ) :: LI(MI,KM)
108 LOGICAL*1,
INTENT( OUT) :: LO(MO,KM)
110 REAL,
INTENT(IN ) :: GI(MI,KM)
111 REAL,
INTENT(INOUT) :: RLAT(MO),RLON(MO)
112 REAL,
INTENT( OUT) :: GO(MO,KM)
114 REAL,
PARAMETER :: FILL=-9999.
116 INTEGER :: I1,J1,IXS,JXS
117 INTEGER :: MSPIRAL,N,K,NK
119 INTEGER :: MX,KXS,KXT,IX,JX,NX
121 LOGICAL :: SAME_GRIDI, SAME_GRIDO
123 REAL :: XPTS(MO),YPTS(MO)
124 logical :: to_station_points
126 INTEGER,
SAVE :: NOX=-1,iretx=-1
127 INTEGER,
ALLOCATABLE,
SAVE :: NXY(:)
128 REAL,
ALLOCATABLE,
SAVE :: RLATX(:),RLONX(:),XPTSX(:),YPTSX(:)
129 class(ip_grid),
allocatable,
save :: prev_grid_in, prev_grid_out
133 mspiral=max(ipopt(1),1)
135 if (.not.
allocated(prev_grid_in) .or. .not.
allocated(prev_grid_out))
then
136 allocate(prev_grid_in, source = grid_in)
137 allocate(prev_grid_out, source = grid_out)
142 same_gridi = grid_in == prev_grid_in
143 same_grido = grid_out == prev_grid_out
145 if (.not. same_gridi .or. .not. same_grido)
then
146 deallocate(prev_grid_in)
147 deallocate(prev_grid_out)
149 allocate(prev_grid_in, source = grid_in)
150 allocate(prev_grid_out, source = grid_out)
154 select type(grid_out)
155 type is(ip_station_points_grid)
156 to_station_points = .true.
158 to_station_points = .false.
162 IF(iret.EQ.0.AND.(to_station_points.OR..NOT.same_gridi.OR..NOT.same_grido))
THEN
165 CALL gdswzd(grid_out, 0,mo,fill,xpts,ypts,rlon,rlat,no)
169 CALL gdswzd(grid_in,-1,no,fill,xpts,ypts,rlon,rlat,nv)
170 IF(iret.EQ.0.AND.nv.EQ.0) iret=2
174 IF(nox.GE.0)
DEALLOCATE(rlatx,rlonx,xptsx,yptsx,nxy)
175 ALLOCATE(rlatx(no),rlonx(no),xptsx(no),yptsx(no),nxy(no))
188 IF(xpts(n).NE.fill.AND.ypts(n).NE.fill)
THEN
189 nxy(n) = grid_in%field_pos(nint(xpts(n)), nint(ypts(n)))
198 IF(iret.EQ.0.AND.iretx.EQ.0)
THEN
199 IF(.not. to_station_points)
THEN
217 IF(ibi(k).EQ.0.OR.li(nxy(n),k))
THEN
221 ELSEIF(mspiral.GT.1)
THEN
224 ixs=int(sign(1.,xpts(n)-i1))
225 jxs=int(sign(1.,ypts(n)-j1))
227 kxs=int(sqrt(4*mx-2.5))
229 SELECT CASE(mod(kxs,4))
231 ix=i1-ixs*(kxs/4-kxt)
235 jx=j1-jxs*(kxs/4-kxt)
237 ix=i1+ixs*(1+kxs/4-kxt)
241 jx=j1+jxs*(kxs/4-kxt)
243 nx = grid_in%field_pos(ix, jx)
258 IF(.NOT.all(lo(1:no,k))) ibo(k)=1
261 select type(grid_out)
262 type is(ip_equid_cylind_grid)
263 CALL polfixs(no,mo,km,rlat,ibo,lo,go)
267 IF(iret.EQ.0) iret=iretx
268 IF(.not. to_station_points) no=0
350 MI,MO,KM,IBI,LI,UI,VI, &
351 NO,RLAT,RLON,CROT,SROT,IBO,LO,UO,VO,IRET)
353 class(ip_grid),
intent(in) :: grid_in, grid_out
354 INTEGER,
INTENT(IN ) :: IPOPT(20)
355 INTEGER,
INTENT(IN ) :: IBI(KM),MI,MO,KM
356 INTEGER,
INTENT(INOUT) :: NO
357 INTEGER,
INTENT( OUT) :: IRET, IBO(KM)
359 LOGICAL*1,
INTENT(IN ) :: LI(MI,KM)
360 LOGICAL*1,
INTENT( OUT) :: LO(MO,KM)
362 REAL,
INTENT(IN ) :: UI(MI,KM),VI(MI,KM)
363 REAL,
INTENT(INOUT) :: CROT(MO),SROT(MO)
364 REAL,
INTENT(INOUT) :: RLAT(MO),RLON(MO)
365 REAL,
INTENT( OUT) :: UO(MO,KM),VO(MO,KM)
367 REAL,
PARAMETER :: FILL=-9999.
369 INTEGER :: I1,J1,IXS,JXS,MX
370 INTEGER :: KXS,KXT,IX,JX,NX
371 INTEGER :: MSPIRAL,N,K,NK,NV
373 LOGICAL :: SAME_GRIDI, SAME_GRIDO
375 REAL :: CX,SX,CM,SM,UROT,VROT
376 REAL :: XPTS(MO),YPTS(MO)
377 REAL :: CROI(MI),SROI(MI)
378 REAL :: XPTI(MI),YPTI(MI),RLOI(MI),RLAI(MI)
380 logical :: to_station_points
382 INTEGER,
SAVE :: NOX=-1,iretx=-1
383 INTEGER,
ALLOCATABLE,
SAVE :: NXY(:)
385 REAL,
ALLOCATABLE,
SAVE :: RLATX(:),RLONX(:),XPTSX(:),YPTSX(:)
386 REAL,
ALLOCATABLE,
SAVE :: CROTX(:),SROTX(:),CXY(:),SXY(:)
387 class(ip_grid),
allocatable,
save :: prev_grid_in, prev_grid_out
391 mspiral=max(ipopt(1),1)
394 if (.not.
allocated(prev_grid_in) .or. .not.
allocated(prev_grid_out))
then
395 allocate(prev_grid_in, source = grid_in)
396 allocate(prev_grid_out, source = grid_out)
401 same_gridi = grid_in == prev_grid_in
402 same_grido = grid_out == prev_grid_out
404 if (.not. same_gridi .or. .not. same_grido)
then
405 deallocate(prev_grid_in)
406 deallocate(prev_grid_out)
408 allocate(prev_grid_in, source = grid_in)
409 allocate(prev_grid_out, source = grid_out)
413 select type(grid_out)
414 type is(ip_station_points_grid)
415 to_station_points = .true.
417 to_station_points = .false.
422 IF(iret.EQ.0.AND.(to_station_points.OR..NOT.same_gridi.OR..NOT.same_grido))
THEN
425 CALL gdswzd(grid_out, 0,mo,fill,xpts,ypts,rlon,rlat,no,crot,srot)
429 CALL gdswzd(grid_in,-1,no,fill,xpts,ypts,rlon,rlat,nv)
430 IF(iret.EQ.0.AND.nv.EQ.0) iret=2
431 CALL gdswzd(grid_in, 0,mi,fill,xpti,ypti,rloi,rlai,nv,croi,sroi)
435 IF(nox.GE.0)
DEALLOCATE(rlatx,rlonx,xptsx,yptsx,crotx,srotx,nxy,cxy,sxy)
436 ALLOCATE(rlatx(no),rlonx(no),xptsx(no),yptsx(no), &
437 crotx(no),srotx(no),nxy(no),cxy(no),sxy(no))
452 IF(xpts(n).NE.fill.AND.ypts(n).NE.fill)
THEN
453 nxy(n) = grid_in%field_pos(nint(xpts(n)),nint(ypts(n)))
455 CALL movect(rlai(nxy(n)),rloi(nxy(n)),rlat(n),rlon(n),cm,sm)
456 cxy(n)=cm*croi(nxy(n))+sm*sroi(nxy(n))
457 sxy(n)=sm*croi(nxy(n))-cm*sroi(nxy(n))
467 IF(iret.EQ.0.AND.iretx.EQ.0)
THEN
468 IF(.not. to_station_points)
THEN
491 IF(ibi(k).EQ.0.OR.li(nxy(n),k))
THEN
492 urot=cxy(n)*ui(nxy(n),k)-sxy(n)*vi(nxy(n),k)
493 vrot=sxy(n)*ui(nxy(n),k)+cxy(n)*vi(nxy(n),k)
494 uo(n,k)=crot(n)*urot-srot(n)*vrot
495 vo(n,k)=srot(n)*urot+crot(n)*vrot
498 ELSEIF(mspiral.GT.1)
THEN
501 ixs=int(sign(1.,xpts(n)-i1))
502 jxs=int(sign(1.,ypts(n)-j1))
504 kxs=int(sqrt(4*mx-2.5))
506 SELECT CASE(mod(kxs,4))
508 ix=i1-ixs*(kxs/4-kxt)
512 jx=j1-jxs*(kxs/4-kxt)
514 ix=i1+ixs*(1+kxs/4-kxt)
518 jx=j1+jxs*(kxs/4-kxt)
520 nx = grid_in%field_pos(ix, jx)
523 CALL movect(rlai(nx),rloi(nx),rlat(n),rlon(n),cm,sm)
524 cx=cm*croi(nx)+sm*sroi(nx)
525 sx=sm*croi(nx)-cm*sroi(nx)
526 urot=cx*ui(nx,k)-sx*vi(nx,k)
527 vrot=sx*ui(nx,k)+cx*vi(nx,k)
528 uo(n,k)=crot(n)*urot-srot(n)*vrot
529 vo(n,k)=srot(n)*urot+crot(n)*vrot
540 IF(.NOT.all(lo(1:no,k))) ibo(k)=1
543 select type(grid_out)
544 type is(ip_equid_cylind_grid)
545 CALL polfixv(no,mo,km,rlat,rlon,ibo,lo,uo,vo)
550 IF(iret.EQ.0) iret=iretx
551 IF(.not. to_station_points) no=0
subroutine movect(FLAT, FLON, TLAT, TLON, CROT, SROT)
This subprogram provides the rotation parameters to move a vector along a great circle from one posit...
Driver module for gdswzd routines.
Re-export the individual grids.
Interpolate scalar fields (neighbor).
subroutine interpolate_neighbor_vector(IPOPT, grid_in, grid_out, MI, MO, KM, IBI, LI, UI, VI, NO, RLAT, RLON, CROT, SROT, IBO, LO, UO, VO, IRET)
Interpolate vector fields (neighbor).
subroutine interpolate_neighbor_scalar(IPOPT, grid_in, grid_out, MI, MO, KM, IBI, LI, GI, NO, RLAT, RLON, IBO, LO, GO, IRET)
Interpolate scalar fields (neighbor).
Make multiple pole scalar values consistent.
subroutine, public polfixs(NM, NX, KM, RLAT, IB, LO, GO)
Make multiple pole scalar values consistent.
subroutine, public polfixv(NM, NX, KM, RLAT, RLON, IB, LO, UO, VO)
Make multiple pole vector values consistent,.