本文整理汇总了Python中treemap.models.Species.wildlife_value方法的典型用法代码示例。如果您正苦于以下问题:Python Species.wildlife_value方法的具体用法?Python Species.wildlife_value怎么用?Python Species.wildlife_value使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类treemap.models.Species
的用法示例。
在下文中一共展示了Species.wildlife_value方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setupTreemapEnv
# 需要导入模块: from treemap.models import Species [as 别名]
# 或者: from treemap.models.Species import wildlife_value [as 别名]
def setupTreemapEnv():
def local_render_to_response(*args, **kwargs):
from django.template import loader
from django.http import HttpResponse
httpresponse_kwargs = {'mimetype': kwargs.pop('mimetype', None)}
hr = HttpResponse(
loader.render_to_string(*args, **kwargs), **httpresponse_kwargs)
if hasattr(args[1], 'dicts'):
hr.request_context = args[1].dicts
return hr
django.shortcuts.render_to_response = local_render_to_response
instance = make_instance(is_public=True)
make_user_with_default_role(instance, 'jim')
commander = make_commander_user(instance, 'commander')
make_apprentice_user(instance, 'apprentice')
n1geom = MultiPolygon(Polygon(
((0, 0), (100, 0), (100, 100), (0, 100), (0, 0))))
n2geom = MultiPolygon(
Polygon(((0, 101), (101, 101), (101, 200), (0, 200), (0, 101))))
n1 = Boundary(name="n1", category='blah', sort_order=4, geom=n1geom)
n2 = Boundary(name="n2", category='blah', sort_order=4, geom=n2geom)
n1.save()
n2.save()
s1 = Species(otm_code="s1", genus="testus1", species="specieius1",
cultivar='', instance=instance)
s2 = Species(otm_code="s2", genus="testus2", species="specieius2",
cultivar='', instance=instance)
s3 = Species(otm_code="s3", genus="testus2", species="specieius3",
cultivar='', instance=instance)
s1.native_status = True
s1.fall_conspicuous = True
s1.flower_conspicuous = True
s1.palatable_human = True
s2.native_status = True
s2.fall_conspicuous = False
s2.flower_conspicuous = True
s2.palatable_human = False
s2.wildlife_value = True
s3.wildlife_value = True
s1.save_with_user(commander)
s2.save_with_user(commander)
s3.save_with_user(commander)
return instance
示例2: setupTreemapEnv
# 需要导入模块: from treemap.models import Species [as 别名]
# 或者: from treemap.models.Species import wildlife_value [as 别名]
#.........这里部分代码省略.........
olivia_profile = UserProfile(user=olivia)
olivia_profile.save()
olivia.reputation = Reputation(user=olivia)
olivia.reputation.save()
n1geom = MultiPolygon(Polygon(((0, 0), (100, 0), (100, 100), (0, 100), (0, 0))))
n2geom = MultiPolygon(Polygon(((0, 101), (101, 101), (101, 200), (0, 200), (0, 101))))
n1 = Neighborhood(name="n1", region_id=2, city="c1", state="PA", county="PAC", geometry=n1geom)
n2 = Neighborhood(name="n2", region_id=2, city="c2", state="NY", county="NYC", geometry=n2geom)
n1.save()
n2.save()
z1geom = MultiPolygon(Polygon(((0, 0), (100, 0), (100, 100), (0, 100), (0, 0))))
z2geom = MultiPolygon(Polygon(((0, 100), (100, 100), (100, 200), (0, 200), (0, 100))))
z1 = ZipCode(zip="19107", geometry=z1geom)
z2 = ZipCode(zip="10001", geometry=z2geom)
z1.save()
z2.save()
exgeom1 = MultiPolygon(Polygon(((0, 0), (25, 0), (25, 25), (0, 25), (0, 0))))
ex1 = ExclusionMask(geometry=exgeom1, type="building")
ex1.save()
agn1 = AggregateNeighborhood(
annual_stormwater_management=0.0,
annual_electricity_conserved=0.0,
annual_energy_conserved=0.0,
annual_natural_gas_conserved=0.0,
annual_air_quality_improvement=0.0,
annual_co2_sequestered=0.0,
annual_co2_avoided=0.0,
annual_co2_reduced=0.0,
total_co2_stored=0.0,
annual_ozone=0.0,
annual_nox=0.0,
annual_pm10=0.0,
annual_sox=0.0,
annual_voc=0.0,
annual_bvoc=0.0,
total_trees=0,
total_plots=0,
location=n1,
)
agn2 = AggregateNeighborhood(
annual_stormwater_management=0.0,
annual_electricity_conserved=0.0,
annual_energy_conserved=0.0,
annual_natural_gas_conserved=0.0,
annual_air_quality_improvement=0.0,
annual_co2_sequestered=0.0,
annual_co2_avoided=0.0,
annual_co2_reduced=0.0,
total_co2_stored=0.0,
annual_ozone=0.0,
annual_nox=0.0,
annual_pm10=0.0,
annual_sox=0.0,
annual_voc=0.0,
annual_bvoc=0.0,
total_trees=0,
total_plots=0,
location=n2,
)
agn1.save()
agn2.save()
s1 = Species(symbol="s1", genus="testus1", species="specieius1", cultivar_name="", family="", alternate_symbol="a1")
s2 = Species(symbol="s2", genus="testus2", species="specieius2", cultivar_name="", family="", alternate_symbol="a2")
s3 = Species(symbol="s3", genus="testus2", species="specieius3", cultivar_name="", family="", alternate_symbol="a3")
s1.native_status = "True"
s1.fall_conspicuous = True
s1.flower_conspicuous = True
s1.palatable_human = True
s2.native_status = "True"
s2.fall_conspicuous = False
s2.flower_conspicuous = True
s2.palatable_human = False
s2.wildlife_value = True
s3.wildlife_value = True
s1.save()
s2.save()
s3.save()
s1.resource.add(rsrc1)
s2.resource.add(rsrc2)
s3.resource.add(rsrc2)
ie = ImportEvent(file_name="site_add")
ie.save()