cuuats / cuuats.snt.lts Goto Github PK
View Code? Open in Web Editor NEWPython-based analysis for the Sustainable Neighborhoods Toolkit.
Home Page: https://gitlab.com/ccrpc/cuuats.snt.lts
License: BSD 3-Clause "New" or "Revised" License
Python-based analysis for the Sustainable Neighborhoods Toolkit.
Home Page: https://gitlab.com/ccrpc/cuuats.snt.lts
License: BSD 3-Clause "New" or "Revised" License
factory
with register=false
, add fields to the class, then register. (Removes the need for hacky field registration logic.)calculate_*
methods into class methods. Remove the field_name
argument, except where the method is called directly by a calculated field.Instead of using nested if
...then
statements, it would be preferable to calculate LTS scores using a testable method. Here is one possible structure for that method using eval
:
from numbers import Number
def calculate_score(self, scores, *condition_sets):
score = scores
for condition_set in condition_sets:
assert len(score) == len(condition_set)
# Loop through an enumeration of the conditions in this set, evaluating
# each one. When a condition evalutes to True:
# - Set score = score[i], where i is the index of the condition
# - Break out of the inner loop.
assert isinstance(score, Number)
return score
def calculate_bikeLaneWithParkingLane(self):
return self.calculate_score(
[[[1, 2, 3],
[4, 5, 6],
[7, 8, 9],
[10, 11, 12]],
[[13, 14, 15],
[16, 17, 18],
[19, 20, 21],
[22, 23, 24]]],
['self.LanesPerDirection in (0, 1)',
'self.LanesPerDirection >= 2'],
['self.IDOTAADT <= 1000',
'self.IDOTAADT <= 3000',
'self.IDOTAADT <= 30000',
'True'],
['self.BicycleFacilityWidth + self.ParkingLaneWidth >= 15',
'self.BicycleFacilityWidth + self.ParkingLaneWidth > 13',
'True'])
Segment.calculate_score = calculate_score
Segment.calculate_bikeLaneWithParkingLane = calculate_bikeLaneWithParkingLane
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.