示例#1
0
    def from_node(cls, node, xml_ns, ns_key=None, kwargs=None):
        if kwargs is None:
            kwargs = OrderedDict()

        pm_key = cls._child_xml_ns_key.get('ProcessingModules', ns_key)
        kwargs['ProcessingModules'] = _find_children(node, 'ProcessingModule', xml_ns, pm_key)
        return super(ProductProcessingType, cls).from_node(node, xml_ns, ns_key=ns_key, kwargs=kwargs)
示例#2
0
 def from_node(cls, node, xml_ns, ns_key=None, kwargs=None):
     if kwargs is None:
         kwargs = OrderedDict()
     gkey = cls._child_xml_ns_key.get('GeoInfos', ns_key)
     kwargs['GeoInfos'] = _find_children(node, 'GeoInfo', xml_ns, gkey)
     return super(GeoDataType, cls).from_node(node,
                                              xml_ns,
                                              ns_key=ns_key,
                                              kwargs=kwargs)
示例#3
0
 def _deserialize_multipolygon(cls, node, xml_ns, tag='MultiPolygon'):
     mp_node = _find_first_child(node, tag, xml_ns, 'sfa')
     if mp_node is None:
         return None
     p_nodes = _find_children(mp_node, 'Element', xml_ns, 'sfa')
     return [
         cls._extract_polygon(p_node, xml_ns, tag='Ring')
         for p_node in p_nodes
     ]
示例#4
0
 def _deserialize_multilinestring(cls, node, xml_ns, tag='MultiLineString'):
     mls_node = _find_first_child(node, tag, xml_ns, 'sfa')
     if mls_node is None:
         return None
     ls_nodes = _find_children(mls_node, 'Element', xml_ns, 'sfa')
     return [
         cls._extract_line(ls_node, xml_ns, tag='Vertex')
         for ls_node in ls_nodes
     ]
示例#5
0
 def from_node(cls, node, xml_ns, ns_key=None, kwargs=None):
     if kwargs is None:
         kwargs = OrderedDict()
     kwargs['SubRegions'] = _find_children(node, 'SubRegion', xml_ns,
                                           ns_key)
     return super(GeographicCoverageType, cls).from_node(node,
                                                         xml_ns,
                                                         ns_key=ns_key,
                                                         kwargs=kwargs)
示例#6
0
 def from_node(cls, node, xml_ns, ns_key=None, kwargs=None):
     if kwargs is None:
         kwargs = OrderedDict()
     # parse the ModuleName
     mn_key = cls._child_xml_ns_key.get('ModuleName', ns_key)
     mn_node = _find_first_child(node, 'ModuleName', xml_ns, mn_key)
     kwargs['ModuleName'] = _get_node_value(mn_node)
     kwargs['name'] = mn_node.attrib.get('name', None)
     # parse the ProcessingModule children
     pm_key = cls._child_xml_ns_key.get('ProcessingModules', ns_key)
     kwargs['ProcessingModules'] = _find_children(node, 'ProcessingModule', xml_ns, pm_key)
     return super(ProcessingModuleType, cls).from_node(node, xml_ns, ns_key=ns_key, kwargs=kwargs)
示例#7
0
    def from_node(cls, node, xml_ns, ns_key=None, kwargs=None):
        dim1 = int_func(node.attrib['size'])
        dim2 = int_func(node.attrib['numLuts'])
        arr = numpy.zeros((dim1, dim2), dtype=numpy.uint16)

        lut_key = cls._child_xml_ns_key.get('LUTValues', ns_key)
        lut_nodes = _find_children(node, 'LUTValues', xml_ns, lut_key)
        for i, lut_node in enumerate(lut_nodes):
            arr[:, i] = [str(el) for el in _get_node_value(lut_node)]
        if numpy.max(arr) < 256:
            arr = numpy.cast[numpy.uint8](arr)
        return cls(LUTValues=arr)
示例#8
0
 def from_node(cls, node, xml_ns, ns_key=None, kwargs=None):
     numPhasings = int_func(node.attrib['numPhasings'])
     numPoints = int_func(node.attrib['numPoints'])
     coefs = numpy.zeros((numPhasings + 1, numPoints + 1),
                         dtype=numpy.float64)
     ckey = cls._child_xml_ns_key.get('Coefs', ns_key)
     coef_nodes = _find_children(node, 'Coef', xml_ns, ckey)
     for cnode in coef_nodes:
         ind1 = int_func(cnode.attrib['phasing'])
         ind2 = int_func(cnode.attrib['point'])
         val = float(_get_node_value(cnode))
         coefs[ind1, ind2] = val
     return cls(Coefs=coefs)
示例#9
0
 def _extract_polygon(cls, node, xml_ns, tag='Ring'):
     v_nodes = _find_children(node, tag, xml_ns, 'sfa')
     return [cls._extract_line(v_node, xml_ns, tag='Vertex') for v_node in v_nodes]