コード例 #1
0
def run(facets_groups):
    facets_groups=sddeferredbefore.run(facets_groups)
    facets_groups=sdignorecase.run(facets_groups)
    facets_groups=sdinference.run(facets_groups)
    facets_groups=sddeferredafter.run(facets_groups)
    facets_groups=sddecode.run(facets_groups)

    # EXT_PARAM
    #
    # load extensions here
    #
    # TODO

    facets_groups=sdlocal2remote.run(facets_groups)
    facets_groups=sdvalueinputalias.run(facets_groups)
    facets_groups=sdremovefacet.run(facets_groups)
    facets_groups=sddenormodel.run(facets_groups)
    facets_groups=sdvct.run(facets_groups)

    # only vector until this point

    facets_groups=sdvectortoscalar.run(facets_groups)

    # vector and scalar from this point

    if sdconfig.config.getint('behaviour','check_parameter')==1:
        sdcheckparam.run(facets_groups)

    return facets_groups
コード例 #2
0
ファイル: sdtiaction.py プロジェクト: Prodiguer/synda
def facet(args):
    import sdparam,sdremoteparam,syndautils,sdinference,sdignorecase

    facets_groups=syndautils.get_stream(subcommand=args.subcommand,parameter=args.parameter,selection_file=args.selection_file,no_default=True)
    facets_groups=sdignorecase.run(facets_groups)
    facets_groups=sdinference.run(facets_groups)


    if sdparam.exists_parameter_name(args.facet_name): # first, we check in cache so to quickly return if facet is unknown

        if len(facets_groups)==1:
            # facet selected: retrieve parameters from ESGF

            facets_group=facets_groups[0]

            params=sdremoteparam.run(pname=args.facet_name,facets_group=facets_group,dry_run=args.dry_run)

            # TODO: func for code below
            items=params.get(args.facet_name,[])
            for item in items:
                print item.name
        elif len(facets_groups)>1:
            print_stderr('Multi-queries not supported')

        else:
            # Parameter not set. In this case, we retrieve facet values list from cache.

            sdparam.main([args.facet_name]) # tricks to re-use sdparam CLI parser

    else:
        print_stderr('Unknown facet')   
コード例 #3
0
def get_facet_values_early(orig_stream,name,extract_item=False):
    """Get facet values from a dqueries object at an early time (before any transformation of that object occured).

    Note
        Early means we want item from the dqueries just after it's creation
        (i.e. when no transformation (e.g. sdinference) occured yet).
        
    TODO
        Maybe find a proper way to do that
    """
    import sdstream, sdextractitem, sdignorecase, sdinference, copy, sddeferredbefore, sddeferredafter

    assert name!='type' # type cannot be inferred using this func (use infer_type() func instead)


    stream=copy.deepcopy(orig_stream) # this is not to modify the original stream at this point

    # note that A and B block order is important here
    # (if B is done before A, pending identifiers (e.g. dataset_functional_id)
    # will not be scanned by sdextractitem).

    # A
    stream=sddeferredbefore.run(stream)
    stream=sdignorecase.run(stream)
    stream=sdinference.run(stream) # this is to resolve pending parameter
    stream=sddeferredafter.run(stream)

    # B
    if extract_item:
        stream=sdextractitem.run(stream,name) # we extract item from identifier if present

    li=sdstream.get_facet_values(stream,name)

    return li
コード例 #4
0
ファイル: sdpipeline.py プロジェクト: nedclimaterisk/synda
def parse(parameter=None):
    """This pipeline is used as a fast parameter parser (without further
    processing).
    """

    if parameter is None:
        parameter = []

    buffer = sdbuffer.get_selection_file_buffer(parameter=parameter)
    selection = sdparse.build(buffer, load_default=False)
    facets_groups = selection.merge_facets()
    facets_groups = sdignorecase.run(facets_groups)
    facets_groups = sdinference.run(facets_groups)
    return facets_groups
コード例 #5
0
ファイル: sdpipeline.py プロジェクト: Prodiguer/synda
def parse(parameter=None):
    """This pipeline is used as a fast parameter parser (without further
    processing).
    """

    if parameter is None:
        parameter=[]

    buffer=sdbuffer.get_selection_file_buffer(parameter=parameter)
    selection=sdparse.build(buffer,load_default=False)
    facets_groups=selection.merge_facets()
    facets_groups=sdignorecase.run(facets_groups)
    facets_groups=sdinference.run(facets_groups)
    return facets_groups
コード例 #6
0
ファイル: sdtiaction.py プロジェクト: lukaszlacinski/synda
def facet(args):
    import sdparam, sdremoteparam, syndautils, sdinference, sdignorecase

    facets_groups = syndautils.get_stream(subcommand=args.subcommand,
                                          parameter=args.parameter,
                                          selection_file=args.selection_file,
                                          no_default=True)
    facets_groups = sdignorecase.run(facets_groups)
    facets_groups = sdinference.run(facets_groups)

    if sdparam.exists_parameter_name(
            args.facet_name
    ):  # first, we check in cache so to quickly return if facet is unknown

        if len(facets_groups) == 1:
            # facet selected: retrieve parameters from ESGF

            facets_group = facets_groups[0]

            params = sdremoteparam.run(pname=args.facet_name,
                                       facets_group=facets_group,
                                       dry_run=args.dry_run)

            # TODO: func for code below
            items = params.get(args.facet_name, [])
            for item in items:
                print item.name
        elif len(facets_groups) > 1:
            print_stderr('Multi-queries not supported')

        else:
            # Parameter not set. In this case, we retrieve facet values list from cache.

            sdparam.main([args.facet_name
                          ])  # tricks to re-use sdparam CLI parser

    else:
        print_stderr('Unknown facet')