def getSelector(roi):
    sel = Selector()
    for sel_comp in roi.split(";"):
        if sel_comp.strip():
            sel_comp_items = sel_comp.split("=")
            sel_name = sel_comp_items[0].lower()
            sel_range = sel_comp_items[1]
            if sel_name.startswith("lat"):
                if sel_name.endswith("slice"):
                    sel.refine(latitudeslice(*parseSelectionRange(sel_range, slice=True)))
                else:
                    sel.refine(lat=parseSelectionRange(sel_range))
            elif sel_name.startswith("lon"):
                if sel_name.endswith("slice"):
                    sel.refine(longitudeslice(*parseSelectionRange(sel_range, slice=True)))
                else:
                    sel.refine(lon=parseSelectionRange(sel_range))
            elif sel_name.startswith("lev"):
                if sel_name.endswith("slice"):
                    sel.refine(levelslice(*parseSelectionRange(sel_range, slice=True)))
                else:
                    sel.refine(lev=parseSelectionRange(sel_range))
            elif sel_name.startswith("time"):
                if sel_name.endswith("slice"):
                    sel.refine(timeslice(*parseSelectionRange(sel_range, slice=True)))
                else:
                    sel.refine(time=parseSelectionRange(sel_range, time=True))
    return sel
Example #2
0
def refineSelector( sel, sel_name, sel_range ):
    if sel_name.startswith('lat'):
        if sel_name.endswith('slice'):  sel.refine( latitudeslice(*parseSelectionRange( sel_range, slice=True )) )
        else:                           sel.refine( lat=parseSelectionRange( sel_range ) )
    elif sel_name.startswith('lon'):
        if sel_name.endswith('slice'):  sel.refine( longitudeslice(*parseSelectionRange( sel_range, slice=True )) )
        else:                           sel.refine( lon=parseSelectionRange( sel_range ) )
    elif sel_name.startswith('lev'):
        if sel_name.endswith('slice'):  sel.refine( levelslice(*parseSelectionRange( sel_range, slice=True )) )
        else:                           sel.refine( lev=parseSelectionRange( sel_range ) )
    elif sel_name.startswith('time'):
        if sel_name.endswith('slice'):  sel.refine( timeslice(*parseSelectionRange( sel_range, slice=True )) )
        else:                           sel.refine( time=parseSelectionRange( sel_range, time=True ) )
Example #3
0
def getSelector( roi ):
    sel = Selector()
    for sel_comp in roi.split(';'):
        if sel_comp.strip():
            sel_comp_items = sel_comp.split('=')
            sel_name = sel_comp_items[0].lower()
            sel_range = sel_comp_items[1]
            if sel_name.startswith('lat'):
                if sel_name.endswith('slice'):  sel.refine( latitudeslice(*parseSelectionRange( sel_range, slice=True )) )
                else:                           sel.refine( lat=parseSelectionRange( sel_range ) )
            elif sel_name.startswith('lon'):
                if sel_name.endswith('slice'):  sel.refine( longitudeslice(*parseSelectionRange( sel_range, slice=True )) )
                else:                           sel.refine( lon=parseSelectionRange( sel_range ) )
            elif sel_name.startswith('lev'):
                if sel_name.endswith('slice'):  sel.refine( levelslice(*parseSelectionRange( sel_range, slice=True )) )
                else:                           sel.refine( lev=parseSelectionRange( sel_range ) )
            elif sel_name.startswith('time'):
                if sel_name.endswith('slice'):  sel.refine( timeslice(*parseSelectionRange( sel_range, slice=True )) )
                else:                           sel.refine( time=parseSelectionRange( sel_range, time=True ) )
    return sel
Example #4
0
def refineSelector(sel, sel_name, sel_range):
    if sel_name.startswith('lat'):
        if sel_name.endswith('slice'):
            sel.refine(
                latitudeslice(*parseSelectionRange(sel_range, slice=True)))
        else:
            sel.refine(lat=parseSelectionRange(sel_range))
    elif sel_name.startswith('lon'):
        if sel_name.endswith('slice'):
            sel.refine(
                longitudeslice(*parseSelectionRange(sel_range, slice=True)))
        else:
            sel.refine(lon=parseSelectionRange(sel_range))
    elif sel_name.startswith('lev'):
        if sel_name.endswith('slice'):
            sel.refine(levelslice(*parseSelectionRange(sel_range, slice=True)))
        else:
            sel.refine(lev=parseSelectionRange(sel_range))
    elif sel_name.startswith('time'):
        if sel_name.endswith('slice'):
            sel.refine(timeslice(*parseSelectionRange(sel_range, slice=True)))
        else:
            sel.refine(time=parseSelectionRange(sel_range, time=True))