Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions build/source/engine/read_param.f90
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ subroutine read_param(nHRU,typeStruct,mparStruct,bparStruct,err,message)
! get the parameter name
err=nf90_inquire_variable(ncid, ivarid, name=parName)
call netcdf_err(err,message); if (err/=0) then; err=20; return; end if
if (trim(parName)=='depth') cycle

! **********************************************************************************************
! * read the HRU index
Expand Down Expand Up @@ -181,13 +182,18 @@ subroutine read_param(nHRU,typeStruct,mparStruct,bparStruct,err,message)
message=trim(message)//'expect 2nd dimension of 2-d variable to be depth (dimension name = '//trim(dimName)//')'
err=20; return
endif

! check that the dimension length is correct
if(size(mparStruct%gru(iGRU)%hru(localHRU)%var(ixParam)%dat) /= nSoil_file)then
message=trim(message)//'unexpected number of soil layers in parameter file'
err=20; return
endif

do iHRU=1,nHRU
! map to the GRUs and HRUs
iGRU=index_map(iHRU)%gru_ix
localHRU=index_map(iHRU)%localHRU
if(size(mparStruct%gru(iGRU)%hru(localHRU)%var(ixParam)%dat) /= nSoil_file)then
message=trim(message)//'unexpected number of soil layers in parameter file'
err=20; return
endif
end do

! define parameter length
parLength = nSoil_file

Expand Down Expand Up @@ -267,7 +273,6 @@ subroutine read_param(nHRU,typeStruct,mparStruct,bparStruct,err,message)

end do ! (looping through the parameters in the NetCDF file)

print*, 'mparStruct%gru(1)%hru(1)%var(iLookPARAM%theta_sat)%dat(:) = ', mparStruct%gru(1)%hru(1)%var(iLookPARAM%theta_sat)%dat(:)

end subroutine read_param

Expand Down