Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Corrects the calculation of solar zenith angle, which was off by a timestep #4589

Merged
merged 1 commit into from
Apr 28, 2022
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion share/streams/shr_dmodel_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,7 @@ subroutine shr_dmodel_readLBUB(stream,pio_subsystem,pio_iotype,pio_iodesc_r8, pi
rDateUB = real(mDateUB,R8) + real(mSecUB,R8)/spd
call t_stopf(trim(lstr)//'_setup')

if (rDateM < rDateLB .or. rDateM > rDateUB) then
if (rDateM < rDateLB .or. rDateM >= rDateUB) then
call t_startf(trim(lstr)//'_fbound')
if (my_task == master_task) then
! call shr_stream_findBounds(stream,mDate,mSec, &
Expand Down
18 changes: 5 additions & 13 deletions share/streams/shr_tInterp_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -305,26 +305,18 @@ subroutine shr_tInterp_getAvgCosz(tavCosz,lonr,latr,ymd1,tod1,ymd2,tod2,eccen,mv
tod = tod1
do while( reday < reday2) ! mid-interval t-steps thru interval [LB,UB]

!--- get next cosz value for t-avg ---
call shr_tInterp_getCosz(cosz,lonr,latr,ymd,tod,eccen,mvelpp,lambm0,obliqr,calendar)
n = n + ldt
tavCosz = tavCosz + cosz*real(ldt,SHR_KIND_R8) ! add to partial sum

!--- advance to next time in [LB,UB] ---
ymd0 = ymd
tod0 = tod
reday0 = reday
call shr_cal_advDateInt(ldt,'seconds',ymd0,tod0,ymd,tod,calendar)
call shr_cal_timeSet(reday,ymd,tod,calendar)

if (reday > reday2) then
ymd = ymd2
tod = tod2
timeint = reday2-reday0
call ESMF_TimeIntervalGet(timeint,s_i8=dtsec)
ldt = dtsec
endif

!--- get next cosz value for t-avg ---
call shr_tInterp_getCosz(cosz,lonr,latr,ymd,tod,eccen,mvelpp,lambm0,obliqr,calendar)
n = n + ldt
tavCosz = tavCosz + cosz*real(ldt,SHR_KIND_R8) ! add to partial sum

end do
tavCosz = tavCosz/real(n,SHR_KIND_R8) ! form t-avg

Expand Down