当前位置: 首页>>代码示例>>Python>>正文


Python Tree.height方法代码示例

本文整理汇总了Python中treemap.models.Tree.height方法的典型用法代码示例。如果您正苦于以下问题:Python Tree.height方法的具体用法?Python Tree.height怎么用?Python Tree.height使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在treemap.models.Tree的用法示例。


在下文中一共展示了Tree.height方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_update_tree_sets_updated

# 需要导入模块: from treemap.models import Tree [as 别名]
# 或者: from treemap.models.Tree import height [as 别名]
    def test_update_tree_sets_updated(self):
        tree = Tree(diameter=10, plot=self.plot, instance=self.instance)
        tree.save_with_user(self.user)
        self.plot = Plot.objects.get(pk=self.plot.pk)
        self.inital_updated = self.plot.updated_at

        tree.height = 22
        tree.save_with_user(self.user)
        self.assertGreater(self.plot.updated_at, self.initial_updated)
开发者ID:barbaralluz,项目名称:otm-core,代码行数:11,代码来源:test_map_feature.py

示例2: test_update_tree_sets_updated

# 需要导入模块: from treemap.models import Tree [as 别名]
# 或者: from treemap.models.Tree import height [as 别名]
    def test_update_tree_sets_updated(self):
        tree = Tree(diameter=10, plot=self.plot, instance=self.instance)
        tree.save_with_user(self.user)
        self.plot.refresh_from_db()
        self.inital_updated = self.plot.updated_at

        tree.height = 22
        tree.save_with_user(self.fellow)
        self.plot.refresh_from_db()
        self.assertGreater(self.plot.updated_at, self.initial_updated)
        self.assertEqual(self.plot.updated_by, self.fellow)
开发者ID:OpenTreeMap,项目名称:otm-core,代码行数:13,代码来源:test_map_feature.py

示例3: create_plot

# 需要导入模块: from treemap.models import Tree [as 别名]
# 或者: from treemap.models.Tree import height [as 别名]
def create_plot(user, instance, *args, **kwargs):
    if "height" in kwargs and kwargs["height"] > 1000:
        return ["Height is too large."]

    if "x" in kwargs and "y" in kwargs:
        geom = Point(kwargs["x"], kwargs["y"])
    elif "lon" in kwargs and "lat" in kwargs:
        geom = Point(kwargs["lon"], kwargs["lat"])
    else:
        geom = Point(50, 50)

    p = Plot(geom=geom, instance=instance)
    p.save_with_user(user)

    if "height" in kwargs:
        t = Tree(plot=p, instance=instance)
        t.height = kwargs["height"]
        t.save_with_user(user)
    return p
开发者ID:jvgriffis,项目名称:OTM2,代码行数:21,代码来源:views.py

示例4: create_plot

# 需要导入模块: from treemap.models import Tree [as 别名]
# 或者: from treemap.models.Tree import height [as 别名]
def create_plot(user, instance, *args, **kwargs):
    if 'height' in kwargs and kwargs['height'] > 1000:
        return ["Height is too large."]

    if 'x' in kwargs and 'y' in kwargs:
        geom = Point(
            kwargs['x'],
            kwargs['y'])
    elif 'lon' in kwargs and 'lat' in kwargs:
        geom = Point(
            kwargs['lon'],
            kwargs['lat'])
    else:
        geom = Point(50, 50)

    p = Plot(geom=geom, instance=instance)
    p.save_with_user(user)

    if 'height' in kwargs:
        t = Tree(plot=p, instance=instance)
        t.height = kwargs['height']
        t.save_with_user(user)
    return p
开发者ID:ahinz,项目名称:OpenTreeMap-cloud,代码行数:25,代码来源:views.py

示例5: handle_row

# 需要导入模块: from treemap.models import Tree [as 别名]
# 或者: from treemap.models.Tree import height [as 别名]

