From 3dc1b885614826cfb1ccc8aebb5e7c1ed4c6dc80 Mon Sep 17 00:00:00 2001 From: Soren Rasmussen Date: Thu, 21 Dec 2023 16:22:27 -0700 Subject: [PATCH] After discussion allocatable was more appropriate than optional. Also added check for variables being allocated --- src/Land_models/NoahMP/IO_code/module_hrldas_netcdf_io.F | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Land_models/NoahMP/IO_code/module_hrldas_netcdf_io.F b/src/Land_models/NoahMP/IO_code/module_hrldas_netcdf_io.F index 2c13af22f..0bcf2f18b 100644 --- a/src/Land_models/NoahMP/IO_code/module_hrldas_netcdf_io.F +++ b/src/Land_models/NoahMP/IO_code/module_hrldas_netcdf_io.F @@ -586,8 +586,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 @@ -679,6 +679,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 @@ -687,6 +689,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