mirror of
https://github.com/JHUAPL/SIMoN.git
synced 2026-01-09 14:57:56 -05:00
adding units
Former-commit-id: 2ee2db80b24ea29438b7bbafafa1c372e2464fcd
This commit is contained in:
@@ -4,21 +4,21 @@
|
||||
"precipitation": {
|
||||
"type": "object",
|
||||
"properties":{
|
||||
"data": {"type": "object"},
|
||||
"data": {"type": "object", "unit": "mm"},
|
||||
"granularity": {"type": "string", "value": "huc8"}
|
||||
}
|
||||
},
|
||||
"evaporation": {
|
||||
"type": "object",
|
||||
"properties":{
|
||||
"data": {"type": "object"},
|
||||
"data": {"type": "object", "unit": "mm"},
|
||||
"granularity": {"type": "string", "value": "latlon"}
|
||||
}
|
||||
},
|
||||
"global_temp": {
|
||||
"type": "object",
|
||||
"properties":{
|
||||
"data": {"type": "object"},
|
||||
"data": {"type": "object", "unit": "\u00b0C"},
|
||||
"granularity": {"type": "null"}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
"power_demand": {
|
||||
"type": "object",
|
||||
"properties":{
|
||||
"data": {"type": "object"},
|
||||
"data": {"type": "object", "unit": "MWh"},
|
||||
"granularity": {"type": "string", "value": "county"}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,14 +4,14 @@
|
||||
"co2": {
|
||||
"type": "object",
|
||||
"properties":{
|
||||
"data": {"type": "object"},
|
||||
"data": {"type": "object", "unit": "tons"},
|
||||
"granularity": {"type": "string", "value": "nerc"}
|
||||
}
|
||||
},
|
||||
"thermo_water": {
|
||||
"type": "object",
|
||||
"properties":{
|
||||
"data": {"type": "object"},
|
||||
"data": {"type": "object", "unit": "Mgal"},
|
||||
"granularity": {"type": "string", "value": "nerc"}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
"water_demand": {
|
||||
"type": "object",
|
||||
"properties":{
|
||||
"data": {"type": "object"},
|
||||
"granularity": {"type": "string", "value": "state"}
|
||||
"data": {"type": "object", "unit": "Mgal"},
|
||||
"granularity": {"type": "string", "value": "county"}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -556,6 +556,7 @@ class OuterWrapper(ABC):
|
||||
disagg_name=dagg,
|
||||
)
|
||||
message["payload"][item]["data"] = data
|
||||
message["payload"][item]["unit"] = schema["properties"][item]["properties"]["data"].get("unit", "")
|
||||
message["payload"][item]["granularity"] = dest_gran
|
||||
|
||||
except ValidationError:
|
||||
@@ -673,6 +674,7 @@ class OuterWrapper(ABC):
|
||||
disagg_name=dagg,
|
||||
)
|
||||
message["payload"][item]["data"] = data
|
||||
message["payload"][item]["unit"] = schema["properties"][item]["properties"]["data"].get("unit", "")
|
||||
message["payload"][item]["granularity"] = dest_gran
|
||||
|
||||
self.validated_schemas[name] = message["payload"]
|
||||
|
||||
@@ -188,6 +188,7 @@
|
||||
" print(f\"plotting {dataset} (granularity: {granularity})\")\n",
|
||||
" instance_col_name = 'ID'\n",
|
||||
" year = data['year']\n",
|
||||
" unit = data['payload'][dataset]['unit']\n",
|
||||
"\n",
|
||||
" df[dataset] = pd.DataFrame.from_dict(\n",
|
||||
" data['payload'][dataset]['data'],\n",
|
||||
@@ -235,7 +236,7 @@
|
||||
" )\n",
|
||||
" \n",
|
||||
" fig = figure(\n",
|
||||
" title=f\"USA {dataset} ({year})\",\n",
|
||||
" title=f\"{dataset} ({unit}, {year})\",\n",
|
||||
" tools=TOOLS,\n",
|
||||
" plot_width=plot_width,\n",
|
||||
" plot_height=plot_height,\n",
|
||||
|
||||
@@ -102,6 +102,7 @@ def plot_mongo_doc(
|
||||
print(f"plotting {dataset} (granularity: {granularity})")
|
||||
instance_col_name = "ID"
|
||||
year = data["year"]
|
||||
unit = data["payload"][dataset]["unit"]
|
||||
|
||||
df[dataset] = pd.DataFrame.from_dict(
|
||||
data["payload"][dataset]["data"],
|
||||
@@ -147,7 +148,7 @@ def plot_mongo_doc(
|
||||
else ("(x, y)", "($x, $y)")
|
||||
)
|
||||
fig = figure(
|
||||
title=f"USA {dataset} ({year})",
|
||||
title=f"{dataset} ({unit}, {year})",
|
||||
tools=TOOLS,
|
||||
plot_width=plot_width,
|
||||
plot_height=plot_height,
|
||||
|
||||
Reference in New Issue
Block a user