def cmd():
    """Implementation of field subcommand.

    Other Parameters:
        conf.field
        conf.core
    """
    sdat = StagyyData(conf.core.path)
    sovs = set_of_vars(conf.field.plot)
    minmax = {}
    if conf.plot.cminmax:
        conf.plot.vmin = None
        conf.plot.vmax = None
        for step in sdat.walk.filter(snap=True):
            for var, _ in sovs:
                if var in step.fields:
                    if var in phyvars.FIELD:
                        dim = phyvars.FIELD[var].dim
                    else:
                        dim = phyvars.FIELD_EXTRA[var].dim
                    field, _ = sdat.scale(step.fields[var], dim)
                    if var in minmax:
                        minmax[var] = (min(minmax[var][0], np.nanmin(field)),
                                       max(minmax[var][1], np.nanmax(field)))
                    else:
                        minmax[var] = np.nanmin(field), np.nanmax(field)
    for step in sdat.walk.filter(snap=True):
        for var in sovs:
            if var[0] not in step.fields:
                print("'{}' field on snap {} not found".format(var[0],
                                                               step.isnap))
                continue
            opts = {}
            if var[0] in minmax:
                opts = dict(vmin=minmax[var[0]][0], vmax=minmax[var[0]][1])
            fig, axis, _, _ = plot_scalar(step, var[0], **opts)
            if valid_field_var(var[1]):
                plot_iso(axis, step, var[1])
            elif var[1]:
                plot_vec(axis, step, var[1])
            oname = '{}_{}'.format(*var) if var[1] else var[0]
            misc.saveplot(fig, oname, step.isnap)
def cmd ( ) : sdat = StagyyData ( conf . core . path ) sovs = set_of_vars ( conf . field . plot ) minmax = { } if conf . plot . cminmax : conf . plot . vmin = None conf . plot . vmax = None for step in sdat . walk . filter ( snap = True ) : for var , _ in sovs : if var in step . fields : if var in phyvars . FIELD : dim = phyvars . FIELD [ var ] . dim else : dim = phyvars . FIELD_EXTRA [ var ] . dim field , _ = sdat . scale ( step . fields [ var ] , dim ) if var in minmax : minmax [ var ] = ( min ( minmax [ var ] [ 0 ] , np . nanmin ( field ) ) , max ( minmax [ var ] [ 1 ] , np . nanmax ( field ) ) ) else : minmax [ var ] = np . nanmin ( field ) , np . nanmax ( field ) for step in sdat . walk . filter ( snap = True ) : for var in sovs : if var [ 0 ] not in step . fields : print ( "'{}' field on snap {} not found" . format ( var [ 0 ] , step . isnap ) ) continue opts = { } if var [ 0 ] in minmax : opts = dict ( vmin = minmax [ var [ 0 ] ] [ 0 ] , vmax = minmax [ var [ 0 ] ] [ 1 ] ) fig , axis , _ , _ = plot_scalar ( step , var [ 0 ] , ** opts ) if valid_field_var ( var [ 1 ] ) : plot_iso ( axis , step , var [ 1 ] ) elif var [ 1 ] : plot_vec ( axis , step , var [ 1 ] ) oname = '{}_{}' . format ( * var ) if var [ 1 ] else var [ 0 ] misc . saveplot ( fig , oname , step . isnap )
Implementation of field subcommand.

    Other Parameters:
        conf.field
        conf.core