Closed jrising closed 7 years ago
Do you want to sanity check this change? It's meant to calculate the precipitation for use in yields as the sum of the past 12 months of precipitation, producing that value as a rolling sum for each month.
Hi James, Sorry for my late reply. I just tried to run simulation on that branch for the standard configuration file (10 years at 2 stepsperyear). I am getting NaNs and negative precipitation. But I think this is only because the second cumulative sum is not performed on the second dimension :
rollingsum = cumsum(precip, 2) - cumsum([zeros(numcounties, stepsperyear) precip[:, 1:size(precip)[2] - stepsperyear]],2)
Oh, I feel dumb for missing that! Thanks!
The total production to use should then be the maximum over any year of whatever periods are in that year. Since the market is also saturated on a monthly timestep, this allows the whole agriculture and market system to work as almost-expected. We still should have agriculture just run on a different timestep, so it doesn't report producing yield every month, but that can wait for the
agtimefix
branch to be ready.