Convert the given node into a characteristic fault object.

        :param node:
            a node with tag areaGeometry
        :returns:
            a :class:`openquake.hazardlib.source.CharacteristicFaultSource`
            instance
198701
def convert_characteristicFaultSource(self, node):
        
        char = source.CharacteristicFaultSource(
            source_id=node['id'],
            name=node['name'],
            tectonic_region_type=node.attrib.get('tectonicRegion'),
            mfd=self.convert_mfdist(node),
            surface=self.convert_surfaces(node.surface),
            rake=~node.rake,
            temporal_occurrence_model=self.get_tom(node))
        return char
783451
def _parse_simple_fault_geometry_surface(self, node):
        
        spacing = node["spacing"]
        usd, lsd, dip = (~node.upperSeismoDepth, ~node.lowerSeismoDepth,
                         ~node.dip)
        # Parse the geometry
        coords = split_coords_2d(~node.LineString.posList)
        trace = geo.Line([geo.Point(*p) for p in coords])
        return trace, usd, lsd, dip, spacing
1095118
def get_node_type(node)
      return :blank if node == BLANK_NODE

      case node.size
      when KV_WIDTH # [k,v]
        NibbleKey.decode(node[0]).terminate? ? :leaf : :extension
      when BRANCH_WIDTH # [k0, ... k15, v]
        :branch
      else
        raise InvalidNode, "node size must be #{KV_WIDTH} or #{BRANCH_WIDTH}"
      end
    end
704825
def convert_simpleFaultSource(self, node):
        
        geom = node.simpleFaultGeometry
        msr = valid.SCALEREL[~node.magScaleRel]()
        fault_trace = self.geo_line(geom)
        mfd = self.convert_mfdist(node)
        with context(self.fname, node):
            try:
                hypo_list = valid.hypo_list(node.hypoList)
            except AttributeError:
                hypo_list = ()
            try:
                slip_list = valid.slip_list(node.slipList)
            except AttributeError:
                slip_list = ()
            simple = source.SimpleFaultSource(
                source_id=node['id'],
                name=node['name'],
                tectonic_region_type=node.attrib.get('tectonicRegion'),
                mfd=mfd,
                rupture_mesh_spacing=self.rupture_mesh_spacing,
                magnitude_scaling_relationship=msr,
                rupture_aspect_ratio=~node.ruptAspectRatio,
                upper_seismogenic_depth=~geom.upperSeismoDepth,
                lower_seismogenic_depth=~geom.lowerSeismoDepth,
                fault_trace=fault_trace,
                dip=~geom.dip,
                rake=~node.rake,
                temporal_occurrence_model=self.get_tom(node),
                hypo_list=hypo_list,
                slip_list=slip_list)
        return simple
739966
def convert_npdist(self, node):
        
        with context(self.fname, node):
            npdist = []
            for np in node.nodalPlaneDist:
                prob, strike, dip, rake = (
                    np['probability'], np['strike'], np['dip'], np['rake'])
                npdist.append((prob, geo.NodalPlane(strike, dip, rake)))
            if not self.spinning_floating:
                npdist = [(1, npdist[0][1])]  # consider the first nodal plane
            return pmf.PMF(npdist)
626124
private Metric toMetric( Node node ) {
        if( node == null ) {
            return null;
        }

        Metric metric = new Metric();

        NodeList attributes = node.getChildNodes();
        for( int i = 0; i < attributes.getLength(); i++ ) {
            Node attribute = attributes.item(i);
            String name = attribute.getNodeName();

            if( name.equals("MetricName") ) {
                metric.setName(provider.getTextValue(attribute));
            }
            else if( name.equals("Namespace") ) {
                metric.setNamespace(provider.getTextValue(attribute));
            }
            else if( name.equals("Dimensions") ) {
                Map<String, String> dimensions = toMetadata(attribute.getChildNodes());
                if( dimensions != null ) {
                    metric.addMetadata(dimensions);
                }
            }
        }
        return metric;
    }
1048294
def build_area_source_geometry(area_source):
    
    geom = []
    for lon_lat in zip(area_source.polygon.lons, area_source.polygon.lats):
        geom.extend(lon_lat)
    poslist_node = Node("gml:posList", text=geom)
    linear_ring_node = Node("gml:LinearRing", nodes=[poslist_node])
    exterior_node = Node("gml:exterior", nodes=[linear_ring_node])
    polygon_node = Node("gml:Polygon", nodes=[exterior_node])
    upper_depth_node = Node(
        "upperSeismoDepth", text=area_source.upper_seismogenic_depth)
    lower_depth_node = Node(
        "lowerSeismoDepth", text=area_source.lower_seismogenic_depth)
    return Node(
        "areaGeometry", {'discretization': area_source.area_discretization},
        nodes=[polygon_node, upper_depth_node, lower_depth_node])
563365
def build_area_source_node(area_source):
    
    # parse geometry
    source_nodes = [build_area_source_geometry(area_source)]
    # parse common distributed attributes
    source_nodes.extend(get_distributed_seismicity_source_nodes(area_source))
    return Node(
        "areaSource", get_source_attributes(area_source), nodes=source_nodes)
974234
def findNode(self, node):
        
        ident = self.getRawIdent(node)
        if ident is None:
            ident = node
        try:
            return self.graph.node_data(ident)
        except KeyError:
            return None
