Skip to content

Commit

Permalink
Merge pull request #1636 from dmocko/fix/ldt-merra2-mem-logs
Browse files Browse the repository at this point in the history
Fix LDT MERRA-2 metforcing unnecessary memory allocation and logs
  • Loading branch information
jvgeiger authored Nov 5, 2024
2 parents 741ecd7 + ae30c77 commit 6bf4dca
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
20 changes: 14 additions & 6 deletions ldt/metforcing/merra2/merra2_forcingMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -267,19 +267,27 @@ subroutine init_merra2(findex)
merra2_struc(n)%startFlag = .true.
merra2_struc(n)%dayFlag = .true.

allocate(merra2_struc(n)%merraforc1(&
if (trim(LDT_rc%runmode) == "Metforce processing" .or. &
trim(LDT_rc%runmode) == "Metforce temporal downscaling" .or. &
trim(LDT_rc%runmode) == "Statistical downscaling of met forcing") then
allocate(merra2_struc(n)%merraforc1(&
LDT_rc%met_nf(findex), 24, &
LDT_rc%lnc(n)*LDT_rc%lnr(n)))
allocate(merra2_struc(n)%merraforc2(&
allocate(merra2_struc(n)%merraforc2(&
LDT_rc%met_nf(findex), 24, &
LDT_rc%lnc(n)*LDT_rc%lnr(n)))

merra2_struc(n)%merraforc1 = LDT_rc%udef
merra2_struc(n)%merraforc2 = LDT_rc%udef
merra2_struc(n)%merraforc1 = LDT_rc%udef
merra2_struc(n)%merraforc2 = LDT_rc%udef
endif
enddo

write(LDT_logunit,*)"[INFO] MERRA-2 time interp option :: ",&
trim(LDT_rc%met_tinterp(findex))
if (trim(LDT_rc%runmode) == "Metforce processing" .or. &
trim(LDT_rc%runmode) == "Metforce temporal downscaling" .or. &
trim(LDT_rc%runmode) == "Statistical downscaling of met forcing") then
write(LDT_logunit,*)"[INFO] MERRA-2 time interp option :: ",&
trim(LDT_rc%met_tinterp(findex))
endif

end subroutine init_merra2
end module merra2_forcingMod
Expand Down
2 changes: 1 addition & 1 deletion ldt/metforcing/merra2/readcrd_merra2.F90
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ subroutine readcrd_merra2()
do n=1,LDT_rc%nnest
write(LDT_logunit,*) 'Using MERRA2 forcing'
write(LDT_logunit,*) 'MERRA2 forcing directory: ',&
merra2_struc(n)%merra2DIR
trim(merra2_struc(n)%merra2DIR)

merra2_struc(n)%merra2time1 = 3000.0
merra2_struc(n)%merra2time2 = 0.0
Expand Down

0 comments on commit 6bf4dca

Please sign in to comment.