Closed mrghg closed 3 years ago
Also, I've only put the difference_operator function in the rigby14 method, but I think you also use it in some of the other methods too...
I'm a little confused by this difference operator. Currently it's:
D = np.zeros((nx, nx))
for xi in range(nx):
if (xi % (nx/4)) < (nx/4 - freq):
D[xi, xi] = -1.
D[xi, xi + freq] = 1.
return D
But in the x matrix, the emissions are [box0,box1,box2,box3,....]. So should this operate on the xi+4*freq element, as that would be the jump to the same box in the following year? Currently, if it was for a yearly inversion, xi+freq would just go to the next box, rather than the same box in the following year. Then something like:
D = np.zeros((nx, nx))
for xi in range(nx- 4*freq):
D[xi, xi] = -1.
D[xi, xi + 4*freq] = 1.
return D
might be more appropriate?
You're right. The above commit should fix this. I've also added a test
Nice! It all looks good to me.
I've modified the difference operator so that it constrains the growth between quantities separated by one year. Previously, it was between consecutive years/months/seasons, whereas the IDL code had it so that it'd constrain each month/season to the same month/season in the following/previous year.
Any chance you could write a test for this? It particularly needs checking for the final year...