HenryDane / climlab

Python package for process-oriented climate modeling
MIT License
1 stars 0 forks source link

Goofy behavior with Q in EC #14

Open HenryDane opened 1 year ago

HenryDane commented 1 year ago

Running this snippet:

state = climlab.column_state(num_lev=10)
model = climlab.TimeDependentProcess(state=state)
model.add_subprocess('RRTMG', climlab.radiation.RRTMG(state=state))
model.add_subprocess('EC', climlab.convection.EmanuelConvection(state=state))
# the fact that DailyInsolation and AnnualMeanInsolation will not work here is wierd and should be fixed
model.add_subprocess('Sun', climlab.radiation.insolation.FixedInsolation(state=state, 
                                                                         domains=state.Ts.domain))

model.compute_diagnostics()
model.relative_humidity

causes:

File ~/Documents/_Feldl/climlab/climlab/convection/emanuel_convection.py:208, in EmanuelConvection._compute(self)
    206 P = _climlab_to_convect(dom.lev.points)
    207 PH = _climlab_to_convect(dom.lev.bounds)
--> 208 Q = _climlab_to_convect(self.state['q'])
    209 QS = qsat(T,P)
    210 ND = np.size(T, axis=1)

KeyError: 'q'

which looks like a bug.