99 type(gribfield) :: ims
100 type(gribfield) :: mask
101 type(gribfield) :: mmab
102 character(len=200) :: infile, outfile
103 integer,
parameter :: imax=4320
104 integer,
parameter :: jmax=2160
105 integer :: i,j, istat, iunit
106 integer :: ii, iii, jj, jjj, count
115 integer,
allocatable :: mask_5min(:,:), mask_ims(:,:)
117 logical*1,
allocatable :: lbms_ims(:,:)
120 real,
allocatable :: dummy(:,:)
121 real,
allocatable :: ice_ims(:,:), ice_5min(:,:), ice_blend(:,:)
128 call w3tagb(
'EMCSFC_ICE_BLEND',2014,75,0000,
'EMC')
130 call getenv(
"FORT17", infile)
132 print*,
"- OPEN 5-MINUTE LAND-SEA MASK FILE: ", trim(infile)
133 call baopenr (iunit, infile, istat)
135 print*,
'FATAL ERROR: BAD OPEN. ISTAT: ', istat
141 nullify(mask%list_opt)
142 nullify(mask%igdtmpl)
143 nullify(mask%ipdtmpl)
144 nullify(mask%coord_list)
145 nullify(mask%idrtmpl)
161 print*,
"- DEGRIB DATA" 162 call getgb2(iunit, lugi, j, jdisc, jids, jpdtn, jpdt, jgdtn, jgdt, &
163 unpack, k, mask, istat)
166 print*,
'FATAL ERROR: BAD DEGRIB OF DATA. ISTAT: ', istat
170 call baclose (iunit,istat)
182 allocate(dummy(imax,jmax))
183 dummy=reshape(mask%fld , (/imax,jmax/) )
185 if(
associated(mask%idsect))
deallocate(mask%idsect)
186 if(
associated(mask%local))
deallocate(mask%local)
187 if(
associated(mask%list_opt))
deallocate(mask%list_opt)
188 if(
associated(mask%igdtmpl))
deallocate(mask%igdtmpl)
189 if(
associated(mask%ipdtmpl))
deallocate(mask%ipdtmpl)
190 if(
associated(mask%coord_list))
deallocate(mask%coord_list)
191 if(
associated(mask%idrtmpl))
deallocate(mask%idrtmpl)
192 if(
associated(mask%bmap))
deallocate(mask%bmap)
193 if(
associated(mask%fld))
deallocate(mask%fld)
195 allocate(mask_5min(imax,jmax))
199 if (dummy(i,j) < 0.1)
then 201 elseif (dummy(i,j) > 1.94)
then 215 call getenv(
"FORT11", infile)
217 print*,
"- OPEN IMS ICE DATA: ", trim(infile)
218 call baopenr (iunit, infile, istat)
220 print*,
'FATAL ERROR: BAD OPEN. ISTAT: ', istat
226 nullify(ims%list_opt)
229 nullify(ims%coord_list)
246 print*,
"- DEGRIB DATA" 247 call getgb2(iunit, lugi, j, jdisc, jids, jpdtn, jpdt, jgdtn, jgdt, &
248 unpack, k, ims, istat)
251 print*,
'FATAL ERROR: BAD DEGRIB OF DATA. ISTAT: ', istat
255 call baclose (iunit,istat)
257 allocate (lbms_ims(imax,jmax))
258 lbms_ims=reshape(ims%bmap , (/imax,jmax/) )
259 allocate (ice_ims(imax,jmax))
260 ice_ims=reshape(ims%fld , (/imax,jmax/) )
262 print*,
"- CREATE IMS LAND-SEA MASK FROM BITMAP." 263 allocate(mask_ims(imax,jmax))
267 if (.not.lbms_ims(i,j)) mask_ims(i,j) = 2
273 if(
associated(ims%idsect))
deallocate(ims%idsect)
274 if(
associated(ims%local))
deallocate(ims%local)
275 if(
associated(ims%list_opt))
deallocate(ims%list_opt)
276 if(
associated(ims%igdtmpl))
deallocate(ims%igdtmpl)
277 if(
associated(ims%ipdtmpl))
deallocate(ims%ipdtmpl)
278 if(
associated(ims%coord_list))
deallocate(ims%coord_list)
279 if(
associated(ims%idrtmpl))
deallocate(ims%idrtmpl)
280 if(
associated(ims%bmap))
deallocate(ims%bmap)
281 if(
associated(ims%fld))
deallocate(ims%fld)
287 call getenv(
"FORT15", infile)
289 print*,
"- OPEN 5-MINUTE ICE CONCENTRATION DATA: ", trim(infile)
290 call baopenr (iunit, infile, istat)
292 print*,
'FATAL ERROR: BAD OPEN. ISTAT: ', istat
298 nullify(mmab%list_opt)
299 nullify(mmab%igdtmpl)
300 nullify(mmab%ipdtmpl)
301 nullify(mmab%coord_list)
302 nullify(mmab%idrtmpl)
318 print*,
"- DEGRIB DATA" 319 call getgb2(iunit, lugi, j, jdisc, jids, jpdtn, jpdt, jgdtn, jgdt, &
320 unpack, k, mmab, istat)
323 print*,
'FATAL ERROR: BAD DEGRIB OF DATA. ISTAT: ', istat
327 allocate (ice_5min(imax,jmax))
328 ice_5min=reshape(mmab%fld , (/imax,jmax/) )
330 call baclose (iunit,istat)
336 print*,
"- BLEND IMS AND 5-MINUTE DATA IN NH." 337 allocate(ice_blend(imax,jmax))
341 if (mask_ims(i,j) == 0)
then 342 if (mask_5min(i,j) > 0)
then 343 ice_blend(i,j)=ice_ims(i,j)
345 if (ice_ims(i,j) > .5)
then 349 if (ii == 0 .and. jj == 0) cycle
353 if (iii < 1) iii = iii + imax
354 if (iii > imax) iii = iii - imax
355 if (mask_5min(iii,jjj) == 0)
then 356 if (ice_5min(iii,jjj) >= 0.5)
then 362 if (count > 0 .and. ice_5min(i,j) == 0.0)
then 363 ice_blend(i,j) = ice_ims(i,j)
365 ice_blend(i,j) = max(ice_5min(i,j),0.15)
375 deallocate(mask_ims, ice_ims)
382 do j = (jmax/2)+1, jmax
384 if (mask_5min(i,j) == 0)
then 385 ice_blend(i,j) = ice_5min(i,j)
390 deallocate(mask_5min, ice_5min)
396 call getenv(
"FORT51", outfile)
398 print*,
"- OUTPUT BLENDED ICE DATA TO ", trim(outfile)
399 print*,
"- OPEN FILE." 400 call baopenw(iunit, outfile, istat)
402 print*,
'FATAL ERROR: BAD OPEN. ISTAT: ', istat
417 mmab%igdtmpl(12)=89958333
418 mmab%igdtmpl(13)=41667
419 mmab%igdtmpl(15)=-89958333
420 mmab%igdtmpl(16)=359958333
421 mmab%igdtmpl(17)=83333
422 mmab%igdtmpl(18)=83333
424 deallocate (mmab%idrtmpl)
427 allocate(mmab%idrtmpl(mmab%idrtlen))
431 mmab%fld=reshape(ice_blend, (/imax*jmax/) )
434 allocate (mmab%bmap(imax*jmax))
436 where (mmab%fld < -8.) mmab%bmap=.false.
438 print*,
"- GRIB DATA." 439 call putgb2(iunit, mmab, istat)
441 print*,
'FATAL ERROR: BAD WRITE. ISTAT: ', istat
445 call baclose(iunit, istat)
447 deallocate(ice_blend)
449 if(
associated(mmab%idsect))
deallocate(mmab%idsect)
450 if(
associated(mmab%local))
deallocate(mmab%local)
451 if(
associated(mmab%list_opt))
deallocate(mmab%list_opt)
452 if(
associated(mmab%igdtmpl))
deallocate(mmab%igdtmpl)
453 if(
associated(mmab%ipdtmpl))
deallocate(mmab%ipdtmpl)
454 if(
associated(mmab%coord_list))
deallocate(mmab%coord_list)
455 if(
associated(mmab%idrtmpl))
deallocate(mmab%idrtmpl)
456 if(
associated(mmab%bmap))
deallocate(mmab%bmap)
457 if(
associated(mmab%fld))
deallocate(mmab%fld)
460 print*,
'****************************' 461 print*,
'**** NORMAL TERMINATION ****' 462 print*,
'****************************' 464 call w3tage(
'EMCSFC_ICE_BLEND')
program emcsfc_ice_blend
Create a global 5-minute blended ice concentration dataset for use by GDAS/GFS.