Skip to content

Commit

Permalink
Fix errors
Browse files Browse the repository at this point in the history
  • Loading branch information
invisibleroads committed May 9, 2016
1 parent 9f7f90e commit 5dd688b
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 10 deletions.
2 changes: 1 addition & 1 deletion cc.ini
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ demographic_table_path = datasets/ethiopia-population-by-year-for-three-cities-w
population_year = 2016
population_growth_as_percent_of_population_per_year = 10

existing_networks_geotable_path = datasets/empty.shp.zip
existing_networks_geotable_path = datasets/empty-geotable.csv
line_length_adjustment_factor = 1.4

average_distance_between_buildings_in_meters = 25
Expand Down
1 change: 1 addition & 0 deletions datasets/empty-geotable.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
WKT
Binary file removed datasets/empty.shp.zip
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from argparse import ArgumentParser
from infrastructure_planning.growth.fitted import get_fitted_linear_function
from invisibleroads_macros.disk import make_enumerated_folder_for, make_folder
from invisibleroads_macros.log import format_summary
from os.path import join
from pandas import read_csv

Expand Down Expand Up @@ -68,7 +69,7 @@ def estimate_consumption_using_similar_demographics(
read_csv(args.demographic_by_year_table_path),
args.demographic_by_year_table_population_column,

TableType.load(
args.electricity_consumption_by_population_table_path),
read_csv(args.electricity_consumption_by_population_table_path),
args.electricity_consumption_by_population_table_population_column,
args.electricity_consumption_by_population_table_consumption_column)
print(format_summary(d))
15 changes: 8 additions & 7 deletions estimate_electricity_cost_by_technology_from_population.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,16 +85,16 @@ def estimate_nodal_internal_cost_by_technology(**keywords):
# Compute
d = OrderedDefaultDict(OrderedDict)
for (
technology, estimate_internal_cost, estimate_external_cost,
) in COST_FUNCTIONS_BY_TECHNOLOGY.items():
technology, estimate_internal_cost
) in INTERNAL_COST_FUNCTIONS_BY_TECHNOLOGY.items():
value_by_key = OrderedDict(compute(estimate_internal_cost, keywords))
d.update(rename_keys(value_by_key, prefix=technology + '_'))
# Summarize
keys = [
'internal_discounted_cost',
'internal_levelized_cost',
]
for technology, k in product(COST_FUNCTIONS_BY_TECHNOLOGY, keys):
for technology, k in product(INTERNAL_COST_FUNCTIONS_BY_TECHNOLOGY, keys):
d['%s_by_technology' % k][technology] = d['%s_%s' % (technology, k)]
return d

Expand Down Expand Up @@ -155,12 +155,14 @@ def estimate_grid_mv_transformer_cost(

def estimate_grid_lv_line_cost(
connection_count_by_year,
line_length_adjustment_factor,
average_distance_between_buildings_in_meters,
grid_lv_line_installation_lm_cost_per_meter,
grid_lv_line_maintenance_lm_cost_per_meter_per_year,
grid_lv_line_lifetime_in_years):
return prepare_lv_line_cost(
connection_count_by_year,
line_length_adjustment_factor,
average_distance_between_buildings_in_meters,
grid_lv_line_installation_lm_cost_per_meter,
grid_lv_line_maintenance_lm_cost_per_meter_per_year,
Expand Down Expand Up @@ -272,12 +274,14 @@ def estimate_diesel_mini_grid_fuel_cost(

def estimate_diesel_mini_grid_lv_line_cost(
connection_count_by_year,
line_length_adjustment_factor,
average_distance_between_buildings_in_meters,
diesel_mini_grid_lv_line_installation_lm_cost_per_meter,
diesel_mini_grid_lv_line_maintenance_lm_cost_per_meter_per_year,
diesel_mini_grid_lv_line_lifetime_in_years):
return prepare_lv_line_cost(
connection_count_by_year,
line_length_adjustment_factor,
average_distance_between_buildings_in_meters,
diesel_mini_grid_lv_line_installation_lm_cost_per_meter,
diesel_mini_grid_lv_line_maintenance_lm_cost_per_meter_per_year,
Expand Down Expand Up @@ -680,18 +684,15 @@ def load_messages(locale):
# estimate_nodal_external_cost_by_technology,
estimate_total_cost,
]
COST_FUNCTIONS_BY_TECHNOLOGY = OrderedDict([(
INTERNAL_COST_FUNCTIONS_BY_TECHNOLOGY = OrderedDict([(
'grid',
estimate_grid_internal_cost,
None # estimate_grid_external_cost,
), (
'diesel_mini_grid',
estimate_diesel_mini_grid_internal_cost,
None # estimate_diesel_mini_grid_external_cost,
), (
'solar_home',
estimate_solar_home_internal_cost,
None # estimate_solar_home_external_cost,
)])


Expand Down

0 comments on commit 5dd688b

Please sign in to comment.