-
Notifications
You must be signed in to change notification settings - Fork 1
/
Chemical.py
63 lines (39 loc) · 1.56 KB
/
Chemical.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
59
60
61
62
63
import Options
class Chemical(Options.ScenarioOptions):
def __init__(self, modelRunTitle):
Options.ScenarioOptions.__init__(self, modelRunTitle)
def setChemical(self, feed):
if feed == 'CG' or feed == 'SG':
if feed == 'CG':
query = self.__cornGrain__()
elif feed == 'SG':
query = self.__switchgrass__()
self.__executeQuery__(query)
def __cornGrain__(self):
chemQuery = """
INSERT INTO cg_chem
(
SELECT cg.fips, (2461850051) AS "SCC",
((cg.total_harv_ac * pest.EF * 0.9 * 0.835) * 0.907018474 / 2000.0) AS "VOC",
('Pesticide Emissions') AS "Description"
FROM """+self.productionSchema+""".cg_data cg, """ + self.constantsSchema + """.CG_pest_app_factor pest
WHERE substr(fips, 1, 2) = pest.STFIPS
)"""
return chemQuery
def __switchgrass__(self):
chemQuery = """
INSERT INTO sg_chem
(
SELECT sg.fips, (2461850099) AS "SCC",
(
(
sg.harv_ac * 0.1 * (0.5) +
sg.harv_ac * 0.1 * (1.0) +
sg.harv_ac * 0.1 * (1.0) +
sg.harv_ac * 0.1 * (1.5)
) * 0.9 * 0.835
) * 0.90718474 / 2000.0 AS "VOC",
('Establishment Year: quinclorac + Atrazine + 2-4-D-Amine') AS "Description"
FROM """+self.productionSchema+""".sg_data sg
)"""
return chemQuery