Skip to content

Commit

Permalink
addressing review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
abishekg7 committed Nov 5, 2024
1 parent d0df0eb commit 25ecf82
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions src/core_init_atmosphere/mpas_init_atm_gwd.F
Original file line number Diff line number Diff line change
Expand Up @@ -260,16 +260,16 @@ function compute_gwd_fields(domain) result(iErr)
! Cut out a rectangular piece of the global 30-arc-second topography
! data that is centered at the lat/lon (in radians) of the current cell being
! processed and that is just large enough to cover the cell. The
! rectangular array of topography data is stored in the module
! rectangular array of topography data is stored in the local
! variable 'box', and the dimensions of this array are obtained from
! the routine get_box_size_from_lat_lon() and stored in the
! the routine get_box_size_from_lat() and stored in the
! local variables 'nx' and 'ny'. The get_box() routine also
! computes the mean elevation in the array and stores that value in
! the module variable 'box_mean'. 'tilesHead' points to the head of the linked
! the local variable 'box_mean'. 'tilesHead' points to the head of the linked
! list of tiles, which is used by get_box() and its internal subroutines to search
! for tile data and add new tiles to the head of this list as necessary.
!
call get_box_size_from_lat_lon(latCell(iCell)*rad2deg, lonCell(iCell)*rad2deg, dc, nx, ny)
call get_box_size_from_lat(latCell(iCell), dc, nx, ny)

call get_box(latCell(iCell)*rad2deg,lonCell(iCell)*rad2deg, nx, ny, &
geog_data_path, geog_sub_path, tilesHead, box, box_landuse, dxm, box_mean)
Expand Down Expand Up @@ -338,24 +338,23 @@ end function compute_gwd_fields
!> \date 05 Sep 2024
!> \details
!> Routine to obtain box size (nx, ny) given the mean diameter of the grid cell (meters),
! and the latitude and longitude coordinates (radians)
! and the latitude (radians)
!
!-----------------------------------------------------------------------
subroutine get_box_size_from_lat_lon(lat, lon, dx, nx, ny)
subroutine get_box_size_from_lat(lat, dx, nx, ny)

implicit none

real (kind=RKIND), intent(in) :: lat
real (kind=RKIND), intent(in) :: lon
real (kind=RKIND), intent(in) :: dx
integer, intent(out) :: nx
integer, intent(out) :: ny

!
! Get number of points to extract in the zonal direction
!
if (cos(lat/rad2deg) > (2.0 * pts_per_degree * dx * 180.0) / (real(topo_x,RKIND) * Pi * Re)) then
nx = ceiling((180.0 * dx * pts_per_degree) / (Pi * Re * cos(lat/rad2deg)))
if (cos(lat) > (2.0 * pts_per_degree * dx * 180.0) / (real(topo_x,RKIND) * Pi * Re)) then
nx = ceiling((180.0 * dx * pts_per_degree) / (Pi * Re * cos(lat)))
else
nx = topo_x / 2
end if
Expand All @@ -365,8 +364,7 @@ subroutine get_box_size_from_lat_lon(lat, lon, dx, nx, ny)
!
ny = ceiling((180.0 * dx * pts_per_degree) / (Pi * Re))

end subroutine get_box_size_from_lat_lon

end subroutine get_box_size_from_lat


!***********************************************************************
Expand Down Expand Up @@ -427,7 +425,6 @@ function get_tile_from_box_point(tilesHead, box_x, box_y, path, sub_path) result
end function get_tile_from_box_point



!***********************************************************************
!
! function add_tile
Expand Down Expand Up @@ -511,6 +508,7 @@ function free_tile_list(tilesHead) result(iErr)

end function free_tile_list


!***********************************************************************
!
! function read_30s_topo_tile
Expand Down Expand Up @@ -580,6 +578,7 @@ function read_30s_topo_tile(path, sub_path, topo, tile_start_x, tile_start_y) re

end function read_30s_topo_tile


!***********************************************************************
!
! function read_30s_landuse_tile
Expand All @@ -592,12 +591,11 @@ end function read_30s_topo_tile
!> from the subdirectory 'landuse_30s' of the path provided as an argument.
!
!-----------------------------------------------------------------------
function read_30s_landuse_tile(path, sub_path, landuse, tile_start_x, tile_start_y) result(iErr)
function read_30s_landuse_tile(path, landuse, tile_start_x, tile_start_y) result(iErr)

implicit none

character(len=*), intent(in) :: path
character(len=*), intent(in) :: sub_path
integer (kind=I1KIND), dimension(:,:), pointer, intent(inout) :: landuse
integer, intent(in) :: tile_start_x
integer, intent(in) :: tile_start_y
Expand Down

0 comments on commit 25ecf82

Please sign in to comment.