632115
def set_area_geometry(w, src):
    
    assert "areaSource" in src.tag
    geometry_node = src.nodes[get_taglist(src).index("areaGeometry")]
    area_attrs = parse_area_geometry(geometry_node)
    w.poly(parts=[area_attrs["polygon"].tolist()])
400134
def parse_node(self, node):
        
        spec = super(CamundaProcessParser, self).parse_node(node)
        spec.data = self._parse_input_data(node)
        spec.data['lane_data'] = self._get_lane_properties(node)
        spec.defines = spec.data
        service_class = node.get(full_attr('assignee'))
        if service_class:
            self.parsed_nodes[node.get('id')].service_class = node.get(full_attr('assignee'))
        return spec
978
def parse_complex_fault_geometry(node):
    
    assert "complexFaultGeometry" in node.tag
    # Get general attributes
    geometry = {"intermediateEdges": []}
    for subnode in node:
        crds = subnode.nodes[0].nodes[0].text
        if "faultTopEdge" in subnode.tag:
            geometry["faultTopEdge"] = numpy.array(
                [[crds[i], crds[i + 1], crds[i + 2]]
                 for i in range(0, len(crds), 3)])
            geometry["upperSeismoDepth"] = numpy.min(
                geometry["faultTopEdge"][:, 2])
        elif "faultBottomEdge" in subnode.tag:

            geometry["faultBottomEdge"] = numpy.array(
                [[crds[i], crds[i + 1], crds[i + 2]]
                 for i in range(0, len(crds), 3)])
            geometry["lowerSeismoDepth"] = numpy.max(
                geometry["faultBottomEdge"][:, 2])
        elif "intermediateEdge" in subnode.tag:
            geometry["intermediateEdges"].append(
                numpy.array([[crds[i], crds[i + 1], crds[i + 2]]
                             for i in range(0, len(crds), 3)]))
        else:
            pass
    geometry["dip"] = None
    return geometry
374653
def convert_dropout(node, **kwargs):
    
    name, input_nodes, attrs = get_inputs(node, kwargs)

    probability = float(attrs.get("p", 0.5))

    dropout_node = onnx.helper.make_node(
        "Dropout",
        input_nodes,
        [name],
        ratio=probability,
        name=name
    )
    return [dropout_node]
978381
def convert_nonParametricSeismicSource(self, node):
        
        trt = node.attrib.get('tectonicRegion')
        rup_pmf_data = []
        rups_weights = None
        if 'rup_weights' in node.attrib:
            tmp = node.attrib.get('rup_weights')
            rups_weights = numpy.array([float(s) for s in tmp.split()])
        for i, rupnode in enumerate(node):
            probs = pmf.PMF(valid.pmf(rupnode['probs_occur']))
            rup = RuptureConverter.convert_node(self, rupnode)
            rup.tectonic_region_type = trt
            rup.weight = None if rups_weights is None else rups_weights[i]
            rup_pmf_data.append((rup, probs))
        nps = source.NonParametricSeismicSource(
            node['id'], node['name'], trt, rup_pmf_data)
        nps.splittable = 'rup_weights' not in node.attrib
        return nps
139019
def isConjNorthNode(self):
        
        node = self.chart.getObject(const.NORTH_NODE)
        return aspects.hasAspect(self.obj, node, aspList=[0])
989928
public FeatureVector getFeatureVector(Area node)
    {
        FeatureVector ret = new FeatureVector();
        String text = node.getText();
        int plen = text.length();
        if (plen == 0) plen = 1; //kvuli deleni nulou
        
        ret.setFontSize(node.getFontSize() / avgfont);
        ret.setWeight(node.getFontWeight());
        ret.setStyle(node.getFontStyle());
        ret.setReplaced(node.isReplaced());
        ret.setAabove(countAreasAbove(node));
        ret.setAbelow(countAreasBelow(node));
        ret.setAleft(countAreasLeft(node));
        ret.setAright(countAreasRight(node));
        ret.setNlines(getLineCount(node));
        ret.setDepth(node.getDepth() + 1); //+2: annotator counts the boxes and their areas as well
        ret.setTlength(text.length());
        ret.setPdigits(countChars(text, Character.DECIMAL_DIGIT_NUMBER) / (double) plen);
        ret.setPlower(countChars(text, Character.LOWERCASE_LETTER) / (double) plen);
        ret.setPupper(countChars(text, Character.UPPERCASE_LETTER) / (double) plen);
        ret.setPspaces(countChars(text, Character.SPACE_SEPARATOR) / (double) plen);
        ret.setPpunct(countCharsPunct(text) / (double) plen);
        ret.setRelx(getRelX(node));
        ret.setRely(getRelY(node));
        ret.setTlum(getAverageTextLuminosity(node));
        ret.setBglum(getBackgroundLuminosity(node));
        ret.setContrast(getContrast(node));
        ret.setCperc(ca.getColorPercentage(node));
        ret.setBcperc(bca.getColorPercentage(node));
        ret.setMarkedness(getMarkedness(node));
        Tag t = node.getMostSupportedTag();
        ret.setTagLevel(t == null ? -1 : t.getLevel());
        
        //TODO ostatni vlastnosti obdobne
        return ret;
    }
1061671
def getRequiredNodes(self):
        
        return {nodeShape:len(self.nodeReservations[nodeShape]) for nodeShape in self.nodeShapes}