chm_zd.py
def copy_attributes(tmp_lyr, segments_lyr):
    """Copying attributes form temporary shp layer to segments"""
    for feat in tmp_lyr:
        if feat.GetField(0) != -9999:
            geom = feat.GetGeometryRef()
            fld_name = feat.GetFieldDefnRef(0).GetName()

            out_feat = ogr.Feature(segments_lyr.GetLayerDefn())
            out_feat.SetGeometry(geom)
            out_feat.SetField(fld_name, feat.GetField(0))
            segments_lyr.CreateFeature(out_feat)
Copying attributes form temporary shp layer to segments
Copying attributes form temporary shp layer to segments
Copying attributes form temporary shp layer to segments
def copy_attributes(tmp_lyr, segments_lyr):
    for feat in tmp_lyr:
        if feat.GetField(0) != -9999:
            geom = feat.GetGeometryRef()
            fld_name = feat.GetFieldDefnRef(0).GetName()
            out_feat = ogr.Feature(segments_lyr.GetLayerDefn())
            out_feat.SetGeometry(geom)
            out_feat.SetField(fld_name, feat.GetField(0))
            segments_lyr.CreateFeature(out_feat)
def copy_attributes ( tmp_lyr , segments_lyr ) : for feat in tmp_lyr : if feat . GetField ( 0 ) != - 9999 : geom = feat . GetGeometryRef ( ) fld_name = feat . GetFieldDefnRef ( 0 ) . GetName ( ) out_feat = ogr . Feature ( segments_lyr . GetLayerDefn ( ) ) out_feat . SetGeometry ( geom ) out_feat . SetField ( fld_name , feat . GetField ( 0 ) ) segments_lyr . CreateFeature ( out_feat )
Copying attributes form temporary shp layer to segments
Copying attributes form temporary shp layer to segments
"""Copying attributes form temporary shp layer to segments"""
tmp_lyr
segments_lyr