If I define an expression in a variable definition, VariableWriter does not import it automatically and it has to be added manually as supplementary_imports. In https://github.com/environmentalscience/essm/blob/master/docs/examples/api_features.ipynb, In[14], the following definition was made:
class Delta_Pwa(Variable):
"""Slope of saturated vapour pressure, $\partial P_{wa} / \partial T_g$"""
expr = Derivative(P_wa,T_g)
latex_name = r'\Delta'
However, Derivative is not imported when executing:
writer_var = VariableWriter(docstring='Test of VariableWriter.')
writer_var.var(Delta_Pwa)
This is because extract_functions() in https://github.com/environmentalscience/essm/blob/master/essm/_generator.py is only used in EquationWriter but not in VariableWriter.
If I define an expression in a variable definition,
VariableWriterdoes not import it automatically and it has to be added manually assupplementary_imports. In https://github.com/environmentalscience/essm/blob/master/docs/examples/api_features.ipynb, In[14], the following definition was made:However,
Derivativeis not imported when executing:This is because
extract_functions()in https://github.com/environmentalscience/essm/blob/master/essm/_generator.py is only used inEquationWriterbut not inVariableWriter.