Skip to content

Commit 6bf4dca

Browse files
authored
Merge pull request #1636 from dmocko/fix/ldt-merra2-mem-logs
Fix LDT MERRA-2 metforcing unnecessary memory allocation and logs
2 parents 741ecd7 + ae30c77 commit 6bf4dca

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

ldt/metforcing/merra2/merra2_forcingMod.F90

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -267,19 +267,27 @@ subroutine init_merra2(findex)
267267
merra2_struc(n)%startFlag = .true.
268268
merra2_struc(n)%dayFlag = .true.
269269

270-
allocate(merra2_struc(n)%merraforc1(&
270+
if (trim(LDT_rc%runmode) == "Metforce processing" .or. &
271+
trim(LDT_rc%runmode) == "Metforce temporal downscaling" .or. &
272+
trim(LDT_rc%runmode) == "Statistical downscaling of met forcing") then
273+
allocate(merra2_struc(n)%merraforc1(&
271274
LDT_rc%met_nf(findex), 24, &
272275
LDT_rc%lnc(n)*LDT_rc%lnr(n)))
273-
allocate(merra2_struc(n)%merraforc2(&
276+
allocate(merra2_struc(n)%merraforc2(&
274277
LDT_rc%met_nf(findex), 24, &
275278
LDT_rc%lnc(n)*LDT_rc%lnr(n)))
276279

277-
merra2_struc(n)%merraforc1 = LDT_rc%udef
278-
merra2_struc(n)%merraforc2 = LDT_rc%udef
280+
merra2_struc(n)%merraforc1 = LDT_rc%udef
281+
merra2_struc(n)%merraforc2 = LDT_rc%udef
282+
endif
279283
enddo
280284

281-
write(LDT_logunit,*)"[INFO] MERRA-2 time interp option :: ",&
282-
trim(LDT_rc%met_tinterp(findex))
285+
if (trim(LDT_rc%runmode) == "Metforce processing" .or. &
286+
trim(LDT_rc%runmode) == "Metforce temporal downscaling" .or. &
287+
trim(LDT_rc%runmode) == "Statistical downscaling of met forcing") then
288+
write(LDT_logunit,*)"[INFO] MERRA-2 time interp option :: ",&
289+
trim(LDT_rc%met_tinterp(findex))
290+
endif
283291

284292
end subroutine init_merra2
285293
end module merra2_forcingMod

ldt/metforcing/merra2/readcrd_merra2.F90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ subroutine readcrd_merra2()
6767
do n=1,LDT_rc%nnest
6868
write(LDT_logunit,*) 'Using MERRA2 forcing'
6969
write(LDT_logunit,*) 'MERRA2 forcing directory: ',&
70-
merra2_struc(n)%merra2DIR
70+
trim(merra2_struc(n)%merra2DIR)
7171

7272
merra2_struc(n)%merra2time1 = 3000.0
7373
merra2_struc(n)%merra2time2 = 0.0

0 commit comments

Comments
 (0)