#NEWLINE# def calc( varname , model , cid ) : #NEWLINE# #INDENT# 'Calculate drought-related variable.' #NEWLINE# if ( varname . find ( 'spi' ) == 0 ) : #NEWLINE# #INDENT# duration = int ( varname [ 3 ] ) #NEWLINE# output = calcSPI ( duration , model , cid ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( varname == 'severity' ) : #NEWLINE# #INDENT# output = calcSeverity ( model , '' , cid ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( varname == 'dryspells' ) : #NEWLINE# #INDENT# output = calcDrySpells ( model , cid ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# return output