24 subroutine search_frac_cats (field, mask, idim, jdim, num_categories, tile, field_name)
 
   31 integer, 
intent(in)               :: idim, jdim, tile, num_categories
 
   32 integer(esmf_kind_i4), 
intent(in) :: mask(idim,jdim)
 
   34 real(esmf_kind_r4), 
intent(inout) :: field(idim,jdim,num_categories)
 
   36 character(len=*)                  :: field_name
 
   38 integer                           :: i, j, krad, ii, jj
 
   39 integer                           :: istart, iend
 
   40 integer                           :: jstart, jend
 
   42 integer                           :: default_category
 
   44 real(esmf_kind_r4), 
allocatable   :: field_save(:,:,:)
 
   50 select case (field_name)
 
   53   case (
'vegetation_type') 
 
   56     print*,
'- FATAL ERROR IN ROUTINE SEARCH.  UNIDENTIFIED FIELD : ', field
 
   57     call mpi_abort(mpi_comm_world, 77, ierr)
 
   64 allocate (field_save(idim,jdim,num_categories))
 
   67 j_loop : 
do j = 1, jdim
 
   68   i_loop : 
do i = 1, idim
 
   70     if (mask(i,j) == 1 .and. field_save(i,j,1) < -9999.0) 
then 
   72       krad_loop : 
do krad = 1, 100
 
   79         jj_loop : 
do jj = jstart, jend
 
   80         ii_loop : 
do ii = istart, iend
 
   86           if ((jj == jstart) .or. (jj == jend) .or.   &
 
   87               (ii == istart) .or. (ii == iend)) 
then 
   89             if (jj < 1 .or. jj > jdim) cycle jj_loop
 
   90             if (ii < 1 .or. ii > idim) cycle ii_loop
 
   92               if (mask(ii,jj) == 1 .and. maxval(field_save(ii,jj,:)) > 0.0) 
then 
   93                 field(i,j,:) = field_save(ii,jj,:)
 
   94                 write(6,100) tile,i,j,ii,jj
 
  106       field(i,j,default_category) = 1.0  
 
  108       write(6,101) tile,i,j,default_category
 
  114 deallocate(field_save)
 
  116 100 
format(1x,
"- MISSING POINT TILE: ",i2,
" I/J: ",i5,i5,
" SET TO VALUE AT: ",i5,i5)
 
  117 101 
format(1x,
"- MISSING POINT TILE: ",i2,
" I/J: ",i5,i5,
" SET TO DEFAULT VALUE OF: ",i3)
 
 
subroutine search_frac_cats(field, mask, idim, jdim, num_categories, tile, field_name)
Replace undefined values on the model grid with valid values at a nearby neighbor.