def plot(what, calc_id=-1, other_id=None, webapi=False):
    """
    Generic plotter for local and remote calculations.
    """
    if '?' not in what:
        raise SystemExit('Missing ? in %r' % what)
    prefix, rest = what.split('?', 1)
    assert prefix in 'source_geom hcurves hmaps uhs', prefix
    if prefix in 'hcurves hmaps' and 'imt=' not in rest:
        raise SystemExit('Missing imt= in %r' % what)
    elif prefix == 'uhs' and 'imt=' in rest:
        raise SystemExit('Invalid IMT in %r' % what)
    elif prefix in 'hcurves uhs' and 'site_id=' not in rest:
        what += '&site_id=0'
    if webapi:
        xs = [WebExtractor(calc_id)]
        if other_id:
            xs.append(WebExtractor(other_id))
    else:
        xs = [Extractor(calc_id)]
        if other_id:
            xs.append(Extractor(other_id))
    make_figure = globals()['make_figure_' + prefix]
    plt = make_figure(xs, what)
    plt.show()
def plot ( what , calc_id = - 1 , other_id = None , webapi = False ) : if '?' not in what : raise SystemExit ( 'Missing ? in %r' % what ) prefix , rest = what . split ( '?' , 1 ) assert prefix in 'source_geom hcurves hmaps uhs' , prefix if prefix in 'hcurves hmaps' and 'imt=' not in rest : raise SystemExit ( 'Missing imt= in %r' % what ) elif prefix == 'uhs' and 'imt=' in rest : raise SystemExit ( 'Invalid IMT in %r' % what ) elif prefix in 'hcurves uhs' and 'site_id=' not in rest : what += '&site_id=0' if webapi : xs = [ WebExtractor ( calc_id ) ] if other_id : xs . append ( WebExtractor ( other_id ) ) else : xs = [ Extractor ( calc_id ) ] if other_id : xs . append ( Extractor ( other_id ) ) make_figure = globals ( ) [ 'make_figure_' + prefix ] plt = make_figure ( xs , what ) plt . show ( )
Generic plotter for local and remote calculations.