#.........这里部分代码省略.........
            pass
        elif sidewalk_damage is True or sidewalk_damage.lower() == "true" or sidewalk_damage.lower() == 'yes':
            plot.sidewalk_damage = 2
        else:
            plot.sidewalk_damage = 1

        plot.quick_save()

        pnt = plot.geometry
        n = Neighborhood.objects.filter(geometry__contains=pnt)
        z = ZipCode.objects.filter(geometry__contains=pnt)

        plot.neighborhoods = ""
        plot.neighborhood.clear()
        plot.zipcode = None

        if n:
            for nhood in n:
                if nhood:
                    plot.neighborhoods = plot.neighborhoods + " " + nhood.id.__str__()
                    plot.neighborhood.add(nhood)

        if z: plot.zipcode = z[0]

        plot.quick_save()

        if tree:
            tree.plot = plot
            tree.readonly = self.readonly
            tree.import_event = self.import_event
            tree.last_updated_by = self.updater

            if row.get('OWNER'):
                tree.tree_owner = str(row["OWNER"])

            if row.get('STEWARD'):
                tree.steward_name = str(row["STEWARD"])

            if row.get('SPONSOR'):
                tree.sponsor = str(row["SPONSOR"])

            if row.get('DATEPLANTED'):
                date_string = str(row['DATEPLANTED'])
                try:
                    date = datetime.strptime(date_string, "%m/%d/%Y")
                except:
                    pass
                try:
                    date = datetime.strptime(date_string, "%Y/%m/%d")
                except:
                    pass
                if not date:
                    raise ValueError("Date strings must be in mm/dd/yyyy or yyyy/mm/dd format")

                tree.date_planted = date.strftime("%Y-%m-%d")

            if row.get('DIAMETER'):
                tree.dbh = float(row['DIAMETER'])

            if row.get('HEIGHT'):
                tree.height = float(row['HEIGHT'])

            if row.get('CANOPYHEIGHT'):
                tree.canopy_height = float(row['CANOPYHEIGHT'])

            if row.get('CONDITION'):
                for k, v in choices['conditions']:
                    if v == row['CONDITION']:
                        tree.condition = k
                        break;

            if row.get('CANOPYCONDITION'):
                for k, v in choices['canopy_conditions']:
                    if v == row['CANOPYCONDITION']:
                        tree.canopy_condition = k
                        break;

            tree.quick_save()

            if row.get('PROJECT_1'):
                for k, v in Choices().get_field_choices('local'):
                    if v == row['PROJECT_1']:
                        local = TreeFlags(key=k,tree=tree,reported_by=self.updater)
                        local.save()
                        break;
            if row.get('PROJECT_2'):
                for k, v in Choices().get_field_choices('local'):
                    if v == row['PROJECT_2']:
                        local = TreeFlags(key=k,tree=tree,reported_by=self.updater)
                        local.save()
                        break;
            if row.get('PROJECT_3'):
                for k, v in Choices().get_field_choices('local'):
                    if v == row['PROJECT_3']:
                        local = TreeFlags(key=k,tree=tree,reported_by=self.updater)
                        local.save()
                        break;

            # rerun validation tests and store results
            tree.validate_all()
开发者ID:OpenTreeMap,项目名称:otm-legacy,代码行数:104,代码来源:uimport.py

示例6: handle_row

# 需要导入模块: from treemap.models import Tree [as 别名]
# 或者: from treemap.models.Tree import height [as 别名]

#.........这里部分代码省略.........
            tree.plot = plot
            tree.readonly = self.readonly
            tree.import_event = self.import_event
            tree.last_updated_by = self.updater

            if row.get("OWNER"):
                tree.tree_owner = str(row["OWNER"])

            if row.get("STEWARD"):
                tree.steward_name = str(row["STEWARD"])

            if row.get("SPONSOR"):
                tree.sponsor = str(row["SPONSOR"])

            if row.get("DATEPLANTED"):
                date_string = str(row["DATEPLANTED"])
                try:
                    date = datetime.strptime(date_string, "%m/%d/%Y")
                except:
                    pass
                try:
                    date = datetime.strptime(date_string, "%Y/%m/%d")
                except:
                    pass
                if not date:
                    raise ValueError("Date strings must be in mm/dd/yyyy or yyyy/mm/dd format")

                tree.date_planted = date.strftime("%Y-%m-%d")

            if row.get("DIAMETER"):
                tree.dbh = float(row["DIAMETER"])

            if row.get("HEIGHT"):
                tree.height = float(row["HEIGHT"])

            if row.get("CANOPYHEIGHT"):
                tree.canopy_height = float(row["CANOPYHEIGHT"])

            if row.get("CONDITION"):
                for k, v in choices["conditions"]:
                    if v == row["CONDITION"]:
                        tree.condition = k
                        break

            if row.get("CANOPYCONDITION"):
                for k, v in choices["canopy_conditions"]:
                    if v == row["CANOPYCONDITION"]:
                        tree.canopy_condition = k
                        break
            # FOR OTM INDIA
            # GIRTH_CM", "GIRTH_M", "HEIGHT_FT", "HEIGHT_M", "NEST", "BURROWS", "FLOWERS", "FRUITS", "NAILS", "POSTER", "WIRES", "TREE_GUARD", "NUISANCE", "NUISANCE_DESC", "HEALTH_OF_TREE", "FOUND_ON_GROUND", "GROUND_DESCRIPTION", "RISK_ON_TREE", "RISK_DESC", "RARE", "ENDANGERED", "VULNERABLE", "PEST_AFFECTED", "REFER_TO_DEPT", "SPECIAL_OTHER", "SPECIAL_OTHER_DESCRIPTION", "LATITUDE", "LONGITUDE", "CREATION_DATE", "DEVICE_ID", "TIME", "DATE"])

            if row.get("GIRTH_M"):
                tree.girth_m = float(row["GIRTH_M"])

            if row.get("HEIGHT_M"):
                tree.height_m = float(row["HEIGHT_M"])

            if row.get("NEST"):
                tree.nest = str(row["NEST"])

            if row.get("BURROWS"):
                tree.burrows = str(row["BURROWS"])

            if row.get("FLOWERS"):
                tree.flowers = str(row["FLOWERS"])
开发者ID:rcheetham,项目名称:treemapindia.in,代码行数:70,代码来源:uimport.py


注:本文中的treemap.models.Tree.height方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。