46 subroutine search (field, mask, idim, jdim, tile, field_num, latitude, terrain_land, soilt_climo)
54 integer,
intent(in) :: idim, jdim, tile, field_num
55 integer(esmf_kind_i8),
intent(in) :: mask(idim,jdim)
57 real(esmf_kind_r8),
intent(in),
optional :: latitude(idim,jdim)
58 real(esmf_kind_r8),
intent(in),
optional :: terrain_land(idim,jdim)
59 real(esmf_kind_r8),
intent(in),
optional :: soilt_climo(idim,jdim)
61 real(esmf_kind_r8),
intent(inout) :: field(idim,jdim)
63 integer :: i, j, krad, ii, jj
64 integer :: istart, iend
65 integer :: jstart, jend
69 real(esmf_kind_r8) :: field_save(idim,jdim)
70 integer :: repl_nearby, repl_default
76 select case (field_num)
83 default_value = -99999.9
85 default_value = -999.0
107 default_value = -99999.9
109 default_value = -99999.9
121 print*,
'- FATAL ERROR. UNIDENTIFIED FIELD NUMBER : ', field_num
122 call mpi_abort(mpi_comm_world, 77, ierr)
136 j_loop :
do j = 1, jdim
137 i_loop :
do i = 1, idim
139 if (mask(i,j) == 1 .and. field_save(i,j) < -9999.0)
then
141 krad_loop :
do krad = 1, 100
148 jj_loop :
do jj = jstart, jend
149 ii_loop :
do ii = istart, iend
155 if ((jj == jstart) .or. (jj == jend) .or. &
156 (ii == istart) .or. (ii == iend))
then
158 if (jj < 1 .or. jj > jdim) cycle jj_loop
159 if (ii < 1 .or. ii > idim) cycle ii_loop
161 if (mask(ii,jj) == 1 .and. field_save(ii,jj) > -9999.0)
then
162 field(i,j) = field_save(ii,jj)
166 repl_nearby = repl_nearby + 1
177 if (field_num == 11)
then
178 call
sst_guess(latitude(i,j), field(i,j))
179 elseif (field_num == 91)
then
180 if (abs(latitude(i,j)) > 55.0)
then
181 field(i,j) = default_value
182 repl_default = repl_default + 1
185 repl_default = repl_default + 1
187 elseif (field_num == 7 .and. present(terrain_land))
then
190 field(i,j) = terrain_land(i,j)
191 repl_default = repl_default + 1
192 elseif (field_num == 224 .and. present(soilt_climo))
then
197 field(i,j) = soilt_climo(i,j)
198 repl_default = repl_default + 1
200 field(i,j) = default_value
201 repl_default = repl_default + 1
213 print*,
"- TOTAL POINTS FOR VAR ", field_num,
" REPLACED BY NEARBY VALUES: ", repl_nearby
214 print*,
"- TOTAL POINTS FOR VAR ", field_num,
" REPLACED BY DEFAULT VALUE: ", repl_default
238 real(esmf_kind_r8),
parameter :: sst_polar_in_kelvin = 273.16
240 real(esmf_kind_r8),
parameter :: sst_tropical_in_kelvin = 300.0
242 real(esmf_kind_r8),
parameter :: polar_latitude = 60.0
244 real(esmf_kind_r8),
parameter :: tropical_latitude = 30.0
246 real(esmf_kind_r8),
parameter :: dsst_dlat = -0.8947
248 real(esmf_kind_r8),
parameter :: sst_y_intercept = 326.84
251 real(esmf_kind_r8),
intent(in) :: latitude
253 real(esmf_kind_r8),
intent(out) :: sst
255 if (abs(latitude) >= polar_latitude)
then
256 sst = sst_polar_in_kelvin
257 elseif (abs(latitude) <= tropical_latitude)
then
258 sst = sst_tropical_in_kelvin
260 sst = dsst_dlat * abs(latitude) + sst_y_intercept
subroutine sst_guess(latitude, sst)
Set default Sea Surface Temperature (SST) based on latitude.
Replace undefined values with a valid value.
subroutine, public search(field, mask, idim, jdim, tile, field_num, latitude, terrain_land, soilt_climo)
Replace undefined surface values.