62 NO,RLAT,RLON,IBO,LO,GO,IRET)
63 INTEGER,
INTENT(IN ) :: IPOPT(20)
64 class(
ip_grid),
intent(in) :: grid_in, grid_out
65 INTEGER,
INTENT(IN ) :: MI, MO
66 INTEGER,
INTENT(IN ) :: IBI(KM), KM
67 INTEGER,
INTENT( OUT) :: IBO(KM), IRET, NO
69 LOGICAL*1,
INTENT( OUT) :: LO(MO,KM)
71 REAL,
INTENT(IN ) :: GI(MI,KM)
72 REAL,
INTENT(INOUT) :: RLAT(MO),RLON(MO)
73 REAL,
INTENT( OUT) :: GO(MO,KM)
76 select type(desc_in => grid_in%descriptor)
78 select type(desc_out => grid_out%descriptor)
80 CALL polates4(ipopt,desc_in%gds,desc_out%gds,mi,mo,km,ibi,gi,no,rlat,rlon,ibo,lo,go,iret)
84 select type(desc_out => grid_out%descriptor)
86 CALL polates4(ipopt,desc_in%gdt_num,desc_in%gdt_tmpl,desc_in%gdt_len, &
87 desc_out%gdt_num,desc_out%gdt_tmpl,desc_out%gdt_len, &
88 mi,mo,km,ibi,gi,no,rlat,rlon,ibo,lo,go,iret)
122 MI,MO,KM,IBI,UI,VI, &
123 NO,RLAT,RLON,CROT,SROT,IBO,LO,UO,VO,IRET)
124 class(
ip_grid),
intent(in) :: grid_in, grid_out
125 INTEGER,
INTENT(IN ) :: IPOPT(20), IBI(KM)
126 INTEGER,
INTENT(IN ) :: KM, MI, MO
127 INTEGER,
INTENT( OUT) :: IRET, IBO(KM), NO
129 LOGICAL*1,
INTENT( OUT) :: LO(MO,KM)
131 REAL,
INTENT(IN ) :: UI(MI,KM),VI(MI,KM)
132 REAL,
INTENT( OUT) :: UO(MO,KM),VO(MO,KM)
133 REAL,
INTENT(INOUT) :: RLAT(MO),RLON(MO)
134 REAL,
INTENT( OUT) :: CROT(MO),SROT(MO)
137 select type(desc_in => grid_in%descriptor)
139 select type(desc_out => grid_out%descriptor)
141 CALL polatev4_grib1(ipopt,desc_in%gds,desc_out%gds,mi,mo,km,ibi,ui,vi,&
142 no,rlat,rlon,crot,srot,ibo,lo,uo,vo,iret)
146 select type(desc_out => grid_out%descriptor)
148 CALL polatev4(ipopt,desc_in%gdt_num,desc_in%gdt_tmpl,desc_in%gdt_len, &
149 desc_out%gdt_num,desc_out%gdt_tmpl,desc_out%gdt_len, &
151 no,rlat,rlon,crot,srot,ibo,lo,uo,vo,iret)
255 IGDTNUMO,IGDTMPLO,IGDTLENO, &
257 NO,RLAT,RLON,IBO,LO,GO,IRET)
258 INTEGER,
INTENT(IN ) :: IGDTNUMI, IGDTLENI
259 INTEGER,
INTENT(IN ) :: IGDTMPLI(IGDTLENI)
260 INTEGER,
INTENT(IN ) :: IGDTNUMO, IGDTLENO
261 INTEGER,
INTENT(IN ) :: IGDTMPLO(IGDTLENO)
262 INTEGER,
INTENT(IN ) :: IPOPT(20)
263 INTEGER,
INTENT(IN ) :: MI, MO
264 INTEGER,
INTENT(IN ) :: IBI(KM), KM
265 INTEGER,
INTENT( OUT) :: IBO(KM), IRET, NO
267 LOGICAL*1,
INTENT( OUT) :: LO(MO,KM)
269 REAL,
INTENT(IN ) :: GI(MI,KM)
270 REAL,
INTENT(INOUT) :: RLAT(MO),RLON(MO)
271 REAL,
INTENT( OUT) :: GO(MO,KM)
273 REAL,
PARAMETER :: FILL=-9999.
274 REAL,
PARAMETER :: PI=3.14159265358979
275 REAL,
PARAMETER :: DPR=180./pi
277 INTEGER :: IDRTI, IDRTO, IG, JG, IM, JM
278 INTEGER :: IGO, JGO, IMO, JMO
279 INTEGER :: ISCAN, JSCAN, NSCAN
280 INTEGER :: ISCANO, JSCANO, NSCANO
281 INTEGER :: ISKIPI, JSKIPI, ISCALE
282 INTEGER :: IMAXI, JMAXI, ISPEC
283 INTEGER :: IP, IPRIME, IPROJ, IROMB, K
284 INTEGER :: MAXWV, N, NI, NJ, NPS
287 REAL :: DLAT, DLON, DLATO, DLONO
288 REAL :: GO2(MO,KM), H, HI, HJ
289 REAL :: ORIENT, SLAT, RERTH, E2
290 REAL :: RLAT1, RLON1, RLAT2, RLON2, RLATI
291 REAL :: XMESH, XP, YP
292 REAL :: XPTS(MO), YPTS(MO)
295 class(
ip_grid),
allocatable :: grid_in, grid_out
305 IF(igdtnumo.GE.0)
THEN
307 CALL gdswzd(grid_out, 0,mo,fill,xpts,ypts,rlon,rlat,no)
317 IF(idrti==40) idrti=4
318 IF(idrti==0.OR.idrti==4)
THEN
321 iscale=igdtmpli(10)*igdtmpli(11)
322 IF(iscale==0) iscale=10**6
323 rlon1=float(igdtmpli(13))/float(iscale)
324 rlon2=float(igdtmpli(16))/float(iscale)
325 iscan=mod(igdtmpli(19)/128,2)
326 jscan=mod(igdtmpli(19)/64,2)
327 nscan=mod(igdtmpli(19)/32,2)
332 IF(ibi(k).NE.0) iret=41
336 dlon=(mod(rlon2-rlon1-1+3600,360.)+1)/(im-1)
338 dlon=-(mod(rlon1-rlon2-1+3600,360.)+1)/(im-1)
340 ig=nint(360/abs(dlon))
341 iprime=1+mod(-nint(rlon1/dlon)+ig,ig)
344 IF(mod(ig,2).NE.0.OR.im.LT.ig) iret=41
346 IF(iret.EQ.0.AND.idrti.EQ.0)
THEN
347 iscale=igdtmpli(10)*igdtmpli(11)
348 IF(iscale==0) iscale=10**6
349 rlat1=float(igdtmpli(12))/float(iscale)
350 rlat2=float(igdtmpli(15))/float(iscale)
351 dlat=(rlat2-rlat1)/(jm-1)
352 jg=nint(180/abs(dlat))
353 IF(jm.EQ.jg) idrti=256
354 IF(jm.NE.jg.AND.jm.NE.jg+1) iret=41
355 ELSEIF(iret.EQ.0.AND.idrti.EQ.4)
THEN
365 IF(iromb.EQ.0.AND.idrti.EQ.4) maxwv=(jmaxi-1)
366 IF(iromb.EQ.1.AND.idrti.EQ.4) maxwv=(jmaxi-1)/2
367 IF(iromb.EQ.0.AND.idrti.EQ.0) maxwv=(jmaxi-3)/2
368 IF(iromb.EQ.1.AND.idrti.EQ.0) maxwv=(jmaxi-3)/4
369 IF(iromb.EQ.0.AND.idrti.EQ.256) maxwv=(jmaxi-1)/2
370 IF(iromb.EQ.1.AND.idrti.EQ.256) maxwv=(jmaxi-1)/4
372 IF((iromb.NE.0.AND.iromb.NE.1).OR.maxwv.LT.0) iret=42
384 IF(iscan.EQ.1) iskipi=-iskipi
385 IF(jscan.EQ.0) jskipi=-jskipi
388 IF((igdtnumo.EQ.0.OR.igdtnumo.EQ.40).AND. &
389 mod(igdtmplo(8),2).EQ.0.AND.igdtmplo(13).EQ.0.AND.igdtmplo(19).EQ.0)
THEN
394 iscale=igdtmplo(10)*igdtmplo(11)
395 IF(iscale==0) iscale=10**6
396 rlon2=float(igdtmplo(16))/float(iscale)
397 dlono=(mod(rlon2-1+3600,360.)+1)/(imo-1)
398 igo=nint(360/abs(dlono))
399 IF(imo.EQ.igo.AND.idrto.EQ.0)
THEN
400 rlat1=float(igdtmplo(12))/float(iscale)
401 rlat2=float(igdtmplo(15))/float(iscale)
402 dlat=(rlat2-rlat1)/(jmo-1)
403 jgo=nint(180/abs(dlat))
404 IF(jmo.EQ.jgo) idrto=256
405 IF(jmo.EQ.jgo.OR.jmo.EQ.jgo+1) ispec=1
406 ELSEIF(imo.EQ.igo.AND.idrto.EQ.4)
THEN
408 IF(jmo.EQ.jgo) ispec=1
411 CALL sptrun(iromb,maxwv,idrti,imaxi,jmaxi,idrto,imo,jmo, &
412 km,iprime,iskipi,jskipi,mi,0,0,mo,0,gi,go)
415 ELSEIF(igdtnumo.EQ.20.AND. &
416 igdtmplo(8).EQ.igdtmplo(9).AND.mod(igdtmplo(8),2).EQ.1.AND. &
417 igdtmplo(15).EQ.igdtmplo(16).AND.igdtmplo(18).EQ.64)
THEN
419 rlat1=float(igdtmplo(10))*1.e-6
420 rlon1=float(igdtmplo(11))*1.e-6
421 orient=float(igdtmplo(14))*1.e-6
422 xmesh=float(igdtmplo(15))*1.e-3
423 iproj=mod(igdtmplo(17)/128,2)
426 slat=float(abs(igdtmplo(13)))*1.e-6
428 de=(1.+sin(slat/dpr))*rerth
429 dr=de*cos(rlat1/dpr)/(1+h*sin(rlat1/dpr))
430 xp=1-h*sin((rlon1-orient)/dpr)*dr/xmesh
431 yp=1+cos((rlon1-orient)/dpr)*dr/xmesh
432 IF(nint(xp).EQ.ip.AND.nint(yp).EQ.ip)
THEN
434 CALL sptruns(iromb,maxwv,idrti,imaxi,jmaxi,km,nps, &
435 iprime,iskipi,jskipi,mi,mo,0,0,0, &
436 slat,xmesh,orient,gi,go,go2)
438 CALL sptruns(iromb,maxwv,idrti,imaxi,jmaxi,km,nps, &
439 iprime,iskipi,jskipi,mi,mo,0,0,0, &
440 slat,xmesh,orient,gi,go2,go)
445 ELSEIF(igdtnumo.EQ.10)
THEN
448 rlat1=float(igdtmplo(10))*1.0e-6
449 rlon1=float(igdtmplo(11))*1.0e-6
450 rlon2=float(igdtmplo(15))*1.0e-6
451 rlati=float(igdtmplo(13))*1.0e-6
452 iscano=mod(igdtmplo(16)/128,2)
453 jscano=mod(igdtmplo(16)/64,2)
454 nscano=mod(igdtmplo(16)/32,2)
455 dy=float(igdtmplo(19))*1.0e-3
459 dlono=hi*(mod(hi*(rlon2-rlon1)-1+3600,360.)+1)/(ni-1)
460 dlato=hj*dy/(rerth*cos(rlati/dpr))*dpr
462 CALL sptrunm(iromb,maxwv,idrti,imaxi,jmaxi,km,ni,nj, &
463 iprime,iskipi,jskipi,mi,mo,0,0,0, &
464 rlat1,rlon1,dlato,dlono,gi,go)
470 CALL sptrung(iromb,maxwv,idrti,imaxi,jmaxi,km,no, &
471 iprime,iskipi,jskipi,mi,mo,0,0,0,rlat,rlon,gi,go)
560 NO,RLAT,RLON,IBO,LO,GO,IRET)
561 INTEGER,
INTENT(IN ) :: IPOPT(20), KGDSI(200)
562 INTEGER,
INTENT(IN ) :: KGDSO(200), MI, MO
563 INTEGER,
INTENT(IN ) :: IBI(KM), KM
564 INTEGER,
INTENT( OUT) :: IBO(KM), IRET
566 LOGICAL*1,
INTENT( OUT) :: LO(MO,KM)
568 REAL,
INTENT(IN ) :: GI(MI,KM)
569 REAL,
INTENT(INOUT) :: RLAT(MO),RLON(MO)
570 REAL,
INTENT( OUT) :: GO(MO,KM)
572 REAL,
PARAMETER :: FILL=-9999.
573 REAL,
PARAMETER :: RERTH=6.3712e6
574 REAL,
PARAMETER :: PI=3.14159265358979
575 REAL,
PARAMETER :: DPR=180./pi
577 INTEGER :: IDRTI, IDRTO, IG, JG, IM, JM
578 INTEGER :: IGO, JGO, IMO, JMO
579 INTEGER :: ISCAN, JSCAN, NSCAN
580 INTEGER :: ISCANO, JSCANO, NSCANO
581 INTEGER :: ISKIPI, JSKIPI
582 INTEGER :: IMAXI, JMAXI, ISPEC
583 INTEGER :: IP, IPRIME, IPROJ, IROMB, K
584 INTEGER :: MAXWV, N, NI, NJ, NPS, NO
587 REAL :: DLAT, DLON, DLATO, DLONO
588 REAL :: GO2(MO,KM), H, HI, HJ
590 REAL :: RLAT1, RLON1, RLAT2, RLON2, RLATI
591 REAL :: XMESH, XP, YP
592 REAL :: XPTS(MO), YPTS(MO)
595 class(
ip_grid),
allocatable :: grid_in, grid_out
606 IF(kgdso(1).GE.0)
THEN
607 CALL gdswzd(grid_out, 0,mo,fill,xpts,ypts,rlon,rlat,no)
621 iscan=mod(kgdsi(11)/128,2)
622 jscan=mod(kgdsi(11)/64,2)
623 nscan=mod(kgdsi(11)/32,2)
624 IF(idrti.NE.0.AND.idrti.NE.4) iret=41
626 IF(ibi(k).NE.0) iret=41
630 dlon=(mod(rlon2-rlon1-1+3600,360.)+1)/(im-1)
632 dlon=-(mod(rlon1-rlon2-1+3600,360.)+1)/(im-1)
634 ig=nint(360/abs(dlon))
635 iprime=1+mod(-nint(rlon1/dlon)+ig,ig)
638 IF(mod(ig,2).NE.0.OR.im.LT.ig) iret=41
640 IF(iret.EQ.0.AND.idrti.EQ.0)
THEN
643 dlat=(rlat2-rlat1)/(jm-1)
644 jg=nint(180/abs(dlat))
645 IF(jm.EQ.jg) idrti=256
646 IF(jm.NE.jg.AND.jm.NE.jg+1) iret=41
647 ELSEIF(iret.EQ.0.AND.idrti.EQ.4)
THEN
657 IF(iromb.EQ.0.AND.idrti.EQ.4) maxwv=(jmaxi-1)
658 IF(iromb.EQ.1.AND.idrti.EQ.4) maxwv=(jmaxi-1)/2
659 IF(iromb.EQ.0.AND.idrti.EQ.0) maxwv=(jmaxi-3)/2
660 IF(iromb.EQ.1.AND.idrti.EQ.0) maxwv=(jmaxi-3)/4
661 IF(iromb.EQ.0.AND.idrti.EQ.256) maxwv=(jmaxi-1)/2
662 IF(iromb.EQ.1.AND.idrti.EQ.256) maxwv=(jmaxi-1)/4
664 IF((iromb.NE.0.AND.iromb.NE.1).OR.maxwv.LT.0) iret=42
676 IF(iscan.EQ.1) iskipi=-iskipi
677 IF(jscan.EQ.0) jskipi=-jskipi
680 IF((kgdso(1).EQ.0.OR.kgdso(1).EQ.4).AND. &
681 mod(kgdso(2),2).EQ.0.AND.kgdso(5).EQ.0.AND.kgdso(11).EQ.0)
THEN
686 dlono=(mod(rlon2-1+3600,360.)+1)/(imo-1)
687 igo=nint(360/abs(dlono))
688 IF(imo.EQ.igo.AND.idrto.EQ.0)
THEN
691 dlat=(rlat2-rlat1)/(jmo-1)
692 jgo=nint(180/abs(dlat))
693 IF(jmo.EQ.jgo) idrto=256
694 IF(jmo.EQ.jgo.OR.jmo.EQ.jgo+1) ispec=1
695 ELSEIF(imo.EQ.igo.AND.idrto.EQ.4)
THEN
697 IF(jmo.EQ.jgo) ispec=1
700 CALL sptrun(iromb,maxwv,idrti,imaxi,jmaxi,idrto,imo,jmo, &
701 km,iprime,iskipi,jskipi,mi,0,0,mo,0,gi,go)
704 ELSEIF(kgdso(1).EQ.5.AND. &
705 kgdso(2).EQ.kgdso(3).AND.mod(kgdso(2),2).EQ.1.AND. &
706 kgdso(8).EQ.kgdso(9).AND.kgdso(11).EQ.64)
THEN
710 orient=kgdso(7)*1.e-3
712 iproj=mod(kgdso(10)/128,2)
715 de=(1.+sin(60./dpr))*rerth
716 dr=de*cos(rlat1/dpr)/(1+h*sin(rlat1/dpr))
717 xp=1-h*sin((rlon1-orient)/dpr)*dr/xmesh
718 yp=1+cos((rlon1-orient)/dpr)*dr/xmesh
719 IF(nint(xp).EQ.ip.AND.nint(yp).EQ.ip)
THEN
721 CALL sptruns(iromb,maxwv,idrti,imaxi,jmaxi,km,nps, &
722 iprime,iskipi,jskipi,mi,mo,0,0,0, &
723 60.,xmesh,orient,gi,go,go2)
725 CALL sptruns(iromb,maxwv,idrti,imaxi,jmaxi,km,nps, &
726 iprime,iskipi,jskipi,mi,mo,0,0,0, &
727 60.,xmesh,orient,gi,go2,go)
732 ELSEIF(kgdso(1).EQ.1)
THEN
739 iscano=mod(kgdso(11)/128,2)
740 jscano=mod(kgdso(11)/64,2)
741 nscano=mod(kgdso(11)/32,2)
745 dlono=hi*(mod(hi*(rlon2-rlon1)-1+3600,360.)+1)/(ni-1)
746 dlato=hj*dy/(rerth*cos(rlati/dpr))*dpr
748 CALL sptrunm(iromb,maxwv,idrti,imaxi,jmaxi,km,ni,nj, &
749 iprime,iskipi,jskipi,mi,mo,0,0,0, &
750 rlat1,rlon1,dlato,dlono,gi,go)
756 CALL sptrung(iromb,maxwv,idrti,imaxi,jmaxi,km,no, &
757 iprime,iskipi,jskipi,mi,mo,0,0,0,rlat,rlon,gi,go)
888 IGDTNUMO,IGDTMPLO,IGDTLENO, &
889 MI,MO,KM,IBI,UI,VI, &
890 NO,RLAT,RLON,CROT,SROT,IBO,LO,UO,VO,IRET)
891 INTEGER,
INTENT(IN ) :: IPOPT(20), IBI(KM)
892 INTEGER,
INTENT(IN ) :: KM, MI, MO
893 INTEGER,
INTENT( OUT) :: IRET, IBO(KM), NO
894 INTEGER,
INTENT(IN ) :: IGDTNUMI, IGDTLENI
895 INTEGER,
INTENT(IN ) :: IGDTMPLI(IGDTLENI)
896 INTEGER,
INTENT(IN ) :: IGDTNUMO, IGDTLENO
897 INTEGER,
INTENT(IN ) :: IGDTMPLO(IGDTLENO)
899 LOGICAL*1,
INTENT( OUT) :: LO(MO,KM)
901 REAL,
INTENT(IN ) :: UI(MI,KM),VI(MI,KM)
902 REAL,
INTENT( OUT) :: UO(MO,KM),VO(MO,KM)
903 REAL,
INTENT(INOUT) :: RLAT(MO),RLON(MO)
904 REAL,
INTENT( OUT) :: CROT(MO),SROT(MO)
906 REAL,
PARAMETER :: FILL=-9999.
907 REAL,
PARAMETER :: PI=3.14159265358979
908 REAL,
PARAMETER :: DPR=180./pi
910 INTEGER :: IDRTO, IROMB, ISKIPI, ISPEC
911 INTEGER :: IDRTI, IMAXI, JMAXI, IM, JM
912 INTEGER :: IPRIME, IG, IMO, JMO, IGO, JGO
913 INTEGER :: ISCAN, JSCAN, NSCAN
914 INTEGER :: ISCANO, JSCANO, NSCANO
915 INTEGER :: ISCALE, IP, IPROJ, JSKIPI, JG
916 INTEGER :: K, MAXWV, N, NI, NJ, NPS
918 REAL :: DLAT, DLON, DLATO, DLONO, DE, DR, DY
919 REAL :: DUM, E2, H, HI, HJ
920 REAL :: ORIENT, RERTH, SLAT
921 REAL :: RLAT1, RLON1, RLAT2, RLON2, RLATI
922 REAL :: UROT, VROT, UO2(MO,KM),VO2(MO,KM)
923 REAL :: XMESH, X, XP, YP, XPTS(MO),YPTS(MO)
926 class(
ip_grid),
allocatable :: grid_in, grid_out
937 IF(igdtnumo.GE.0)
THEN
938 CALL gdswzd(grid_out, 0,mo,fill,xpts,ypts, &
939 rlon,rlat,no,crot,srot)
949 IF(idrti==40) idrti=4
950 IF(idrti==0.OR.idrti==4)
THEN
953 iscale=igdtmpli(10)*igdtmpli(11)
954 IF(iscale==0) iscale=10**6
955 rlon1=float(igdtmpli(13))/float(iscale)
956 rlon2=float(igdtmpli(16))/float(iscale)
957 iscan=mod(igdtmpli(19)/128,2)
958 jscan=mod(igdtmpli(19)/64,2)
959 nscan=mod(igdtmpli(19)/32,2)
964 IF(ibi(k).NE.0) iret=41
968 dlon=(mod(rlon2-rlon1-1+3600,360.)+1)/(im-1)
970 dlon=-(mod(rlon1-rlon2-1+3600,360.)+1)/(im-1)
972 ig=nint(360/abs(dlon))
973 iprime=1+mod(-nint(rlon1/dlon)+ig,ig)
976 IF(mod(ig,2).NE.0.OR.im.LT.ig) iret=41
978 IF(iret.EQ.0.AND.idrti.EQ.0)
THEN
979 iscale=igdtmpli(10)*igdtmpli(11)
980 IF(iscale==0) iscale=10**6
981 rlat1=float(igdtmpli(12))/float(iscale)
982 rlat2=float(igdtmpli(15))/float(iscale)
983 dlat=(rlat2-rlat1)/(jm-1)
984 jg=nint(180/abs(dlat))
985 IF(jm.EQ.jg) idrti=256
986 IF(jm.NE.jg.AND.jm.NE.jg+1) iret=41
987 ELSEIF(iret.EQ.0.AND.idrti.EQ.4)
THEN
997 IF(iromb.EQ.0.AND.idrti.EQ.4) maxwv=(jmaxi-1)
998 IF(iromb.EQ.1.AND.idrti.EQ.4) maxwv=(jmaxi-1)/2
999 IF(iromb.EQ.0.AND.idrti.EQ.0) maxwv=(jmaxi-3)/2
1000 IF(iromb.EQ.1.AND.idrti.EQ.0) maxwv=(jmaxi-3)/4
1001 IF(iromb.EQ.0.AND.idrti.EQ.256) maxwv=(jmaxi-1)/2
1002 IF(iromb.EQ.1.AND.idrti.EQ.256) maxwv=(jmaxi-1)/4
1004 IF((iromb.NE.0.AND.iromb.NE.1).OR.maxwv.LT.0) iret=42
1016 IF(iscan.EQ.1) iskipi=-iskipi
1017 IF(jscan.EQ.0) jskipi=-jskipi
1020 IF((igdtnumo.EQ.0.OR.igdtnumo.EQ.40).AND. &
1021 mod(igdtmplo(8),2).EQ.0.AND.igdtmplo(13).EQ.0.AND. &
1022 igdtmplo(19).EQ.0)
THEN
1024 IF(idrto==40)idrto=4
1027 iscale=igdtmplo(10)*igdtmplo(11)
1028 IF(iscale==0) iscale=10**6
1029 rlon2=float(igdtmplo(16))/float(iscale)
1030 dlono=(mod(rlon2-1+3600,360.)+1)/(imo-1)
1031 igo=nint(360/abs(dlono))
1032 IF(imo.EQ.igo.AND.idrto.EQ.0)
THEN
1033 rlat1=float(igdtmplo(12))/float(iscale)
1034 rlat2=float(igdtmplo(15))/float(iscale)
1035 dlat=(rlat2-rlat1)/(jmo-1)
1036 jgo=nint(180/abs(dlat))
1037 IF(jmo.EQ.jgo) idrto=256
1038 IF(jmo.EQ.jgo.OR.jmo.EQ.jgo+1) ispec=1
1039 ELSEIF(imo.EQ.igo.AND.idrto.EQ.4)
THEN
1041 IF(jmo.EQ.jgo) ispec=1
1044 CALL sptrunv(iromb,maxwv,idrti,imaxi,jmaxi,idrto,imo,jmo, &
1045 km,iprime,iskipi,jskipi,mi,0,0,mo,0,ui,vi, &
1046 .true.,uo,vo,.false.,dum,dum,.false.,dum,dum)
1049 ELSEIF(igdtnumo.EQ.20.AND. &
1050 igdtmplo(8).EQ.igdtmplo(9).AND.mod(igdtmplo(8),2).EQ.1.AND. &
1051 igdtmplo(15).EQ.igdtmplo(16).AND.igdtmplo(18).EQ.64.AND. &
1052 mod(igdtmplo(12)/8,2).EQ.1)
THEN
1054 rlat1=float(igdtmplo(10))*1.e-6
1055 rlon1=float(igdtmplo(11))*1.e-6
1056 orient=float(igdtmplo(14))*1.e-6
1057 xmesh=float(igdtmplo(15))*1.e-3
1058 iproj=mod(igdtmplo(17)/128,2)
1061 slat=float(abs(igdtmplo(13)))*1.e-6
1063 de=(1.+sin(slat/dpr))*rerth
1064 dr=de*cos(rlat1/dpr)/(1+h*sin(rlat1/dpr))
1065 xp=1-h*sin((rlon1-orient)/dpr)*dr/xmesh
1066 yp=1+cos((rlon1-orient)/dpr)*dr/xmesh
1067 IF(nint(xp).EQ.ip.AND.nint(yp).EQ.ip)
THEN
1069 CALL sptrunsv(iromb,maxwv,idrti,imaxi,jmaxi,km,nps, &
1070 iprime,iskipi,jskipi,mi,mo,0,0,0, &
1071 slat,xmesh,orient,ui,vi,.true.,uo,vo,uo2,vo2, &
1072 .false.,dum,dum,dum,dum, &
1073 .false.,dum,dum,dum,dum)
1075 CALL sptrunsv(iromb,maxwv,idrti,imaxi,jmaxi,km,nps, &
1076 iprime,iskipi,jskipi,mi,mo,0,0,0, &
1077 slat,xmesh,orient,ui,vi,.true.,uo2,vo2,uo,vo, &
1078 .false.,dum,dum,dum,dum, &
1079 .false.,dum,dum,dum,dum)
1084 ELSEIF(igdtnumo.EQ.10)
THEN
1087 rlat1=float(igdtmplo(10))*1.0e-6
1088 rlon1=float(igdtmplo(11))*1.0e-6
1089 rlon2=float(igdtmplo(15))*1.0e-6
1090 rlati=float(igdtmplo(13))*1.0e-6
1091 iscano=mod(igdtmplo(16)/128,2)
1092 jscano=mod(igdtmplo(16)/64,2)
1093 nscano=mod(igdtmplo(16)/32,2)
1094 dy=float(igdtmplo(19))*1.0e-3
1096 hj=(-1.)**(1-jscano)
1098 dlono=hi*(mod(hi*(rlon2-rlon1)-1+3600,360.)+1)/(ni-1)
1099 dlato=hj*dy/(rerth*cos(rlati/dpr))*dpr
1100 IF(nscano.EQ.0)
THEN
1101 CALL sptrunmv(iromb,maxwv,idrti,imaxi,jmaxi,km,ni,nj, &
1102 iprime,iskipi,jskipi,mi,mo,0,0,0, &
1103 rlat1,rlon1,dlato,dlono,ui,vi, &
1104 .true.,uo,vo,.false.,dum,dum,.false.,dum,dum)
1110 CALL sptrungv(iromb,maxwv,idrti,imaxi,jmaxi,km,no, &
1111 iprime,iskipi,jskipi,mi,mo,0,0,0,rlat,rlon, &
1112 ui,vi,.true.,uo,vo,.false.,x,x,.false.,x,x)
1117 urot=crot(n)*uo(n,k)-srot(n)*vo(n,k)
1118 vrot=srot(n)*uo(n,k)+crot(n)*vo(n,k)
1222 NO,RLAT,RLON,CROT,SROT,IBO,LO,UO,VO,IRET)
1223 INTEGER,
INTENT(IN ) :: IPOPT(20), IBI(KM)
1224 INTEGER,
INTENT(IN ) :: KM, MI, MO
1225 INTEGER,
INTENT( OUT) :: IRET, IBO(KM)
1226 INTEGER,
INTENT(IN) :: KGDSI(200),KGDSO(200)
1228 LOGICAL*1,
INTENT( OUT) :: LO(MO,KM)
1230 REAL,
INTENT(IN ) :: UI(MI,KM),VI(MI,KM)
1231 REAL,
INTENT( OUT) :: UO(MO,KM),VO(MO,KM)
1232 REAL,
INTENT(INOUT) :: RLAT(MO),RLON(MO)
1233 REAL,
INTENT( OUT) :: CROT(MO),SROT(MO)
1235 REAL,
PARAMETER :: FILL=-9999.
1236 REAL,
PARAMETER :: RERTH=6.3712e6
1237 REAL,
PARAMETER :: PI=3.14159265358979
1238 REAL,
PARAMETER :: DPR=180./pi
1240 INTEGER :: IDRTO, IROMB, ISKIPI, ISPEC
1241 INTEGER :: IDRTI, IMAXI, JMAXI, IM, JM
1242 INTEGER :: IPRIME, IG, IMO, JMO, IGO, JGO
1243 INTEGER :: ISCAN, JSCAN, NSCAN
1244 INTEGER :: ISCANO, JSCANO, NSCANO
1245 INTEGER :: IP, IPROJ, JSKIPI, JG
1246 INTEGER :: K, MAXWV, N, NI, NJ, NO, NPS
1248 REAL :: DLAT, DLON, DLATO, DLONO, DE, DR, DY
1249 REAL :: DUM, H, HI, HJ
1251 REAL :: RLAT1, RLON1, RLAT2, RLON2, RLATI
1252 REAL :: UROT, VROT, UO2(MO,KM),VO2(MO,KM)
1253 REAL :: XMESH, X, XP, YP, XPTS(MO),YPTS(MO)
1256 class(
ip_grid),
allocatable :: grid_in, grid_out
1266 IF(kgdso(1).GE.0)
THEN
1267 CALL gdswzd(grid_out, 0,mo,fill,xpts,ypts,rlon,rlat,no,crot,srot)
1279 rlon1=kgdsi(5)*1.e-3
1280 rlon2=kgdsi(8)*1.e-3
1281 iscan=mod(kgdsi(11)/128,2)
1282 jscan=mod(kgdsi(11)/64,2)
1283 nscan=mod(kgdsi(11)/32,2)
1284 IF(idrti.NE.0.AND.idrti.NE.4) iret=41
1286 IF(ibi(k).NE.0) iret=41
1290 dlon=(mod(rlon2-rlon1-1+3600,360.)+1)/(im-1)
1292 dlon=-(mod(rlon1-rlon2-1+3600,360.)+1)/(im-1)
1294 ig=nint(360/abs(dlon))
1295 iprime=1+mod(-nint(rlon1/dlon)+ig,ig)
1298 IF(mod(ig,2).NE.0.OR.im.LT.ig) iret=41
1300 IF(iret.EQ.0.AND.idrti.EQ.0)
THEN
1301 rlat1=kgdsi(4)*1.e-3
1302 rlat2=kgdsi(7)*1.e-3
1303 dlat=(rlat2-rlat1)/(jm-1)
1304 jg=nint(180/abs(dlat))
1305 IF(jm.EQ.jg) idrti=256
1306 IF(jm.NE.jg.AND.jm.NE.jg+1) iret=41
1307 ELSEIF(iret.EQ.0.AND.idrti.EQ.4)
THEN
1309 IF(jm.NE.jg) iret=41
1316 IF(maxwv.EQ.-1)
THEN
1317 IF(iromb.EQ.0.AND.idrti.EQ.4) maxwv=(jmaxi-1)
1318 IF(iromb.EQ.1.AND.idrti.EQ.4) maxwv=(jmaxi-1)/2
1319 IF(iromb.EQ.0.AND.idrti.EQ.0) maxwv=(jmaxi-3)/2
1320 IF(iromb.EQ.1.AND.idrti.EQ.0) maxwv=(jmaxi-3)/4
1321 IF(iromb.EQ.0.AND.idrti.EQ.256) maxwv=(jmaxi-1)/2
1322 IF(iromb.EQ.1.AND.idrti.EQ.256) maxwv=(jmaxi-1)/4
1324 IF((iromb.NE.0.AND.iromb.NE.1).OR.maxwv.LT.0) iret=42
1336 IF(iscan.EQ.1) iskipi=-iskipi
1337 IF(jscan.EQ.0) jskipi=-jskipi
1340 IF((kgdso(1).EQ.0.OR.kgdso(1).EQ.4).AND. &
1341 mod(kgdso(2),2).EQ.0.AND.kgdso(5).EQ.0.AND. &
1342 kgdso(11).EQ.0)
THEN
1346 rlon2=kgdso(8)*1.e-3
1347 dlono=(mod(rlon2-1+3600,360.)+1)/(imo-1)
1348 igo=nint(360/abs(dlono))
1349 IF(imo.EQ.igo.AND.idrto.EQ.0)
THEN
1350 rlat1=kgdso(4)*1.e-3
1351 rlat2=kgdso(7)*1.e-3
1352 dlat=(rlat2-rlat1)/(jmo-1)
1353 jgo=nint(180/abs(dlat))
1354 IF(jmo.EQ.jgo) idrto=256
1355 IF(jmo.EQ.jgo.OR.jmo.EQ.jgo+1) ispec=1
1356 ELSEIF(imo.EQ.igo.AND.idrto.EQ.4)
THEN
1358 IF(jmo.EQ.jgo) ispec=1
1361 CALL sptrunv(iromb,maxwv,idrti,imaxi,jmaxi,idrto,imo,jmo, &
1362 km,iprime,iskipi,jskipi,mi,0,0,mo,0,ui,vi, &
1363 .true.,uo,vo,.false.,dum,dum,.false.,dum,dum)
1366 ELSEIF(kgdso(1).EQ.5.AND. &
1367 kgdso(2).EQ.kgdso(3).AND.mod(kgdso(2),2).EQ.1.AND. &
1368 kgdso(8).EQ.kgdso(9).AND.kgdso(11).EQ.64.AND. &
1369 mod(kgdso(6)/8,2).EQ.1)
THEN
1371 rlat1=kgdso(4)*1.e-3
1372 rlon1=kgdso(5)*1.e-3
1373 orient=kgdso(7)*1.e-3
1375 iproj=mod(kgdso(10)/128,2)
1378 de=(1.+sin(60./dpr))*rerth
1379 dr=de*cos(rlat1/dpr)/(1+h*sin(rlat1/dpr))
1380 xp=1-h*sin((rlon1-orient)/dpr)*dr/xmesh
1381 yp=1+cos((rlon1-orient)/dpr)*dr/xmesh
1382 IF(nint(xp).EQ.ip.AND.nint(yp).EQ.ip)
THEN
1384 CALL sptrunsv(iromb,maxwv,idrti,imaxi,jmaxi,km,nps, &
1385 iprime,iskipi,jskipi,mi,mo,0,0,0, &
1386 60.,xmesh,orient,ui,vi,.true.,uo,vo,uo2,vo2, &
1387 .false.,dum,dum,dum,dum, &
1388 .false.,dum,dum,dum,dum)
1390 CALL sptrunsv(iromb,maxwv,idrti,imaxi,jmaxi,km,nps, &
1391 iprime,iskipi,jskipi,mi,mo,0,0,0, &
1392 60.,xmesh,orient,ui,vi,.true.,uo2,vo2,uo,vo, &
1393 .false.,dum,dum,dum,dum, &
1394 .false.,dum,dum,dum,dum)
1399 ELSEIF(kgdso(1).EQ.1)
THEN
1402 rlat1=kgdso(4)*1.e-3
1403 rlon1=kgdso(5)*1.e-3
1404 rlon2=kgdso(8)*1.e-3
1405 rlati=kgdso(9)*1.e-3
1406 iscano=mod(kgdso(11)/128,2)
1407 jscano=mod(kgdso(11)/64,2)
1408 nscano=mod(kgdso(11)/32,2)
1411 hj=(-1.)**(1-jscano)
1412 dlono=hi*(mod(hi*(rlon2-rlon1)-1+3600,360.)+1)/(ni-1)
1413 dlato=hj*dy/(rerth*cos(rlati/dpr))*dpr
1414 IF(nscano.EQ.0)
THEN
1415 CALL sptrunmv(iromb,maxwv,idrti,imaxi,jmaxi,km,ni,nj, &
1416 iprime,iskipi,jskipi,mi,mo,0,0,0, &
1417 rlat1,rlon1,dlato,dlono,ui,vi, &
1418 .true.,uo,vo,.false.,dum,dum,.false.,dum,dum)
1424 CALL sptrungv(iromb,maxwv,idrti,imaxi,jmaxi,km,no, &
1425 iprime,iskipi,jskipi,mi,mo,0,0,0,rlat,rlon, &
1426 ui,vi,.true.,uo,vo,.false.,x,x,.false.,x,x)
1431 urot=crot(n)*uo(n,k)-srot(n)*vo(n,k)
1432 vrot=srot(n)*uo(n,k)+crot(n)*vo(n,k)
Determine earth radius and shape.
subroutine, public earth_radius(IGDTMPL, IGDTLEN, RADIUS, ECCEN_SQUARED)
Determine earth radius and shape.
Driver module for gdswzd routines.
Users derived type grid descriptor objects to abstract away the raw GRIB1 and GRIB2 grid definitions.
Routines for creating an ip_grid given a Grib descriptor.
subroutine polatev4_grib2(IPOPT, IGDTNUMI, IGDTMPLI, IGDTLENI, IGDTNUMO, IGDTMPLO, IGDTLENO, MI, MO, KM, IBI, UI, VI, NO, RLAT, RLON, CROT, SROT, IBO, LO, UO, VO, IRET)
Interpolate vector fields (spectral).
subroutine interpolate_spectral_scalar(IPOPT, grid_in, grid_out, MI, MO, KM, IBI, GI, NO, RLAT, RLON, IBO, LO, GO, IRET)
Interpolate spectral scalar.
subroutine polates4_grib2(IPOPT, IGDTNUMI, IGDTMPLI, IGDTLENI, IGDTNUMO, IGDTMPLO, IGDTLENO, MI, MO, KM, IBI, GI, NO, RLAT, RLON, IBO, LO, GO, IRET)
Interpolate scalar fields (spectral).
subroutine polates4_grib1(IPOPT, KGDSI, KGDSO, MI, MO, KM, IBI, GI, NO, RLAT, RLON, IBO, LO, GO, IRET)
Interpolate scalar fields (spectral).
subroutine interpolate_spectral_vector(IPOPT, grid_in, grid_out, MI, MO, KM, IBI, UI, VI, NO, RLAT, RLON, CROT, SROT, IBO, LO, UO, VO, IRET)
Interpolate spectral vector.
subroutine polatev4_grib1(IPOPT, KGDSI, KGDSO, MI, MO, KM, IBI, UI, VI, NO, RLAT, RLON, CROT, SROT, IBO, LO, UO, VO, IRET)
Interpolate vector fields (spectral).
Descriptor representing a grib1 grib descriptor section (GDS) with an integer array.
Grib-2 descriptor containing a grib2 GDT represented by an integer array.
Abstract grid that holds fields and methods common to all grids.