mirror of
https://github.com/JHUAPL/SIMoN.git
synced 2026-01-09 14:57:56 -05:00
Merge branch 'granularity' into jalen
Former-commit-id: 4b66b453daf23bbb2079ec64e8446281e5381aa4
This commit is contained in:
1
abstract-graph.geojson
Normal file
1
abstract-graph.geojson
Normal file
File diff suppressed because one or more lines are too long
@@ -1,11 +1,8 @@
|
||||
{
|
||||
"models": [
|
||||
"population",
|
||||
"hector",
|
||||
"power_demand",
|
||||
"power_supply",
|
||||
"waterdemand",
|
||||
"climate",
|
||||
"logisticpopulation"
|
||||
"waterdemand"
|
||||
]
|
||||
}
|
||||
|
||||
@@ -5,3 +5,5 @@ RUN wget https://download.opensuse.org/repositories/network:/messaging:/zeromq:/
|
||||
RUN apt-get install -y libzmq3-dev
|
||||
RUN pip3 install pymongo pyzmq jsonschema networkx geojson
|
||||
COPY ./outer_wrapper.py /.
|
||||
COPY ./instance-graph.geojson /.
|
||||
COPY ./abstract-graph.geojson /.
|
||||
|
||||
@@ -16,26 +16,11 @@ services:
|
||||
volumes:
|
||||
- ../models/examples/power_supply:/opt:ro
|
||||
|
||||
hector:
|
||||
build: ../models/examples/hector/
|
||||
volumes:
|
||||
- ../models/examples/hector:/opt:ro
|
||||
|
||||
waterdemand:
|
||||
build: ../models/examples/waterdemand/
|
||||
volumes:
|
||||
- ../models/examples/waterdemand:/opt:ro
|
||||
|
||||
climate:
|
||||
build: ../models/examples/climate/
|
||||
volumes:
|
||||
- ../models/examples/climate:/opt:ro
|
||||
|
||||
logisticpopulation:
|
||||
build: ../models/examples/logisticpopulation/
|
||||
volumes:
|
||||
- ../models/examples/logisticpopulation:/opt:ro
|
||||
|
||||
mongodb:
|
||||
image: mongo:latest
|
||||
container_name: mongodb
|
||||
|
||||
1
instance-graph.zip.REMOVED.git-id
Normal file
1
instance-graph.zip.REMOVED.git-id
Normal file
@@ -0,0 +1 @@
|
||||
df78e2a7a7f01c37df6803e3a25daa3a2507a221
|
||||
@@ -25,8 +25,11 @@ class InnerWrapper(OuterWrapper):
|
||||
print('input demand not found')
|
||||
emissions, water = gen_sim(self.dem, self.prof)
|
||||
|
||||
return {'power_output': { 'co2': {'data': emissions, 'granularity': 'county'},
|
||||
'thermo_water': {'data': water, 'granularity': 'county'}}}
|
||||
translated_emissions = self.translate(emissions, 'county', 'NERC', self.model_id)
|
||||
translated_water = self.translate(water, 'county', 'NERC', self.model_id)
|
||||
|
||||
return {'power_output': { 'co2': {'data': translated_emissions, 'granularity': 'county'},
|
||||
'thermo_water': {'data': translated_water, 'granularity': 'county'}}}
|
||||
|
||||
|
||||
def main():
|
||||
|
||||
@@ -23,8 +23,9 @@ class InnerWrapper(OuterWrapper):
|
||||
else:
|
||||
print('input population not found')
|
||||
demand = Water_Demand_Simulation(self.countypop, self.rate)
|
||||
translated_demand = self.translate(demand, 'county', 'HUC8', self.model_id)
|
||||
|
||||
return {'waterdemand': {'waterdemand': {'data': demand, 'granularity': 'county'}}}
|
||||
return {'waterdemand': {'waterdemand': {'data': translated_demand, 'granularity': 'county'}}}
|
||||
|
||||
|
||||
def main():
|
||||
|
||||
@@ -91,6 +91,10 @@ class OuterWrapper(ABC):
|
||||
self.broker_queue = Queue()
|
||||
self.action_queue = Queue()
|
||||
|
||||
self.abstract_graph = Graph("/abstract-graph.geojson")
|
||||
self.instance_graph = Graph("/instance-graph.geojson")
|
||||
self.instance_graph.nodes['UnitedStates']['area'] = 8081900
|
||||
|
||||
self.input_schemas = None
|
||||
self.output_schemas = None
|
||||
self.validated_schemas = {}
|
||||
@@ -240,6 +244,7 @@ class OuterWrapper(ABC):
|
||||
schemas = self.validated_schemas.copy()
|
||||
self.validated_schemas.clear()
|
||||
results = self.increment(**schemas)
|
||||
# translate results to the desired granularity?
|
||||
|
||||
# validate against output schemas
|
||||
for schema_name, data_msg in results.items():
|
||||
@@ -267,7 +272,6 @@ class OuterWrapper(ABC):
|
||||
data_msg['payload'] = data
|
||||
data_msg['signal'] = 'data'
|
||||
data_msg['source'] = self.model_id
|
||||
data_msg['incstep'] = self.incstep
|
||||
self.pub_queue.put(data_msg)
|
||||
logging.info("finished the increment")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user