@@ -47,10 +47,10 @@ PROGRAM ecm_gfs_look_alike
47
47
implicit none
48
48
49
49
! command line parameter stuff
50
- integer narg,iargc
51
- character (255 ) cfpgb1,cfpgb2,cfpgb3
52
- integer ncfpgb1,ncfpgb2,ncfpgb3
53
- integer ,parameter :: lupgb1= 11 ,lupgb2= 51 ,lupgb3= 21
50
+ integer narg,iargc
51
+ character (255 ) cfpgb1,cfpgb2,cfpgb3
52
+ integer ncfpgb1,ncfpgb2,ncfpgb3
53
+ integer ,parameter :: lupgb1= 11 ,lupgb2= 51 ,lupgb3= 21
54
54
! end command line parameter stuff
55
55
56
56
real grav_polar / 9.8321849378 / ! (m/s2)
@@ -60,50 +60,50 @@ PROGRAM ecm_gfs_look_alike
60
60
real , allocatable :: ecm(:), gfs(:) , ecm2(:)
61
61
logical (1 ),allocatable :: lecm(:), lgfs (:), lecm2(:)
62
62
63
- integer ids(255 )
63
+ integer ids(255 )
64
64
integer ji,i,j,jj,k,kk,iret,kpds4,kpds14,kpds15,ki,kb1,kb2,lb
65
- integer kpds5,kpds6,kpds7
65
+ integer kpds5,kpds6,kpds7
66
66
67
67
!- ----------------------------------------------------------------------
68
- ! read/process 2/3 file names from command line parameters
68
+ ! read/process 2/3 file names from command line parameters
69
69
!- ----------------------------------------------------------------------
70
- narg= iargc()
71
- if (narg.lt. 2 .or. narg.gt. 4 ) then
72
- call errmsg(' Usage: ecm_file ecm_gfs_look-alike_file [ecm_file at t-12]' )
73
- call errexit(1 )
74
- endif
70
+ narg= iargc()
71
+ if (narg.lt. 2 .or. narg.gt. 4 ) then
72
+ call errmsg(' Usage: ecm_file ecm_gfs_look-alike_file [ecm_file at t-12]' )
73
+ call errexit(1 )
74
+ endif
75
75
76
- call getarg(1 ,cfpgb1)
77
- ncfpgb1= len_trim (cfpgb1)
76
+ call getarg(1 ,cfpgb1)
77
+ ncfpgb1= len_trim (cfpgb1)
78
78
call baopenr(lupgb1,cfpgb1,iret)
79
- print * ,' baopen ' ,cfpgb1,' iret =' ,iret
79
+ print * ,' baopen ' ,cfpgb1,' iret =' ,iret
80
80
if (iret .ne. 0 ) then
81
- call errexit(1 )
82
- endif
81
+ call errexit(1 )
82
+ endif
83
83
84
- call getarg(2 ,cfpgb2)
85
- ncfpgb2= len_trim (cfpgb2)
84
+ call getarg(2 ,cfpgb2)
85
+ ncfpgb2= len_trim (cfpgb2)
86
86
call baopenwt(lupgb2,cfpgb2,iret)
87
- print * ,' baopenwt ' ,cfpgb2,' iret =' ,iret
87
+ print * ,' baopenwt ' ,cfpgb2,' iret =' ,iret
88
88
if (iret .ne. 0 ) then
89
- call errexit(1 )
89
+ call errexit(1 )
90
90
endif
91
91
92
- if (narg .eq. 3 ) then
93
- call getarg(3 ,cfpgb3)
94
- ncfpgb3= len_trim (cfpgb3)
95
- call baopenr(lupgb3,cfpgb3,iret)
96
- print * ,' baopenr ' ,cfpgb3,' iret =' ,iret
97
- if (iret .ne. 0 ) then
98
- call errexit(1 )
99
- endif
100
- endif
92
+ if (narg .eq. 3 ) then
93
+ call getarg(3 ,cfpgb3)
94
+ ncfpgb3= len_trim (cfpgb3)
95
+ call baopenr(lupgb3,cfpgb3,iret)
96
+ print * ,' baopenr ' ,cfpgb3,' iret =' ,iret
97
+ if (iret .ne. 0 ) then
98
+ call errexit(1 )
99
+ endif
100
+ endif
101
101
102
102
103
103
!- ----------------------------------------------------------------------
104
- ! get default decimal scaling values
104
+ ! get default decimal scaling values
105
105
!- ----------------------------------------------------------------------
106
- call idsdef(1 ,ids)
106
+ call idsdef(1 ,ids)
107
107
108
108
!- ----------------------------------------------------------------------
109
109
! determine horizontal grid dimensions, ji
@@ -114,15 +114,15 @@ PROGRAM ecm_gfs_look_alike
114
114
call getgbh(lupgb1,0 ,j,jpds,jgds,j,ji,j,kpds,kgds,iret)
115
115
print * ,' getgbh ' ,cfpgb1,' iret = ' ,iret
116
116
if (iret .ne. 0 ) then
117
- call errexit(1 )
117
+ call errexit(1 )
118
118
endif
119
119
! print*,'ji =',ji
120
120
!- ----------------------------------------------------------------------
121
121
! allocate fcst grids and horizonatal bitmaps
122
122
!- ----------------------------------------------------------------------
123
123
allocate (ecm(ji),gfs(ji),lecm(ji),lgfs(ji))
124
- if (narg .eq. 3 ) then
125
- allocate (ecm2(ji),lecm2(ji))
124
+ if (narg .eq. 3 ) then
125
+ allocate (ecm2(ji),lecm2(ji))
126
126
endif
127
127
128
128
! read ecm and write gfs
@@ -136,86 +136,86 @@ PROGRAM ecm_gfs_look_alike
136
136
call getgb(lupgb1,0 ,ji,j,jpds,jgds,ki,k,kpds,kgds,lecm,ecm,iret)
137
137
if (iret.ne. 0 ) exit
138
138
! print*,'get 1,k,kpds(2-7,14-16) = ',k,(kpds(i),i=2,7),(kpds(i),i=14,16)
139
- kpds14= kpds(14 ) ! start time
140
- kpds15= kpds(15 ) ! end time
139
+ kpds14= kpds(14 ) ! start time
140
+ kpds15= kpds(15 ) ! end time
141
141
kb1= mod (kpds(4 )/ 64 ,2 ) ! .ne.0-bitmap exits
142
- gfs= ecm
143
- lgfs= lecm
142
+ gfs= ecm
143
+ lgfs= lecm
144
144
145
145
!- ---------------------------------------------------------------
146
146
! reset kpds(5,6,7) and convert values when necessary
147
147
!- ---------------------------------------------------------------
148
148
select case (kpds(5 ))
149
- !
150
- ! no10Usfc 0 165,1,0 ** surface 10 metre U wind component [m s**-1]
151
- ! UGRD10m 0 33,105,10 ** 10 m u wind [m/s]
152
- case (165 )
153
- kpds(5 )= 33 ; kpds(6 )= 105 ;kpds(7 )= 10
154
- !
155
- ! no10Vsfc 0 166,1,0 ** surface 10 metre V wind component [m s**-1]
156
- ! VGRD10m 0 34,105,10 ** 10 m v wind [m/s]
157
- case (166 )
158
- kpds(5 )= 34 ; kpds(6 )= 105 ;kpds(7 )= 10
159
- !
160
- ! no2Dsfc 0 168,1,0 ** surface 2 metre dewpoint temperature [K]
161
- ! DPT2m 0 17,105,2 ** 2 m Dew Point Temp. [K]
162
- case (168 )
163
- kpds(5 )= 17 ; kpds(6 )= 105 ;kpds(7 )= 2
164
- !
165
- ! no2Tsfc 0 167,1,0 ** surface 2 metre temperature [K]
166
- ! TMP2m 0 11,105,2 ** 2 m Temp. [K]
167
- case (167 )
168
- kpds(5 )= 11 ; kpds(6 )= 105 ;kpds(7 )= 2
169
- !
170
- ! GHprs 14 156,100,0 ** Height [m]
171
- ! HGTprs 14 7,100,0 ** Geopotential height [gpm]
172
- case (156 )
173
- kpds(5 )= 7
174
- !
175
- ! Z kpds5=129 kpds6=100 ** Z=Geopotential [m**2 s**-2]
176
- ! HGTprs 14 7,100,0 ** Geopotential height [gpm]
177
- case (129 )
178
- gfs= ecm/ grav_polar
179
- kpds(5 )= 7
180
- !
181
- ! LNSPhbl 0 152,109,1 ** Logarithm of surface pressure, old removed 17May2011
149
+ !
150
+ ! no10Usfc 0 165,1,0 ** surface 10 metre U wind component [m s**-1]
151
+ ! UGRD10m 0 33,105,10 ** 10 m u wind [m/s]
152
+ case (165 )
153
+ kpds(5 )= 33 ; kpds(6 )= 105 ;kpds(7 )= 10
154
+ !
155
+ ! no10Vsfc 0 166,1,0 ** surface 10 metre V wind component [m s**-1]
156
+ ! VGRD10m 0 34,105,10 ** 10 m v wind [m/s]
157
+ case (166 )
158
+ kpds(5 )= 34 ; kpds(6 )= 105 ;kpds(7 )= 10
159
+ !
160
+ ! no2Dsfc 0 168,1,0 ** surface 2 metre dewpoint temperature [K]
161
+ ! DPT2m 0 17,105,2 ** 2 m Dew Point Temp. [K]
162
+ case (168 )
163
+ kpds(5 )= 17 ; kpds(6 )= 105 ;kpds(7 )= 2
164
+ !
165
+ ! no2Tsfc 0 167,1,0 ** surface 2 metre temperature [K]
166
+ ! TMP2m 0 11,105,2 ** 2 m Temp. [K]
167
+ case (167 )
168
+ kpds(5 )= 11 ; kpds(6 )= 105 ;kpds(7 )= 2
169
+ !
170
+ ! GHprs 14 156,100,0 ** Height [m]
171
+ ! HGTprs 14 7,100,0 ** Geopotential height [gpm]
172
+ case (156 )
173
+ kpds(5 )= 7
174
+ !
175
+ ! Z kpds5=129 kpds6=100 ** Z=Geopotential [m**2 s**-2]
176
+ ! HGTprs 14 7,100,0 ** Geopotential height [gpm]
177
+ case (129 )
178
+ gfs= ecm/ grav_polar
179
+ kpds(5 )= 7
180
+ !
181
+ ! LNSPhbl 0 152,109,1 ** Logarithm of surface pressure, old removed 17May2011
182
182
! SPsfc 0 134,1,0 ** surface Surface pressure [Pa]
183
- ! PRESsfc 0 1,1,0 ** surface Pressure [Pa]
184
- case (134 )
185
- kpds(5 )= 1 ; kpds(6 )= 1 ;kpds(7 )= 0
186
- ! gfs=exp(ecm)
187
- gfs= ecm
188
- !
189
- ! MN2Tsfc 0 202,1,0 ** surface Min 2 m temp since previous post [K]
190
- ! TMIN2m 0 16,105,2 ** 2 m Min. temp. [K]
191
- case (202 )
192
- kpds(5 )= 16 ; kpds(6 )= 105 ;kpds(7 )= 2
193
- !
194
- ! MSLsfc 0 151,1,0 ** surface Mean sea-level pressure [Pa]
195
- ! PRMSLmsl 0 2,102,0 ** Pressure reduced to MSL [Pa]
196
- case (151 )
197
- kpds(5 )= 2 ; kpds(6 )= 102 ;kpds(7 )= 0
198
- !
199
- ! MX2Tsfc 0 201,1,0 ** surface Max 2 m temp since previous post [K]
200
- ! TMAX2m 0 15,105,2 ** 2 m Max. temp. [K]
201
- case (201 )
202
- kpds(5 )= 15 ; kpds(6 )= 105 ;kpds(7 )= 2
203
- !
204
- ! Rprs 14 157,100,0 ** Relative humidity [%]
205
- ! RHprs 14 52,100,0 ** Relative humidity [%]
206
- case (157 )
207
- kpds(5 )= 52
208
- !
209
- ! Tprs 14 130,100,0 ** Temperature [K]
210
- ! TMPprs 14 11,100,0 ** Temp. [K]
211
- case (130 )
212
- kpds(5 )= 11 ; kpds(6 )= 100
213
- !
214
- ! TCCsfc 0 164,1,0 ** surface Total cloud cover [(0 - 1)]
215
- ! TCDCclm 0 71,200,0 ** atmos column Total cloud cover [%]
216
- case (164 )
217
- kpds(5 )= 71 ; kpds(6 )= 244 ;kpds(7 )= 0
218
- gfs= 100 .* ecm
183
+ ! PRESsfc 0 1,1,0 ** surface Pressure [Pa]
184
+ case (134 )
185
+ kpds(5 )= 1 ; kpds(6 )= 1 ;kpds(7 )= 0
186
+ ! gfs=exp(ecm)
187
+ gfs= ecm
188
+ !
189
+ ! MN2Tsfc 0 202,1,0 ** surface Min 2 m temp since previous post [K]
190
+ ! TMIN2m 0 16,105,2 ** 2 m Min. temp. [K]
191
+ case (202 )
192
+ kpds(5 )= 16 ; kpds(6 )= 105 ;kpds(7 )= 2
193
+ !
194
+ ! MSLsfc 0 151,1,0 ** surface Mean sea-level pressure [Pa]
195
+ ! PRMSLmsl 0 2,102,0 ** Pressure reduced to MSL [Pa]
196
+ case (151 )
197
+ kpds(5 )= 2 ; kpds(6 )= 102 ;kpds(7 )= 0
198
+ !
199
+ ! MX2Tsfc 0 201,1,0 ** surface Max 2 m temp since previous post [K]
200
+ ! TMAX2m 0 15,105,2 ** 2 m Max. temp. [K]
201
+ case (201 )
202
+ kpds(5 )= 15 ; kpds(6 )= 105 ;kpds(7 )= 2
203
+ !
204
+ ! Rprs 14 157,100,0 ** Relative humidity [%]
205
+ ! RHprs 14 52,100,0 ** Relative humidity [%]
206
+ case (157 )
207
+ kpds(5 )= 52
208
+ !
209
+ ! Tprs 14 130,100,0 ** Temperature [K]
210
+ ! TMPprs 14 11,100,0 ** Temp. [K]
211
+ case (130 )
212
+ kpds(5 )= 11 ; kpds(6 )= 100
213
+ !
214
+ ! TCCsfc 0 164,1,0 ** surface Total cloud cover [(0 - 1)]
215
+ ! TCDCclm 0 71,200,0 ** atmos column Total cloud cover [%]
216
+ case (164 )
217
+ kpds(5 )= 71 ; kpds(6 )= 244 ;kpds(7 )= 0
218
+ gfs= 100 .* ecm
219
219
!
220
220
! SF 0 144,1,0 ** surface Snowfall [m of water equivalent]
221
221
! WEASD 0 65,1,0 **
@@ -227,61 +227,61 @@ PROGRAM ecm_gfs_look_alike
227
227
! SNOD 0 66,1,0 **
228
228
case (141 )
229
229
kpds(5 )= 66
230
- !
231
- ! TPsfc 0 228,1,0 ** surface Total precipitation [m]
232
- ! APCPsfc 0 61,1,0 ** surface Total precipitation [kg/m^2]
233
- case (228 )
234
- if (narg .eq. 3 ) then
235
- ! search via jpds(5,6,7) in cfpgb3 for matching record
236
- kpds5= 228 ;kpds6= 1 ;kpds7= 0
237
- kk= 0
238
- do while (iret .eq. 0 )
239
- jj=- 1 - kk
240
- jpds=- 1
241
- call getgb(21 ,0 ,ji,jj,jpds,jgds,ki,kk,kpds,kgds,lecm2,ecm2,iret)
242
- if (iret.ne. 0 ) then
243
- call errmsg(' Unable to locate precip on unit 21 :abort' )
244
- call errexit(1 )
245
- endif
246
- ! print*,'get 21,kk,kpds(2-7,14-16) = ',kk,(kpds(i),i=2,7),(kpds(i),i=14,16)
247
- if (kpds(5 ).eq. kpds5.and. kpds(6 ).eq. kpds6.and. kpds(7 ).eq. kpds7) exit
248
- enddo
230
+ !
231
+ ! TPsfc 0 228,1,0 ** surface Total precipitation [m]
232
+ ! APCPsfc 0 61,1,0 ** surface Total precipitation [kg/m^2]
233
+ case (228 )
234
+ if (narg .eq. 3 ) then
235
+ ! search via jpds(5,6,7) in cfpgb3 for matching record
236
+ kpds5= 228 ;kpds6= 1 ;kpds7= 0
237
+ kk= 0
238
+ do while (iret .eq. 0 )
239
+ jj=- 1 - kk
240
+ jpds=- 1
241
+ call getgb(21 ,0 ,ji,jj,jpds,jgds,ki,kk,kpds,kgds,lecm2,ecm2,iret)
242
+ if (iret.ne. 0 ) then
243
+ call errmsg(' Unable to locate precip on unit 21 :abort' )
244
+ call errexit(1 )
245
+ endif
246
+ ! print*,'get 21,kk,kpds(2-7,14-16) = ',kk,(kpds(i),i=2,7),(kpds(i),i=14,16)
247
+ if (kpds(5 ).eq. kpds5.and. kpds(6 ).eq. kpds6.and. kpds(7 ).eq. kpds7) exit
248
+ enddo
249
249
250
- kpds15= kpds(14 ) ! reset start time to previous accumulation end time
251
- kb2= mod (kpds(4 )/ 64 ,2 ) ! .ne.0-bitmap exits
252
- kpds4= max (kpds(4 ),kpds4)
253
- ! print*,'get 2,j,kpds(2-7,14-16) = ',j,(kpds(i),i=2,7),(kpds(i),i=14,16)
250
+ kpds15= kpds(14 ) ! reset start time to previous accumulation end time
251
+ kb2= mod (kpds(4 )/ 64 ,2 ) ! .ne.0-bitmap exits
252
+ kpds4= max (kpds(4 ),kpds4)
253
+ ! print*,'get 2,j,kpds(2-7,14-16) = ',j,(kpds(i),i=2,7),(kpds(i),i=14,16)
254
254
255
- call two_grids(' dif' ,kb1,ecm,lecm, kb2,ecm2,lecm2,ji,gfs ,lgfs)
256
- kpds(4 )= kpds4
257
- kpds(14 )= kpds14
258
- kpds(15 )= kpds15
259
- endif
260
- kpds(5 )= 61 ; kpds(6 )= 1 ;kpds(7 )= 0
261
- gfs= 1e3 * gfs
262
- !
263
- ! Uprs 14 131,100,0 ** U velocity [m s**-1]
264
- ! Uprs 14 33,100,0 ** U velocity [m s**-1]
265
- case (131 )
266
- kpds(5 )= 33
267
- !
268
- ! Vprs 14 132,100,0 ** V velocity [m s**-1]
269
- ! Vprs 14 34,100,0 ** V velocity [m s**-1]
270
- case (132 )
271
- kpds(5 )= 34
255
+ call two_grids(' dif' ,kb1,ecm,lecm, kb2,ecm2,lecm2,ji,gfs ,lgfs)
256
+ kpds(4 )= kpds4
257
+ kpds(14 )= kpds14
258
+ kpds(15 )= kpds15
259
+ endif
260
+ kpds(5 )= 61 ; kpds(6 )= 1 ;kpds(7 )= 0
261
+ gfs= 1e3 * gfs
262
+ !
263
+ ! Uprs 14 131,100,0 ** U velocity [m s**-1]
264
+ ! Uprs 14 33,100,0 ** U velocity [m s**-1]
265
+ case (131 )
266
+ kpds(5 )= 33
267
+ !
268
+ ! Vprs 14 132,100,0 ** V velocity [m s**-1]
269
+ ! Vprs 14 34,100,0 ** V velocity [m s**-1]
270
+ case (132 )
271
+ kpds(5 )= 34
272
272
273
273
case default
274
- print * ," record not recognized:kpds(5,6,7)=" ,(kpds(i),i= 5 ,7 )
275
- cycle
274
+ print * ," record not recognized:kpds(5,6,7)=" ,(kpds(i),i= 5 ,7 )
275
+ cycle
276
276
end select
277
- !- ----------------------------------------------------------------------
278
- ! set version nr of parameter table
279
- !- ----------------------------------------------------------------------
280
- kpds(19 )= 3
281
- !- ----------------------------------------------------------------------
282
- ! set default decimal scaling for the variable kpds(5)
283
- !- ----------------------------------------------------------------------
284
- kpds(22 )= ids(kpds(5 ))
277
+ !- ----------------------------------------------------------------------
278
+ ! set version nr of parameter table
279
+ !- ----------------------------------------------------------------------
280
+ kpds(19 )= 3
281
+ !- ----------------------------------------------------------------------
282
+ ! set default decimal scaling for the variable kpds(5)
283
+ !- ----------------------------------------------------------------------
284
+ kpds(22 )= ids(kpds(5 ))
285
285
286
286
! print*,'put ,k,kpds(5-7,22) = ',k,(kpds(i),i=5,7),kpds(22)
287
287
call putgb(lupgb2,ji,kpds,kgds,lgfs,gfs,iret)
0 commit comments