OMS-NetZero / FAIR

Finite-amplitude Impulse Response simple climate model
https://docs.fairmodel.net
Apache License 2.0
123 stars 62 forks source link

Constraining example #25

Closed rgieseke closed 6 years ago

rgieseke commented 6 years ago

Hi, I tried to run the constraining example in the notebook, there are missing parents (for Py3) for the print statements, but I also don't get a reduction of the ensemble.

I haven't checked how the constraining function actually works, but if I plot the ensemble plus the observed data normalized to 1850 - 1900 I get a pretty good match.

normalized-1850-1900

rgieseke commented 6 years ago

Code I used for plotting:

df = pd.DataFrame(T, index=rcp85.Emissions.year)
df.index = df.index.astype(int)

df = df - df.loc[1850:1900].mean()

cw = pd.DataFrame(CW[:, 1], index=CW[:, 0])
cw.index = cw.index.astype(int)

cw = cw - cw.loc[1850:1900].mean()

ax = df.plot(legend=None, color="gray")
cw.plot(ax=ax, linewidth=3, color="orange", label=None)
plt.xlim(1850, 2040)
plt.savefig("normalized-1850-1900.png")
chrisroadmap commented 6 years ago

Ah, yes, I think I know why. I recently changed the constraining function so that it now outputs a 5-tuple of (pass/fail, A, B, C, D) where A and C are the slope and B and D are intercepts of the model and observations.

If you call constrain.hist_temp as:

accept, _, _, _, _ = hist_temp(Tobs, Tmodel, years)

on an ensemble you should get some outputs which are filtered out. I think the notebook needs an update to reflect this new treatment. I'm working on the docs...

rgieseke commented 6 years ago

Yes, that was the problem ... thanks for the quick reply!