-
Notifications
You must be signed in to change notification settings - Fork 0
/
3_UDDT_Pit_cost.py
58 lines (43 loc) · 2.34 KB
/
3_UDDT_Pit_cost.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# Title: Novel financing strategies to simultaneously advance development goals for sanitation and agriculture
# through nutrient recovery
# Author: Hannah A.C. Lohman
# Created: March 11, 2019
# Updated: March 11, 2019
# This script, UDDT_Pit_cost.py, calculates the capital, labor, and O&M costs for a pit latrine (D402 & D403)
# and UDDT (D406)
# ~~~~~~~IMPORT DATA AND FILES NECESSARY~~~~~~~
import pandas as pd # import pandas for matrix data manipulation
material_cost = pd.read_excel('RESULTS_UDDT_Pit_capital_costs.xlsx', sheetname='capital_cost')
labor_cost_ratio = pd.read_excel('OUTPUT_uncertainty_ranges.xlsx', sheetname='labor_cost_ratio')
op_cost_ratio = pd.read_excel('OUTPUT_uncertainty_ranges.xlsx', sheetname='op_cost_ratio')
maint_cost_ratio = pd.read_excel('OUTPUT_uncertainty_ranges.xlsx', sheetname='maint_cost_ratio')
# ~~~~~~~CONSTANTS~~~~~~~
N_runs = 10000
usd_to_ugx = 3693.8 # UGX to USD conversion as of August 7, 2018
writer = pd.ExcelWriter('RESULTS_UDDT_pit_costs.xlsx')
pit_UDDT_cost_FINAL = pd.DataFrame()
for i in range(N_runs):
cap_UDDT = material_cost.D406[i]/usd_to_ugx
labor_UDDT = cap_UDDT * labor_cost_ratio.D406[i]
op_UDDT = cap_UDDT * op_cost_ratio.D406[i]
maint_UDDT = cap_UDDT * maint_cost_ratio.D406[i]
cap_slab = material_cost.D402[i]/usd_to_ugx
labor_slab = cap_slab * labor_cost_ratio.D402[i]
op_slab = cap_slab * op_cost_ratio.D402[i]
maint_slab = cap_slab * maint_cost_ratio.D402[i]
cap_pit = material_cost.D403[i]/usd_to_ugx
labor_pit = cap_pit * labor_cost_ratio.D403[i]
op_pit = cap_pit * op_cost_ratio.D403[i]
maint_pit = cap_pit * maint_cost_ratio.D403[i]
cap_pit_total = cap_slab + cap_pit
labor_pit_total = labor_slab + labor_pit
op_pit_total = op_slab + op_pit
maint_pit_total = maint_slab + maint_pit
output = pd.DataFrame([cap_pit_total, labor_pit_total, op_pit_total, maint_pit_total, cap_UDDT, labor_UDDT,
op_UDDT, maint_UDDT])
output = output.transpose()
pit_UDDT_cost_FINAL = pd.concat([pit_UDDT_cost_FINAL, output]).reset_index(drop=True)
pit_UDDT_cost_FINAL.columns = ('cap_pit', 'labor_pit', 'op_pit', 'maint_pit', 'cap_UDDT', 'labor_UDDT',
'op_UDDT', 'maint_UDDT')
pit_UDDT_cost_FINAL.to_excel(writer)
writer.save()