Skip to content

Commit 74f33fb

Browse files
Added additional commentary in search_many to make if branches easier to understand.
1 parent 4afbf5e commit 74f33fb

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

sorc/chgres_cube.fd/surface.F90

+15-3
Original file line numberDiff line numberDiff line change
@@ -3401,33 +3401,45 @@ subroutine search_many(num_field,bundle_target,field_data_2d,mask, tile, &
34013401
call error_handler("IN FieldGather", rc)
34023402
if (localpet == 0) then
34033403
if (present(latitude) .and. search_nums(k).eq.SST_FIELD_NUM) then
3404+
! Sea surface temperatures; pass latitude field to search
34043405
print*, "search1"
34053406
call search(field_data_2d, mask, i_target, j_target, tile,search_nums(k),latitude=latitude)
34063407
elseif (present(terrain_land) .and. search_nums(k) .eq. TERRAIN_FIELD_NUM) then
3408+
! Terrain height; pass optional climo terrain array to search
34073409
print*, "search2"
34083410
call search(field_data_2d, mask, i_target, j_target, tile,search_nums(k),terrain_land=terrain_land)
3409-
elseif (search_nums(k) .eq. SOTYP_LAND_FIELD_NUM) then
3411+
elseif (search_nums(k) .eq. SOTYP_LAND_FIELD_NUM) then
3412+
! Soil type over land
34103413
if (fname .eq. "soil_type_target_grid") then
3414+
! Soil type over land when interpolating input data to target grid
3415+
! *with* the intention of retaining interpolated data in output
34113416
print*, "search3"
34123417
call search(field_data_2d, mask, i_target, j_target, tile,search_nums(k),soilt_climo=soilt_climo)
34133418
elseif (present(soilt_climo)) then
34143419
if (maxval(field_data_2d) > 0 .and. (trim(external_model) .ne. "GFS" .or. trim(input_type) .ne. "grib2")) then
3420+
! Soil type over land when interpolating input data to target grid
3421+
! *without* the intention of retaining data in output file
34153422
print*, "search4"
3416-
! If soil type from the input grid has any non-zero points then soil type must exist for use
34173423
call search(field_data_2d, mask, i_target, j_target, tile, search_nums(k))
3418-
else ! Otherwise, just set the data on the "target" grid to the soil climatology
3424+
else
3425+
! If no soil type field exists in input data (e.g., GFS grib2) then don't search
3426+
! but simply set data to the climo field. This may result in
3427+
! somewhat inaccurate soil moistures as no scaling will occur
34193428
print*, "search5"
34203429
field_data_2d = soilt_climo
34213430
endif !check field value
34223431
endif !sotype from target grid
34233432
else
3433+
! Any field that doesn't require any of the special treatments or
3434+
! passing of additional variables as in those above
34243435
call search(field_data_2d, mask, i_target, j_target, tile,search_nums(k))
34253436
endif !if present
34263437
endif !localpet
34273438
call ESMF_FieldScatter(temp_field, field_data_2d, rootPet=0, tile=tile,rc=rc)
34283439
if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__))&
34293440
call error_handler("IN FieldScatter", rc)
34303441
else
3442+
! Process 3d fields soil temperature, moisture, and liquid
34313443
print*, "FieldGather"
34323444
call ESMF_FieldGather(temp_field,field_data_3d,rootPet=0,tile=tile,rc=rc)
34333445
if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__))&

0 commit comments

Comments
 (0)