Skip to content

Commit

Permalink
In routine read_grid_file, initialize each array after allocation.
Browse files Browse the repository at this point in the history
  • Loading branch information
GeorgeGayno-NOAA committed Aug 6, 2021
1 parent dbe2ba5 commit ccc6692
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions sorc/grid_tools.fd/filter_topo.fd/filter_topo.F90
Original file line number Diff line number Diff line change
Expand Up @@ -705,8 +705,10 @@ subroutine read_grid_file(regional)
jsd=js-ng; jed=je+ng

allocate(tmpvar(ni+1,nj+1))
allocate(geolon_c(isd:ied+1,jsd:jed+1,6))
allocate(geolat_c(isd:ied+1,jsd:jed+1,6))
allocate(geolon_c(isd:ied+1,jsd:jed+1,ntiles))
allocate(geolat_c(isd:ied+1,jsd:jed+1,ntiles))
geolon_c(:,:,:) = 0.
geolat_c(:,:,:) = 0.
else if ( t == 7 ) then ! nested grid
if(mod(ni,2) .NE. 0 .or. mod(nj,2) .NE. 0) &
call handle_err(-1, "read_grid_file: ni and nj must be even")
Expand Down Expand Up @@ -798,6 +800,8 @@ subroutine read_grid_file(regional)
!--- compute dx, dy
allocate(dx(isd:ied,jsd:jed+1,ntiles))
allocate(dy(isd:ied+1,jsd:jed,ntiles))
dx(:,:,:) = -1.e25
dy(:,:,:) = -1.e25
do t = 1, ntiles
do j = js, je+1 ; do i = is, ie
g1(1) = geolon_c(i ,j,t)
Expand Down Expand Up @@ -846,6 +850,8 @@ subroutine read_grid_file(regional)
!--- compute dxa and dya -----
allocate(dxa(isd:ied,jsd:jed,ntiles))
allocate(dya(isd:ied,jsd:jed,ntiles))
dxa(:,:,:) = -1.e25
dya(:,:,:) = -1.e25
do t = 1, ntiles
do j=js,je ; do i=is,ie
g1(1) = geolon_c(i,j,t); g1(2) = geolat_c(i,j,t)
Expand Down Expand Up @@ -875,6 +881,8 @@ subroutine read_grid_file(regional)
!--- compute dxc and dyc
allocate(dxc(isd:ied+1,jsd:jed,ntiles))
allocate(dyc(isd:ied,jsd:jed+1,ntiles))
dxc(:,:,:) = -1.e25
dyc(:,:,:) = -1.e25
do t = 1, ntiles
do j=jsd,jed
do i=isd+1,ied
Expand All @@ -901,6 +909,7 @@ subroutine read_grid_file(regional)

!--- compute area
allocate(area(isd:ied,jsd:jed,ntiles))
area(:,:,:) = 0.
do t = 1, ntiles
do j=js,je
do i=is,ie
Expand All @@ -925,6 +934,7 @@ subroutine read_grid_file(regional)
allocate(sin_sg(4,isd:ied,jsd:jed,ntiles))
allocate(cos_sg(4,isd:ied,jsd:jed))
allocate(grid3(3, npx, npy))
grid3(:,:,:) = -1.e25
cos_sg(:,:,:) = big_number
sin_sg(:,:,:,:) = tiny_number

Expand Down

0 comments on commit ccc6692

Please sign in to comment.