Scheduled Downtime
On Tuesday 24 October 2023 @ 5pm MT the forums will be in read only mode in preparation for the downtime. On Wednesday 25 October 2023 @ 5am MT, this website will be down for maintenance and expected to return online later in the morning.
Normal Operations
The forums are back online with normal operations. If you notice any issues or errors related to the forums, please reach out to help@ucar.edu

TemperatureType 5year runmean

mariuslam

Marius Lambert
New Member
Hi,

I post this here because I have been trying desperately to create a 5 year running mean of single year temperature minimums. But instead of being updated every year and remaining stable, I see that the 5 year running mean behaves weirdly when I plot it (see figure), it should remain the same throughout the year. When I print it in the model it seems fine, but not when I plot from the output file.

Ps: I would also like T_REF24 and T_HARD1 to not contain NaNs, instead have similar values to the ones written before.

I hope someone will be able to have a look at the lines below or at the link and give me a hint of why the output is weird in the history file.

Best regards,

Marius


!-------------------------------------------------------- InitHistory
if (use_fates_hardening) then !Marius
this%t_ref2m_24_patch(begp:endp) = spval
call hist_addfld1d (fname='T2m_24', units='K', &
avgflag='A', long_name='average temperature 2m (24hrs)', &
ptr_patch=this%t_ref2m_24_patch, default='active')
this%t_mean_5yr_patch(begp:endp) = spval
call hist_addfld1d (fname='T_HARD5', units='K', &
avgflag='A', long_name='5 year mean of minimum yearly 2-m temperature for hardening', &
ptr_patch=this%t_mean_5yr_patch, default='active')
this%t_min_yr_patch(begp:endp) = spval
call hist_addfld1d (fname='T_HARD1', units='K', &
avgflag='A', long_name='minimum year 2-m temperature for hardening', &
ptr_patch=this%t_min_yr_patch, default='active')
end if
!----------------------------------- InitAccBuffer
this%t_mean_5yr_patch(bounds%begp:bounds%endp) = spval
call init_accum_field (name='T_HARD5', units='K', &
desc='5 year average of yearly min 2-m temperature for hardening', accum_type='runmean', accum_period=-5, &
subgrid_type='pft', numlev=1, init_value=0.0_r8)
end if

!------------------------------------- UpdateAccVars
if (use_fates_hardening) then
! Accumulate and extract T_REF24
call update_accum_field ('T_REF24' , this%t_ref2m_patch , nstep)
call extract_accum_field ('T_REF24' , rbufslp , nstep)
do p = begp,endp
this%t_ref2m_24_patch(p) = rbufslp(p)
end do
! Start 1 year minimum temperature loop for hardening
end_yr = is_end_curr_year()
do p = begp,endp
if (rbufslp(p) /= spval) then
this%t_min_yr_inst_patch(p) = min(rbufslp(p), this%t_min_yr_inst_patch(p))
endif
if (end_yr) then
this%t_min_yr_patch(p) = this%t_min_yr_inst_patch(p)
rbufslp(p)=this%t_min_yr_inst_patch(p)
this%t_min_yr_inst_patch(p) = spval
else if (secs == dtime) then
this%t_min_yr_patch(p) = spval
endif
end do
if (end_yr) then
call update_accum_field ('T_HARD5', rbufslp, nstep)
call extract_accum_field ('T_HARD5', this%t_mean_5yr_patch, nstep)
end if
end if

1x1_Yakutsk_era_T_HARD5.png
 

oleson

Keith Oleson
CSEG and Liaisons
Staff member
Is this set correctly:

call init_accum_field (name='T_HARD5', units='K', &
desc='5 year average of yearly min 2-m temperature for hardening', accum_type='runmean', accum_period=-5, &
subgrid_type='pft', numlev=1, init_value=0.0_r8)

With accum_period=-5, this would be 5 days, not 5 years?
 

oleson

Keith Oleson
CSEG and Liaisons
Staff member
I implemented your code into a global SP simulation and it seems to be working as intended, at least for a few grid cells I checked. I've attached a plot of T_HARD5 for 6 years for a high-latitude point.
I'm a FATES novice but maybe there is something weird associated with patches changing weights or something? Your first few years look stable?
 

Attachments

  • T_HARD5.PNG
    T_HARD5.PNG
    195.6 KB · Views: 4

mariuslam

Marius Lambert
New Member
Hi Keith, Thanks a lot for having such a deep look into it. I agree that the patch averaging is likely to be the cause. Especially since I have a lot of mortality during the years where Tmean5yr starts fluctuating, then it stabilizes again. However, I think the cause of the problem is in CLM as I write the variable to the output file in the TemperatureType file straight away. Is that possible? I will try writing the variable in the output from fates as well and I expect it to be stable there
 

oleson

Keith Oleson
CSEG and Liaisons
Staff member
Our FATES expert here advises to post this as an issue on the FATES github. It is useful to have that on the FATES forum to capture the discussion for other folks, as the patch dynamics are different from static columns.
 
Top