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)
75 default_value = float(4)
76 case (
'vegetation_type')
77 default_value = float(3)
79 print*,
'- FATAL ERROR IN ROUTINE SEARCH. UNIDENTIFIED FIELD : ', field
80 call mpi_abort(mpi_comm_world, 77, ierr)
87 allocate (field_save(idim,jdim))
90 j_loop :
do j = 1, jdim
91 i_loop :
do i = 1, idim
93 if (mask(i,j) == 1 .and. field_save(i,j) < -9999.0)
then 95 krad_loop :
do krad = 1, 100
102 jj_loop :
do jj = jstart, jend
103 ii_loop :
do ii = istart, iend
109 if ((jj == jstart) .or. (jj == jend) .or. &
110 (ii == istart) .or. (ii == iend))
then 112 if (jj < 1 .or. jj > jdim) cycle jj_loop
113 if (ii < 1 .or. ii > idim) cycle ii_loop
115 if (mask(ii,jj) == 1 .and. field_save(ii,jj) > -9999.0)
then 116 field(i,j) = field_save(ii,jj)
128 field(i,j) = default_value
130 write(6,101) tile,i,j,field(i,j)
136 deallocate(field_save)
138 100
format(1x,
"- MISSING POINT TILE: ",i2,
" I/J: ",i5,i5,
" SET TO VALUE AT: ",i5,i5,
". NEW VALUE IS: ",f8.3)
139 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.