mirror of
https://github.com/JHUAPL/SIMoN.git
synced 2026-01-08 22:37:56 -05:00
remove models not used for open source release
Former-commit-id: 33541c63e689812c6108b8a1992fd0d617affbf5
This commit is contained in:
@@ -1,5 +0,0 @@
|
||||
FROM simon-model:latest
|
||||
RUN pip3 install pandas fair
|
||||
RUN pip3 install fair
|
||||
RUN pip3 install numpy
|
||||
CMD ["python3", "/opt/src/inner_wrapper.py"]
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1,20 +0,0 @@
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"co2": {
|
||||
"type": "object",
|
||||
"properties":{
|
||||
"data": {"type": "object"},
|
||||
"granularity": {"type": "string"}
|
||||
}
|
||||
},
|
||||
"thermo_water": {
|
||||
"type": "object",
|
||||
"properties":{
|
||||
"data": {"type": "object"},
|
||||
"granularity": {"type": "string"}
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": ["co2", "thermo_water"]
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"climate": {
|
||||
"type": "object",
|
||||
"properties":{
|
||||
"data": {"type": "object"},
|
||||
"granularity": {"type": "string"}
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": ["climate"]
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
import fair
|
||||
from fair.forward import fair_scm
|
||||
import numpy as np
|
||||
import json
|
||||
|
||||
# need to iterate through another dictionary that has counties as values
|
||||
# sum up the values set equaal to new variable
|
||||
# scale it then CFT
|
||||
def temperature_simulation(electric):
|
||||
total = sum(list(filter(None, electric.values())))
|
||||
# emissions[i]=
|
||||
emissions = np.array(total)
|
||||
# other_rf = np.zeros(emissions.size)
|
||||
|
||||
# for x in range(0, emissions.size):
|
||||
# other_rf[x] = 0.5 * np.sin(2 * np.pi * (x) / 14.0)
|
||||
|
||||
# emissions=emissions*6.66667*3.5714285 #scaling factors
|
||||
|
||||
C, F, T = fair.forward.fair_scm(
|
||||
emissions_driven=True,
|
||||
emissions=np.array([emissions * 6.66667 * 3.5714285]),
|
||||
useMultigas=False,
|
||||
)
|
||||
|
||||
return T
|
||||
|
||||
|
||||
# temperature_simulation({'co2':{'data':{5646:9.9,489247:6,234708:4.5}},'therm':[2,3,2]})
|
||||
@@ -1,49 +0,0 @@
|
||||
import glob
|
||||
import sys
|
||||
import fair
|
||||
|
||||
sys.path.append('/')
|
||||
from outer_wrapper import OuterWrapper
|
||||
from climate import temperature_simulation
|
||||
|
||||
# put the json file from the output of power supply into the schemas/input file
|
||||
|
||||
|
||||
class InnerWrapper(OuterWrapper):
|
||||
def __init__(self):
|
||||
num_input_schemas = len(glob.glob("/opt/schemas/input/*.json"))
|
||||
super().__init__(
|
||||
model_id="climate", num_expected_inputs=num_input_schemas
|
||||
)
|
||||
# self.electric=None
|
||||
|
||||
def configure(self, **kwargs):
|
||||
if 'co2' in kwargs.keys():
|
||||
self.electric = kwargs['co2']
|
||||
if 'thermo_water' in kwargs.keys():
|
||||
self.electric = kwargs['thermo_water']
|
||||
|
||||
def increment(self, **kwargs):
|
||||
if 'power_output' in kwargs.keys():
|
||||
self.electric = kwargs['power_output']['co2']['data']
|
||||
else:
|
||||
print('input co2 not found')
|
||||
temperature = float(temperature_simulation(self.electric))
|
||||
|
||||
return {
|
||||
'climate': {
|
||||
'climate': {
|
||||
'data': {'global_temp': temperature},
|
||||
'granularity': 'global',
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
def main():
|
||||
wrapper = InnerWrapper()
|
||||
wrapper.run()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -1,11 +0,0 @@
|
||||
# build from the base model image (required)
|
||||
FROM simon-model:latest
|
||||
|
||||
# install dependencies
|
||||
RUN apt-get update && apt-get install -y libboost-filesystem-dev libboost-system-dev
|
||||
ENV LC_ALL C.UTF-8
|
||||
RUN pip3 install pybind11
|
||||
RUN pip3 install pyhector==2.1.0.0
|
||||
|
||||
# run the inner wrapper (required)
|
||||
CMD ["python3", "/opt/src/inner_wrapper.py"]
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"rcp": "rcp26"
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
{
|
||||
"title": "empty schema",
|
||||
"description": "matches everything"
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"climate": {
|
||||
"type": "object",
|
||||
"properties":{
|
||||
"data": {"type": "object"},
|
||||
"granularity": {"type": "string"}
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": ["climate"]
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
{
|
||||
"title": "empty schema",
|
||||
"description": "matches everything"
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
import glob
|
||||
import sys
|
||||
|
||||
sys.path.append('/')
|
||||
from outer_wrapper import OuterWrapper
|
||||
import pyhector
|
||||
import json
|
||||
|
||||
|
||||
class InnerWrapper(OuterWrapper):
|
||||
def __init__(self):
|
||||
num_input_schemas = len(glob.glob("/opt/schemas/input/*.json"))
|
||||
super().__init__(
|
||||
model_id="hector", num_expected_inputs=num_input_schemas
|
||||
)
|
||||
|
||||
def configure(self, **kwargs):
|
||||
self.rcp = kwargs['bootstrap']['rcp']
|
||||
|
||||
def increment(self, **kwargs):
|
||||
if self.rcp == "rcp26":
|
||||
print("rcp26")
|
||||
pandas_df = pyhector.run(pyhector.rcp26)
|
||||
else:
|
||||
print("rcp85")
|
||||
pandas_df = pyhector.run(pyhector.rcp85)
|
||||
|
||||
return {
|
||||
'climate': {
|
||||
'climate': {
|
||||
'data': json.loads(
|
||||
pandas_df["temperature.Tgav"].to_json()
|
||||
),
|
||||
'granularity': 'global',
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
def main():
|
||||
wrapper = InnerWrapper()
|
||||
wrapper.run()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -1,3 +0,0 @@
|
||||
FROM simon-model:latest
|
||||
RUN pip3 install pandas numpy statsmodels scipy==1.2.1
|
||||
CMD ["python3", "/opt/src/inner_wrapper.py"]
|
||||
File diff suppressed because one or more lines are too long
@@ -1,12 +0,0 @@
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"logisticpopulation": {
|
||||
"type": "object",
|
||||
"properties":{
|
||||
"data": {"type": "object"},
|
||||
"granularity": {"type": "string"}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
{
|
||||
@@ -1,40 +0,0 @@
|
||||
# def populationfunction(logisticpopulation):
|
||||
# pop={}
|
||||
# sum = 0
|
||||
# for i in logisticpopulation.keys():
|
||||
# N = logisticpopulation[i] #this is the county population
|
||||
# k = 300000000/3007 #this scales the max capacity to the county level (there are 3007 US counties)
|
||||
# r = 1.0061 #this is the growth rate
|
||||
# pop[i] = r*N*((k-N)/k) #this is the equation
|
||||
|
||||
# return pop
|
||||
|
||||
# def populationfunction(logisticpopulation):
|
||||
# pop={}
|
||||
# sum = 0
|
||||
# for i in logisticpopulation.keys():
|
||||
# sum += logisticpopulation[i]
|
||||
# print(sum)
|
||||
# N = logisticpopulation[i] #this is the county population
|
||||
# k = (N/sum) *300000000 #this scales the max capacity to the county level (there are 3007 US counties)
|
||||
# r = 1.0061 #this is the growth rate
|
||||
# pop[i] = r*N*((k-N)/k) #this is the equation
|
||||
|
||||
# return pop
|
||||
|
||||
|
||||
def populationfunction(population):
|
||||
pop = {}
|
||||
mysum = 0
|
||||
for i in population.keys():
|
||||
# or j in logisticpopulation.keys()[i]:
|
||||
mysum += population[i]
|
||||
|
||||
for i in population.keys():
|
||||
N = population[i] # this is the county population
|
||||
k = (
|
||||
N / mysum
|
||||
) * 400000000 # this scales the max capacity to the county level (there are 3007 US counties)
|
||||
r = 1.0071 # this is the growth rate
|
||||
pop[i] = N + r * N * ((k - N) / k) # this is the equation
|
||||
return pop
|
||||
@@ -1,47 +0,0 @@
|
||||
import glob
|
||||
import sys
|
||||
|
||||
sys.path.append('/')
|
||||
from outer_wrapper import OuterWrapper
|
||||
from LogisticGrowth import populationfunction
|
||||
|
||||
|
||||
class InnerWrapper(OuterWrapper):
|
||||
def __init__(self):
|
||||
num_input_schemas = len(glob.glob("/opt/schemas/input/*.json"))
|
||||
super().__init__(
|
||||
model_id="logisticpopulation",
|
||||
num_expected_inputs=num_input_schemas,
|
||||
)
|
||||
|
||||
def configure(self, **kwargs):
|
||||
if '2016 populations' in kwargs.keys():
|
||||
self.population = kwargs['2016 populations']
|
||||
else:
|
||||
print('population initialization data not found')
|
||||
|
||||
def increment(self, **kwargs):
|
||||
# if 'logisticpopulation' in kwargs.keys():
|
||||
# self.population = kwargs['logistispopulation']['logisticpopulation']['data']
|
||||
# else:
|
||||
# print('input population not found')
|
||||
|
||||
population = populationfunction(self.population)
|
||||
self.population = population
|
||||
return {
|
||||
'logisticpopulation': {
|
||||
'logisticpopulation': {
|
||||
'data': population,
|
||||
'granularity': 'county',
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
def main():
|
||||
wrapper = InnerWrapper()
|
||||
wrapper.run()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user