NCEPLIBS-g2  3.4.7
getdim.f
Go to the documentation of this file.
1 
5 
21  subroutine getdim(csec3,lcsec3,width,height,iscan)
22  implicit none
23 
24  character(len=1),intent(in) :: csec3(*)
25  integer,intent(in) :: lcsec3
26  integer,intent(out) :: width,height,iscan
27 
28  integer,pointer,dimension(:) :: igdstmpl,list_opt
29  integer :: igds(5)
30  integer iofst,igdtlen,num_opt,jerr
31 
32  interface
33  subroutine gf_unpack3(cgrib,lcgrib,iofst,igds,igdstmpl,
34  & mapgridlen,ideflist,idefnum,ierr)
35  character(len=1),intent(in) :: cgrib(lcgrib)
36  integer,intent(in) :: lcgrib
37  integer,intent(inout) :: iofst
38  integer,pointer,dimension(:) :: igdstmpl,ideflist
39  integer,intent(out) :: igds(5)
40  integer,intent(out) :: ierr,idefnum
41  end subroutine gf_unpack3
42  end interface
43 
44  nullify(igdstmpl,list_opt)
45  !
46  iofst=0 ! set offset to beginning of section
47  call gf_unpack3(csec3,lcsec3,iofst,igds,igdstmpl,
48  & igdtlen,list_opt,num_opt,jerr)
49  if (jerr.eq.0) then
50  selectcase( igds(5) ) ! Template number
51  case (0:3) ! Lat/Lon
52  width=igdstmpl(8)
53  height=igdstmpl(9)
54  iscan=igdstmpl(19)
55  case (10) ! Mercator
56  width=igdstmpl(8)
57  height=igdstmpl(9)
58  iscan=igdstmpl(16)
59  case (20) ! Polar Stereographic
60  width=igdstmpl(8)
61  height=igdstmpl(9)
62  iscan=igdstmpl(18)
63  case (30) ! Lambert Conformal
64  width=igdstmpl(8)
65  height=igdstmpl(9)
66  iscan=igdstmpl(18)
67  case (40:43) ! Gaussian
68  width=igdstmpl(8)
69  height=igdstmpl(9)
70  iscan=igdstmpl(19)
71  case (90) ! Space View/Orthographic
72  width=igdstmpl(8)
73  height=igdstmpl(9)
74  iscan=igdstmpl(17)
75  case (110) ! Equatorial Azimuthal
76  width=igdstmpl(8)
77  height=igdstmpl(9)
78  iscan=igdstmpl(16)
79  case default
80  width=0
81  height=0
82  iscan=0
83  end select
84  else
85  width=0
86  height=0
87  endif
88  !
89  if (associated(igdstmpl)) deallocate(igdstmpl)
90  if (associated(list_opt)) deallocate(list_opt)
91 
92  return
93  end
subroutine getdim(csec3, lcsec3, width, height, iscan)
This subroutine returns the dimensions and scanning mode of a grid definition packed in GRIB2 Grid De...
Definition: getdim.f:22
subroutine gf_unpack3(cgrib, lcgrib, iofst, igds, igdstmpl, mapgridlen, ideflist, idefnum, ierr)
Unpack Section 3 (Grid Definition Section) of a GRIB2 message, starting at octet 6 of that Section.
Definition: gf_unpack3.F90:52