Skip to content

Commit

Permalink
After discussion allocatable was more appropriate than optional. Also…
Browse files Browse the repository at this point in the history
… added check for variables being allocated
  • Loading branch information
scrasmussen committed May 23, 2024
1 parent 2a41901 commit bbc22d9
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/Land_models/NoahMP/IO_code/module_hrldas_netcdf_io.F
Original file line number Diff line number Diff line change
Expand Up @@ -606,8 +606,8 @@ subroutine readland_hrldas(wrfinput_flnm, &
real, dimension(xstart:xend,ystart:yend), intent(out) :: seaice
real, dimension(xstart:xend,ystart:yend), intent(out) :: msftx
real, dimension(xstart:xend,ystart:yend), intent(out) :: msfty
real, dimension(xstart:xend,ystart:yend), intent(inout), optional :: glact
real, dimension(xstart:xend,ystart:yend), intent(inout), optional :: vis_icealb
real, dimension(:,:), intent(inout), allocatable :: glact
real, dimension(:,:), intent(inout), allocatable :: vis_icealb

character(len=256) :: units
integer :: ierr
Expand Down Expand Up @@ -699,6 +699,8 @@ subroutine readland_hrldas(wrfinput_flnm, &
stop "FATAL ERROR: In module_hrldas_netcdf_io.F readland_hrldas()"// &
" - crocus_opt on but netcdf read of glacinfo returned non-zero"
end if
if (allocated(glact) .eqv. .false.) error stop "FATAL ERROR: glact not initialized but crocus is on"
! Get Glacier thickness (glact)
call get_2d_netcdf("glacier_thickness", ncid, glact, units, xstart, xend, ystart, yend, NOT_FATAL, ierr)
if (ierr /= 0) then
Expand All @@ -707,6 +709,7 @@ subroutine readland_hrldas(wrfinput_flnm, &
". Setting glacier thickness to 0.0"
end if
if (allocated(vis_icealb) .eqv. .false.) error stop "FATAL ERROR: vis_icealb not initialized but crocus is on"
! Get visible ice albedo map (vis_icealb)
call get_2d_netcdf("min_vis", ncid, vis_icealb, units, xstart, xend, ystart, yend, NOT_FATAL, ierr)
if (ierr /= 0) then
Expand Down

0 comments on commit bbc22d9

Please sign in to comment.