59 integer :: iscan, jscan
62 associate(kgds => g1_desc%gds)
64 self%eccen_squared = 0.0
69 self%RLAT1=kgds(4)*1.e-3
70 self%RLON1=kgds(5)*1.e-3
71 self%RLON2=kgds(8)*1.e-3
72 self%RLATI=kgds(9)*1.e-3
74 iscan=mod(kgds(11)/128,2)
75 jscan=mod(kgds(11)/64,2)
80 self%DLON=self%HI*(mod(self%HI*(self%RLON2-self%RLON1)-1+3600,360.)+1)/(self%IM-1)
81 self%DPHI=hj*dy/(self%RERTH*cos(self%RLATI/
dpr))
87 self%nscan = mod(kgds(11) / 32, 2)
88 self%nscan_field_pos = self%nscan
91 self%iwrap = nint(360 / abs(self%dlon))
92 if (self%im < self%iwrap) self%iwrap = 0
105 type(grib2_descriptor),
intent(in) :: g2_desc
107 integer :: iscan, jscan
110 associate(igdtmpl => g2_desc%gdt_tmpl, igdtlen => g2_desc%gdt_len)
112 call earth_radius(igdtmpl, igdtlen, self%rerth, self%eccen_squared)
117 self%RLAT1=float(igdtmpl(10))*1.0e-6
118 self%RLON1=float(igdtmpl(11))*1.0e-6
119 self%RLON2=float(igdtmpl(15))*1.0e-6
120 self%RLATI=float(igdtmpl(13))*1.0e-6
122 iscan=mod(igdtmpl(16)/128,2)
123 jscan=mod(igdtmpl(16)/64,2)
125 dy=float(igdtmpl(19))*1.0e-3
128 self%DLON=self%HI*(mod(self%HI*(self%RLON2-self%RLON1)-1+3600,360.)+1)/(self%IM-1)
129 self%DPHI=hj*dy/(self%RERTH*cos(self%RLATI/dpr))
134 self%nscan=mod(igdtmpl(16) / 32,2)
135 self%nscan_field_pos = self%nscan
137 self%iwrap = nint(360 / abs(self%dlon))
138 if(self%im < self%iwrap) self%iwrap = 0
202 XPTS,YPTS,RLON,RLAT,NRET, &
203 CROT,SROT,XLON,XLAT,YLON,YLAT,AREA)
207 INTEGER,
INTENT(IN ) :: IOPT, NPTS
208 INTEGER,
INTENT( OUT) :: NRET
210 REAL,
INTENT(IN ) :: FILL
211 REAL,
INTENT(INOUT) :: RLON(NPTS),RLAT(NPTS)
212 REAL,
INTENT(INOUT) :: XPTS(NPTS),YPTS(NPTS)
213 REAL,
OPTIONAL,
INTENT( OUT) :: CROT(NPTS),SROT(NPTS)
214 REAL,
OPTIONAL,
INTENT( OUT) :: XLON(NPTS),XLAT(NPTS)
215 REAL,
OPTIONAL,
INTENT( OUT) :: YLON(NPTS),YLAT(NPTS),AREA(NPTS)
219 LOGICAL :: LROT, LMAP, LAREA
222 REAL :: RLAT1, RLON1, RLON2, RLATI
223 REAL :: XMAX, XMIN, YMAX, YMIN
226 IF(
PRESENT(crot)) crot=fill
227 IF(
PRESENT(srot)) srot=fill
228 IF(
PRESENT(xlon)) xlon=fill
229 IF(
PRESENT(xlat)) xlat=fill
230 IF(
PRESENT(ylon)) ylon=fill
231 IF(
PRESENT(ylat)) ylat=fill
232 IF(
PRESENT(area)) area=fill
249 ye=1-log(tan((rlat1+90)/2/dpr))/
dphi
252 IF(im.EQ.nint(360/abs(
dlon))) xmax=im+2
256 IF(
PRESENT(crot).AND.
PRESENT(srot))
THEN
261 IF(
PRESENT(xlon).AND.
PRESENT(xlat).AND.
PRESENT(ylon).AND.
PRESENT(ylat))
THEN
266 IF(
PRESENT(area))
THEN
273 IF(iopt.EQ.0.OR.iopt.EQ.1)
THEN
276 IF(xpts(n).GE.xmin.AND.xpts(n).LE.xmax.AND. &
277 ypts(n).GE.ymin.AND.ypts(n).LE.ymax)
THEN
278 rlon(n)=mod(rlon1+
dlon*(xpts(n)-1)+3600,360.)
279 rlat(n)=2*atan(exp(
dphi*(ypts(n)-ye)))*dpr-90
292 ELSEIF(iopt.EQ.-1)
THEN
295 IF(abs(rlon(n)).LE.360.AND.abs(rlat(n)).LT.90)
THEN
296 xpts(n)=1+hi*mod(hi*(rlon(n)-rlon1)+3600,360.)/
dlon
297 ypts(n)=ye+log(tan((rlat(n)+90)/2/dpr))/
dphi
298 IF(xpts(n).GE.xmin.AND.xpts(n).LE.xmax.AND. &
299 ypts(n).GE.ymin.AND.ypts(n).LE.ymax)
THEN
337 REAL,
INTENT( OUT) :: CROT, SROT
365 REAL,
INTENT(IN ) :: RLAT
366 REAL,
INTENT( OUT) :: XLON, XLAT, YLON, YLAT
371 ylat=1./
dphi/cos(rlat/dpr)/dpr
393 REAL,
INTENT(IN ) :: RLAT
394 REAL,
INTENT( OUT) :: AREA
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.
Determine earth radius and shape.
Module containing common constants.
real, parameter dpr
Radians to degrees.
Users derived type grid descriptor objects to abstract away the raw GRIB1 and GRIB2 grid definitions.
GDS wizard for mercator cylindrical.
real dlon
Longitudinal direction grid length.
real dphi
Latitudinal direction grid length.
subroutine init_grib1(self, g1_desc)
Initializes a mercator grid given a grib1_descriptor object.
subroutine mercator_grid_area(rlat, area)
Grid box area for mercator cylindrical grids.
subroutine gdswzd_mercator(self, iopt, npts, fill, xpts, ypts, rlon, rlat, nret, crot, srot, xlon, xlat, ylon, ylat, area)
GDS wizard for mercator cylindrical.
subroutine mercator_vect_rot(crot, srot)
Vector rotation fields for mercator cylindrical grids.
subroutine init_grib2(self, g2_desc)
Init GRIB2.
subroutine mercator_map_jacob(rlat, xlon, xlat, ylon, ylat)
Map jacobians for mercator cylindrical grids.
real rerth
Radius of the Earth.
Descriptor representing a grib1 grib descriptor section (GDS) with an integer array.
Abstract grid that holds fields and methods common to all grids.