コード例 #1
0
def _base(var, printname):
    if printname:
        yield var.id
        yield '\n'

    data = numpy.asarray(var.data).flat
    if var.shape:
        for indexes, value in itertools.izip(numpy.ndindex(var.shape), data):
            index = '[%s]' % ']['.join(str(idx) for idx in indexes)
            yield '%s %s\n' % (index, encode_atom(value))
    else:
        yield encode_atom(var.data)
コード例 #2
0
ファイル: ascii.py プロジェクト: openearth-attic/pydap
def _base(var, printname):
    if printname:
        yield var.id
        yield '\n'

    data = numpy.asarray(var.data).flat
    if var.shape:
        for indexes, value in itertools.izip(numpy.ndindex(var.shape), data):
            index = '[%s]' % ']['.join(str(idx) for idx in indexes)
            yield '%s %s\n' % (index, encode_atom(value))
    else:
        yield encode_atom(var.data)
コード例 #3
0
ファイル: client.py プロジェクト: openearth-attic/pydap
 def __call__(self, *args):
     params = []
     for arg in args:
         if isinstance(arg, (DapType, ServerFunctionResult)):
             params.append(arg.id)
         else:
             params.append(encode_atom(arg))
     id_ = self.name + '(' + ','.join(params) + ')'
     return ServerFunctionResult(self.baseurl, id_)
コード例 #4
0
def _recursive_build(attr, values, level=0):
    """
    Recursive function to build the DAS.
    
    """
    # Check for metadata.
    if isinstance(values, dict):
        yield '%s%s {\n' % ((level+1) * INDENT, attr)
        for k, v in values.items():
            for line in _recursive_build(k, v, level+1):
                yield line
        yield '%s}\n' % ((level+1) * INDENT)
    else:
        type_ = get_type(values).descriptor
        if not isiterable(values):
            values = [values]

        # Encode values
        values = [encode_atom(atom) for atom in values]
        yield '%s%s %s %s;\n' % ((level+1) * INDENT, type_,
                attr.replace(' ', '_'), ', '.join(values))
コード例 #5
0
ファイル: proxy.py プロジェクト: msaunby/weather
    def __lt__(self, other): return ConstraintExpression('%s<%s' % (self.id, encode_atom(other)))


def reorder(order, data, level):
コード例 #6
0
ファイル: proxy.py プロジェクト: msaunby/weather
 def __gt__(self, other): return ConstraintExpression('%s>%s' % (self.id, encode_atom(other)))
 def __lt__(self, other): return ConstraintExpression('%s<%s' % (self.id, encode_atom(other)))
コード例 #7
0
ファイル: proxy.py プロジェクト: msaunby/weather
 def __ne__(self, other): return ConstraintExpression('%s!=%s' % (self.id, encode_atom(other)))
 def __ge__(self, other): return ConstraintExpression('%s>=%s' % (self.id, encode_atom(other)))
コード例 #8
0
ファイル: proxy.py プロジェクト: openearth-attic/pydap
 def __lt__(self, other):
     return ConstraintExpression('%s<%s' % (self.id, encode_atom(other)))