23 subroutine search (field, mask, idim, jdim, tile, field_name)
30 character(len=*) :: field_name
32 integer,
intent(in) :: idim, jdim, tile
33 integer(esmf_kind_i4),
intent(in) :: mask(idim,jdim)
35 real(esmf_kind_r4),
intent(inout) :: field(idim,jdim)
37 integer :: i, j, krad, ii, jj
38 integer :: istart, iend
39 integer :: jstart, jend
43 real(esmf_kind_r4),
allocatable :: field_save(:,:)
49 select case (field_name)
50 case (
'substrate_temperature')
52 case (
'vegetation_greenness')
54 case (
'maximum_snow_albedo')
56 case (
'leaf_area_index')
58 case (
'visible_black_sky_albedo')
60 case (
'visible_white_sky_albedo')
62 case (
'near_IR_black_sky_albedo')
64 case (
'near_IR_white_sky_albedo')
71 default_value = float(1)
73 default_value = float(2)
74 case (
'vegetation_type')
75 default_value = float(3)
77 print*,
'- FATAL ERROR IN ROUTINE SEARCH. UNIDENTIFIED FIELD : ', field
78 call mpi_abort(mpi_comm_world, 77, ierr)
85 allocate (field_save(idim,jdim))
88 j_loop :
do j = 1, jdim
89 i_loop :
do i = 1, idim
91 if (mask(i,j) == 1 .and. field_save(i,j) < -9999.0)
then
93 krad_loop :
do krad = 1, 100
100 jj_loop :
do jj = jstart, jend
101 ii_loop :
do ii = istart, iend
107 if ((jj == jstart) .or. (jj == jend) .or. &
108 (ii == istart) .or. (ii == iend))
then
110 if (jj < 1 .or. jj > jdim) cycle jj_loop
111 if (ii < 1 .or. ii > idim) cycle ii_loop
113 if (mask(ii,jj) == 1 .and. field_save(ii,jj) > -9999.0)
then
114 field(i,j) = field_save(ii,jj)
126 field(i,j) = default_value
128 write(6,101) tile,i,j,field(i,j)
134 deallocate(field_save)
136 100
format(1x,
"- MISSING POINT TILE: ",i2,
" I/J: ",i5,i5,
" SET TO VALUE AT: ",i5,i5,
". NEW VALUE IS: ",f8.3)
137 101
format(1x,
"- MISSING POINT TILE: ",i2,
" I/J: ",i5,i5,
" SET TO DEFAULT VALUE OF: ",f8.3)
subroutine search(field, mask, idim, jdim, tile, field_name)
Replace undefined values on the model grid with a valid value at a nearby neighbor.