NCEPLIBS-g2  3.4.5
drstemplates.f
Go to the documentation of this file.
1 
6 
37  module drstemplates
38 
39  integer,parameter :: maxlen=200
40  integer,parameter :: maxtemp=9
41 
42 
44  integer :: template_num
45  integer :: mapdrslen
46  integer,dimension(MAXLEN) :: mapdrs
47  logical :: needext
48  end type drstemplate
49 
50  type(drstemplate),dimension(MAXTEMP) :: templates
51 
52  data templates(1)%template_num /0/
53  data templates(1)%mapdrslen /5/
54  data templates(1)%needext /.false./
55  data (templates(1)%mapdrs(j),j=1,5)
56  & /4,-2,-2,1,1/
57 
58  data templates(2)%template_num /2/
59  data templates(2)%mapdrslen /16/
60  data templates(2)%needext /.false./
61  data (templates(2)%mapdrs(j),j=1,16)
62  & /4,-2,-2,1,1,1,1,4,4,4,1,1,4,1,4,1/
63 
64  data templates(3)%template_num /3/
65  data templates(3)%mapdrslen /18/
66  data templates(3)%needext /.false./
67  data (templates(3)%mapdrs(j),j=1,18)
68  & /4,-2,-2,1,1,1,1,4,4,4,1,1,4,1,4,1,1,1/
69 
70  data templates(4)%template_num /50/
71  data templates(4)%mapdrslen /5/
72  data templates(4)%needext /.false./
73  data (templates(4)%mapdrs(j),j=1,5)
74  & /4,-2,-2,1,4/
75 
76  data templates(5)%template_num /51/
77  data templates(5)%mapdrslen /10/
78  data templates(5)%needext /.false./
79  data (templates(5)%mapdrs(j),j=1,10)
80  & /4,-2,-2,1,-4,2,2,2,4,1/
81 
82  data templates(6)%template_num /40000/
83  data templates(6)%mapdrslen /7/
84  data templates(6)%needext /.false./
85  data (templates(6)%mapdrs(j),j=1,7)
86  & /4,-2,-2,1,1,1,1/
87 
88  data templates(7)%template_num /40010/
89  data templates(7)%mapdrslen /5/
90  data templates(7)%needext /.false./
91  data (templates(7)%mapdrs(j),j=1,5)
92  & /4,-2,-2,1,1/
93 
94  data templates(8)%template_num /40/
95  data templates(8)%mapdrslen /7/
96  data templates(8)%needext /.false./
97  data (templates(8)%mapdrs(j),j=1,7)
98  & /4,-2,-2,1,1,1,1/
99 
100  data templates(9)%template_num /41/
101  data templates(9)%mapdrslen /5/
102  data templates(9)%needext /.false./
103  data (templates(9)%mapdrs(j),j=1,5)
104  & /4,-2,-2,1,1/
105 
106 ! data templates(5)%template_num /1/ !< Simple Packing - Matrix
107 ! data templates(5)%mapdrslen /15/
108 ! data templates(5)%needext /.true./
109 ! data (templates(5)%mapdrs(j),j=1,15)
110 ! & /4,-2,-2,1,1,1,4,2,2,1,1,1,1,1,1/
111 
112 
113  contains
114 
119 
128  integer function getdrsindex(number)
129  integer,intent(in) :: number
130 
131  getdrsindex=-1
132 
133  do j=1,maxtemp
134  if (number.eq.templates(j)%template_num) then
135  getdrsindex=j
136  return
137  endif
138  enddo
139 
140  end function
141 
146 
164  subroutine getdrstemplate(number,nummap,map,needext,iret)
165  integer,intent(in) :: number
166  integer,intent(out) :: nummap,map(*),iret
167  logical,intent(out) :: needext
168 
169  iret=0
170 
171  index=getdrsindex(number)
172 
173  if (index.ne.-1) then
174  nummap=templates(index)%mapdrslen
175  needext=templates(index)%needext
176  map(1:nummap)=templates(index)%mapdrs(1:nummap)
177  else
178  nummap=0
179  needext=.false.
180  print *,'getdrstemplate: DRS Template ',number,
181  & ' not defined.'
182  iret=1
183  endif
184 
185  end subroutine
186 
191 
206  subroutine extdrstemplate(number,list,nummap,map)
207  integer,intent(in) :: number,list(*)
208  integer,intent(out) :: nummap,map(*)
209 
210  index=getdrsindex(number)
211  if (index.eq.-1) return
212 
213  if ( .not. templates(index)%needext ) return
214  nummap=templates(index)%mapdrslen
215  map(1:nummap)=templates(index)%mapdrs(1:nummap)
216 
217  if ( number.eq.1 ) then
218  n=list(11)+list(13)
219  do i=1,n
220  map(nummap+i)=4
221  enddo
222  nummap=nummap+n
223  endif
224 
225  end subroutine
226 
227  end module
228 
229 
230 
drstemplates
This Fortran Module contains info on all the available GRIB2 Data Representation Templates used in Se...
Definition: drstemplates.f:37
drstemplates::getdrstemplate
subroutine getdrstemplate(number, nummap, map, needext, iret)
This subroutine returns DRS template information for a .
Definition: drstemplates.f:165
drstemplates::getdrsindex
integer function getdrsindex(number)
This function returns the index of specified Data Representation Template 5.NN (NN=number) in array t...
Definition: drstemplates.f:129
drstemplates::maxlen
integer, parameter maxlen
maximum number of octets in mapgrid
Definition: drstemplates.f:39
drstemplates::maxtemp
integer, parameter maxtemp
maximum number of entries in the template
Definition: drstemplates.f:40
drstemplates::extdrstemplate
subroutine extdrstemplate(number, list, nummap, map)
This subroutine generates the remaining octet map for a given Data Representation Template,...
Definition: drstemplates.f:207
drstemplates::templates
type(drstemplate), dimension(maxtemp) templates
template in type of drstemplate
Definition: drstemplates.f:50
drstemplates::drstemplate
Definition: drstemplates.f:43