67 real :: dx, dy, hi, hj
68 integer :: iproj, iscan, jscan
70 associate(kgds => g1_desc%gds)
72 self%eccen_squared = 0.0
77 self%RLAT1=kgds(4)*1.e-3
78 self%RLON1=kgds(5)*1.e-3
80 self%IROT=mod(kgds(6)/8,2)
81 self%ORIENT=kgds(7)*1.e-3
86 iproj=mod(kgds(10)/128,2)
87 iscan=mod(kgds(11)/128,2)
88 jscan=mod(kgds(11)/64,2)
90 self%RLATI1=kgds(12)*1.e-3
91 self%RLATI2=kgds(13)*1.e-3
102 self%nscan = mod(kgds(11) / 32, 2)
103 self%nscan_field_pos = self%nscan
117 type(grib2_descriptor),
intent(in) :: g2_desc
119 real :: dx, dy, hi, hj
120 integer :: iproj, iscan, jscan
123 associate(igdtmpl => g2_desc%gdt_tmpl, igdtlen => g2_desc%gdt_len)
124 call earth_radius(igdtmpl, igdtlen, self%rerth, self%eccen_squared)
129 self%RLAT1=float(igdtmpl(10))*1.0e-6
130 self%RLON1=float(igdtmpl(11))*1.0e-6
132 self%IROT=mod(igdtmpl(12)/8,2)
133 self%ORIENT=float(igdtmpl(14))*1.0e-6
135 dx=float(igdtmpl(15))*1.0e-3
136 dy=float(igdtmpl(16))*1.0e-3
138 iproj=mod(igdtmpl(17)/128,2)
139 iscan=mod(igdtmpl(18)/128,2)
140 jscan=mod(igdtmpl(18)/64,2)
142 self%RLATI1=float(igdtmpl(19))*1.0e-6
143 self%RLATI2=float(igdtmpl(20))*1.0e-6
151 self%nscan = mod(igdtmpl(18) / 32, 2)
152 self%nscan_field_pos = self%nscan
223 XPTS,YPTS,RLON,RLAT,NRET, &
224 CROT,SROT,XLON,XLAT,YLON,YLAT,AREA)
228 INTEGER,
INTENT(IN ) :: IOPT, NPTS
229 INTEGER,
INTENT( OUT) :: NRET
231 REAL,
INTENT(IN ) :: FILL
232 REAL,
INTENT(INOUT) :: RLON(NPTS),RLAT(NPTS)
233 REAL,
INTENT(INOUT) :: XPTS(NPTS),YPTS(NPTS)
234 REAL,
OPTIONAL,
INTENT( OUT) :: CROT(NPTS),SROT(NPTS)
235 REAL,
OPTIONAL,
INTENT( OUT) :: XLON(NPTS),XLAT(NPTS)
236 REAL,
OPTIONAL,
INTENT( OUT) :: YLON(NPTS),YLAT(NPTS),AREA(NPTS)
240 LOGICAL :: LROT, LMAP, LAREA
245 REAL :: ORIENT, RLAT1, RLON1
246 REAL :: RLATI1, RLATI2
247 REAL :: XMAX, XMIN, YMAX, YMIN, XP, YP
250 IF(
PRESENT(crot)) crot=fill
251 IF(
PRESENT(srot)) srot=fill
252 IF(
PRESENT(xlon)) xlon=fill
253 IF(
PRESENT(xlat)) xlat=fill
254 IF(
PRESENT(ylon)) ylon=fill
255 IF(
PRESENT(ylat)) ylat=fill
256 IF(
PRESENT(area)) area=fill
276 IF(abs(rlati1-rlati2).LT.tinyreal)
THEN
279 an=log(cos(rlati1/dpr)/cos(rlati2/dpr))/ &
280 log(tan((90-rlati1)/2/dpr)/tan((90-rlati2)/2/dpr))
282 de=
rerth*cos(rlati1/dpr)*tan((rlati1+90)/2/dpr)**
an/
an
283 IF(abs(
h*rlat1-90).LT.tinyreal)
THEN
287 dr=de/tan((rlat1+90)/2/dpr)**
an
288 dlon1=mod(rlon1-orient+180+3600,360.)-180
289 xp=1-sin(
an*dlon1/dpr)*dr/
dxs
290 yp=1+cos(
an*dlon1/dpr)*dr/
dys
299 IF(
PRESENT(crot).AND.
PRESENT(srot))
THEN
304 IF(
PRESENT(xlon).AND.
PRESENT(xlat).AND.
PRESENT(ylon).AND.
PRESENT(ylat))
THEN
309 IF(
PRESENT(area))
THEN
316 IF(iopt.EQ.0.OR.iopt.EQ.1)
THEN
319 IF(xpts(n).GE.xmin.AND.xpts(n).LE.xmax.AND. &
320 ypts(n).GE.ymin.AND.ypts(n).LE.ymax)
THEN
321 di=
h*(xpts(n)-xp)*
dxs
322 dj=
h*(ypts(n)-yp)*
dys
325 IF(dr2.LT.de2*1.e-6)
THEN
329 rlon(n)=mod(orient+1./
an*dpr*atan2(di,-dj)+3600,360.)
330 rlat(n)=(2*dpr*atan((de2/dr2)**antr)-90)
333 dlon=mod(rlon(n)-orient+180+3600,360.)-180
336 xlon(n),xlat(n),ylon(n),ylat(n))
345 ELSEIF(iopt.EQ.-1)
THEN
348 IF(abs(rlon(n)).LT.(360.+tinyreal).AND.abs(rlat(n)).LT.(90.+tinyreal).AND. &
349 abs(
h*rlat(n)+90).GT.tinyreal)
THEN
350 dr=
h*de*tan((90-rlat(n))/2/dpr)**
an
351 dlon=mod(rlon(n)-orient+180+3600,360.)-180
352 xpts(n)=xp+
h*sin(
an*dlon/dpr)*dr/
dxs
353 ypts(n)=yp-
h*cos(
an*dlon/dpr)*dr/
dys
354 IF(xpts(n).GE.xmin.AND.xpts(n).LE.xmax.AND. &
355 ypts(n).GE.ymin.AND.ypts(n).LE.ymax)
THEN
359 xlon(n),xlat(n),ylon(n),ylat(n))
433 REAL,
INTENT(IN ) :: RLAT, FILL, DLON, DR
434 REAL,
INTENT( OUT) :: XLON, XLAT, YLON, YLAT
439 IF(clat.LE.0.OR.dr.LE.0)
THEN
445 xlon=
h*cos(
an*dlon/dpr)*
an/dpr*dr/
dxs
446 xlat=-
h*sin(
an*dlon/dpr)*
an/dpr*dr/
dxs/clat
447 ylon=
h*sin(
an*dlon/dpr)*
an/dpr*dr/
dys
448 ylat=
h*cos(
an*dlon/dpr)*
an/dpr*dr/
dys/clat
void gdswzd(int igdtnum, int *igdtmpl, int igdtlen, int iopt, int npts, float fill, float *xpts, float *ypts, float *rlon, float *rlat, int *nret, float *crot, float *srot, float *xlon, float *xlat, float *ylon, float *ylat, float *area)
gdswzd() interface for C for _4 build of library.
subroutine lambert_conf_map_jacob(rlat, fill, dlon, dr, xlon, xlat, ylon, ylat)
Map jacobians for lambert conformal conical.
subroutine gdswzd_lambert_conf(self, iopt, npts, fill, xpts, ypts, rlon, rlat, nret, crot, srot, xlon, xlat, ylon, ylat, area)
GDS wizard for lambert conformal conical.