Skip to content

Commit

Permalink
doxygen updates for chgres_cube.fd/search_util.f90 and sfc_climo_gen.…
Browse files Browse the repository at this point in the history
…fd/interp.F90 (#302)

* Create unit-tests for testing to_upper and to_lower. This commit references issue #257

* Add unit test to_upper_lower into CMake build

* Clean up build and push for draft pull request

* Making following improvement:
- Using env parameter to assign source code
- Add auther name
- Modify comment
- Change test failing procedure
- rename directory for unit test

* turned on testing in workflows

* added test as test in cmake

* added test as test in cmake

* clean up test cmake file

* renamed test

* cleanup output

* cleanup output

* moved to new test directory

* added tests subdirectory

* Convert and add doxygen document to search_util.f90

* Modified doxygen more to have same style with #285

* Update doxygen information

* Update more doxygen on file

* Update more doxygen on file author tag

* Doxygen update for interp.F90

* Update doxygen information

Co-authored-by: Edward Hartnett <38856240+edwardhartnett@users.noreply.github.com>
Co-authored-by: Edward Hartnett <Edward.Hartnett@noaa.gov>
  • Loading branch information
3 people authored Feb 19, 2021
1 parent fd90546 commit d9ae8bd
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 36 deletions.
25 changes: 15 additions & 10 deletions sorc/chgres_cube.fd/search_util.f90
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
!> @file
!! @brief Replace undefined surface values.
!!
!! @author gayno NCEP/EMC
!! @author George Gayno NCEP/EMC
!!
!! Replace undefined values with a valid value. This can
!! happen for an isolated lake or island that is unresolved by
Expand All @@ -15,25 +15,26 @@ module search_util

contains

!> @brief Replace undefined surface values.
!!
!! Replace undefined surface values.
!! Replace undefined values on the model grid with a valid value at
!! a nearby neighbor. Undefined values are typically associated
!! with isolated islands where there is no source data.
!!
!! Routine searches a neighborhood with a radius of 100 grid points.
!! If no valid value is found, a default value is used.
!!
!! @note This routine works for one tile of a cubed sphere grid. It
!! This routine works for one tile of a cubed sphere grid. It
!! does not consider valid values at adjacent faces. That is a
!! future upgrade.
!! @param terrain_land - 2D field of terrain height points.
!! @param soilt_climo - 2D field of soil type points.

subroutine search (field, mask, idim, jdim, tile, field_num, latitude, terrain_land, soilt_climo)

use mpi
use esmf

implicit none


integer, intent(in) :: idim, jdim, tile, field_num
integer(esmf_kind_i8), intent(in) :: mask(idim,jdim)

Expand Down Expand Up @@ -168,19 +169,19 @@ subroutine search (field, mask, idim, jdim, tile, field_num, latitude, terrain_l
repl_default = repl_default + 1
endif
elseif (field_num == 7 .and. PRESENT(terrain_land)) then
! Terrain heights for isolated landice points never get a correct value, so replace
! with terrain height from the input grid interpolated to the target grid
! Terrain heights for isolated landice points never get a correct value, so replace
! with terrain height from the input grid interpolated to the target grid
field(i,j) = terrain_land(i,j)
repl_default = repl_default + 1
elseif (field_num == 224 .and. PRESENT(soilt_climo)) then
! When using input soil type fields instead of climatological data on the
! When using input soil type fields instead of climatological data on the
! target grid, isolated land locations that exist in the target grid but
! not the input grid don't receiving proper soil type information, so replace
! with climatological values
field(i,j) = soilt_climo(i,j)
repl_default = repl_default + 1
else
field(i,j) = default_value ! Search failed. Use default value.
field(i,j) = default_value !< Search failed. Use default value.
repl_default = repl_default + 1
endif

Expand All @@ -198,6 +199,10 @@ subroutine search (field, mask, idim, jdim, tile, field_num, latitude, terrain_l

end subroutine search

!> set sst values based on latitude
!! @author George Gayno NCEP/EMC
!! @param latitude - latitude input
!! @param sst - sst guess value to be set
subroutine sst_guess(latitude, sst)

use esmf
Expand Down
39 changes: 13 additions & 26 deletions sorc/sfc_climo_gen.fd/interp.F90
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
!> @file
!! @author gayno @date 2018
!! @brief Read the input source data and interpolate it to the
!! model grid.
!!
!! Read the input source data and interpolate it to the
!! model grid.
!! @author gayno @date 2018
!!
!! @param[in] input_flle filename of input source data.
!! @param[in] localpet this mpi task
Expand Down Expand Up @@ -259,30 +259,17 @@ subroutine interp(localpet, method, input_file)

end subroutine interp

subroutine adjust_for_landice(field, vegt, idim, jdim, field_ch)
!> Ensure consistent fields at land ice points
!! Land ice is vegetation type 15 (variable landice).
!! @author George Gayno NCEP/EMC
!! Usage: call adjust_for_landice(field, vegt, idim, jdim, field_ch)
!! output is Model field
!! @param field - Model field before adjustments for land ice.
!! @param field_ch - Field name.
!! @param i/jdim - i/j dimension of model tile.
!! @param vegt - Vegetation type on the model tile.

!-----------------------------------------------------------------------
! subroutine documentation block
!
! Subroutine: adjust for landice
! prgmmr: gayno org: w/np2 date: 2018
!
! Abstract: Ensure consistent fields at land ice points.
! Land ice is vegetation type 15 (variable landice).
!
! Usage: call adjust_for_landice(field, vegt, idim, jdim, field_ch)
!
! input argument list:
! field Model field before adjustments for
! land ice.
! field_ch Field name
! i/jdim i/j dimension of model tile.
! vegt Vegetation type on the model tile
!
! output argument list:
! field Model field after adjustments for
! land ice.
!-----------------------------------------------------------------------
subroutine adjust_for_landice(field, vegt, idim, jdim, field_ch)

use esmf
use mpi
Expand Down

0 comments on commit d9ae8bd

Please sign in to comment.