Write a Jython function for IDV and export as IDV Formula in GUI

Define a function to calculate Moist Static Energy from Temperature, Specific Humidity and Geopotential Height.


In [1]:
def moistStaticEnergy(T,Q,GZ):
    """ Calculates Moist Static Energy with Temperature, Specific Humidity and Geopotential Height. """
    from ucar.visad.quantities import SpecificHeatCapacityOfDryAirAtConstantPressure,LatentHeatOfEvaporation
    cp=SpecificHeatCapacityOfDryAirAtConstantPressure.newReal()
    L=LatentHeatOfEvaporation.newReal()
    return cp*T+L*Q+Z



Above function was created for use in this session, it will not be available for IDV in next session so let us save it to the IDV Jython library.


In [2]:
saveJython(moistStaticEnergy)



Create a IDV formula, once created it will be in the list of formulas in IDV. The arguments to saveFormula are (formulaid,description,functionastring,formula categories). formula categories can be a list of categories or just a single category specified by a string.


In [3]:
saveFormula("Moist Static Energy","Moist Static Energy from T, Q, GZ","moistStaticEnergy(T,Q,GZ)",["Grids","Grids-MapesCollection"])



Check if the formula was created in IDV GUI . At anytime to show a IDV window from notebook use function showIdv(). Currently some displays cannot be made when using GUI from notebook, will be implemented in future.


In [4]:
showIdv()


3D [dev] 1.6.0-pre9-daily-experimental daily

libEGL warning: failed to create a pipe screen for i965