Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
SMART
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UNI-KLU
SMART
Commits
8155f69d
Commit
8155f69d
authored
Oct 29, 2020
by
Bogdan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
User_Demand Visualizations
parent
931efc95
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
230628 additions
and
45 deletions
+230628
-45
visualisationPaper.py
...le-stage-discovery-microservice/app/visualisationPaper.py
+82
-45
EnergyDataSubset.json
...very-microservice/app/visualization/EnergyDataSubset.json
+230402
-0
visualizeRawData.py
...covery-microservice/app/visualization/visualizeRawData.py
+144
-0
No files found.
src/data-hub/role-stage-discovery-microservice/app/visualisationPaper.py
View file @
8155f69d
...
@@ -30,7 +30,7 @@ from db.repository import *
...
@@ -30,7 +30,7 @@ from db.repository import *
repo
=
Repository
()
repo
=
Repository
()
def
delete
WHOOLE
Data
():
def
delete
Similarity
Data
():
repo
.
delete_all_similarity_data
()
repo
.
delete_all_similarity_data
()
def
processData
():
def
processData
():
...
@@ -45,14 +45,14 @@ def mainViz():
...
@@ -45,14 +45,14 @@ def mainViz():
# inputSimListOfDict = json.loads(r.content)
# inputSimListOfDict = json.loads(r.content)
# big set
# big set
print
(
"Opening JSON"
)
print
(
"Opening JSON"
)
with
open
(
'resultSimilarityDictN
86400C3388
.json'
)
as
json_file
:
with
open
(
'resultSimilarityDictN
100800C4206
.json'
)
as
json_file
:
inputSimListOfDict
=
json
.
load
(
json_file
)
inputSimListOfDict
=
json
.
load
(
json_file
)
print
(
"Opened JSON"
)
print
(
"Opened JSON"
)
demandLayerListOfDict
=
[]
demandLayerListOfDict
=
[]
for
simDict
in
inputSimListOfDict
:
for
simDict
in
inputSimListOfDict
:
if
simDict
[
'cluster_layer'
]
==
'Demand_Layer'
:
if
simDict
[
'cluster_layer'
]
==
'
User_
Demand_Layer'
:
demandLayerListOfDict
.
append
(
simDict
)
demandLayerListOfDict
.
append
(
simDict
)
# {
# {
...
@@ -75,38 +75,61 @@ def mainViz():
...
@@ -75,38 +75,61 @@ def mainViz():
distributionHeating
=
dict
()
distributionHeating
=
dict
()
distributionPrice
=
dict
()
distributionPrice
=
dict
()
distributionPosition
=
dict
()
distributionPosition
=
dict
()
distributionTotal_Demand
=
dict
()
for
entry
in
demandLayerListOfDict
:
for
entry
in
demandLayerListOfDict
:
similVal
=
entry
[
'similarityValues'
]
similVal
=
entry
[
'similarityValues'
]
try
:
if
checkKey
(
distributionSolar
,
similVal
[
'Solar_Production_Layer'
]):
if
checkKey
(
distributionSolar
,
similVal
[
'Solar_Production_Layer'
]):
distributionSolar
[
similVal
[
'Solar_Production_Layer'
]]
+=
1
distributionSolar
[
similVal
[
'Solar_Production_Layer'
]]
+=
1
else
:
else
:
if
(
similVal
[
'Solar_Production_Layer'
]
<
45000
):
if
(
similVal
[
'Solar_Production_Layer'
]
<
45000
):
distributionSolar
[
similVal
[
'Solar_Production_Layer'
]]
=
1
distributionSolar
[
similVal
[
'Solar_Production_Layer'
]]
=
1
except
:
pass
try
:
if
checkKey
(
distributionEnergy
,
similVal
[
'Energy_Consumption_Layer'
]):
if
checkKey
(
distributionEnergy
,
similVal
[
'Energy_Consumption_Layer'
]):
distributionEnergy
[
similVal
[
'Energy_Consumption_Layer'
]]
+=
1
distributionEnergy
[
similVal
[
'Energy_Consumption_Layer'
]]
+=
1
else
:
else
:
if
(
similVal
[
'Energy_Consumption_Layer'
]
<
45000
):
if
(
similVal
[
'Energy_Consumption_Layer'
]
<
45000
):
distributionEnergy
[
similVal
[
'Energy_Consumption_Layer'
]]
=
1
distributionEnergy
[
similVal
[
'Energy_Consumption_Layer'
]]
=
1
except
:
pass
try
:
if
checkKey
(
distributionHeating
,
similVal
[
'Heating_Consumption_Layer'
]):
if
checkKey
(
distributionHeating
,
similVal
[
'Heating_Consumption_Layer'
]):
distributionHeating
[
similVal
[
'Heating_Consumption_Layer'
]]
+=
1
distributionHeating
[
similVal
[
'Heating_Consumption_Layer'
]]
+=
1
else
:
else
:
if
(
similVal
[
'Heating_Consumption_Layer'
]
<
45000
):
if
(
similVal
[
'Heating_Consumption_Layer'
]
<
45000
):
distributionHeating
[
similVal
[
'Heating_Consumption_Layer'
]]
=
1
distributionHeating
[
similVal
[
'Heating_Consumption_Layer'
]]
=
1
except
:
pass
try
:
if
checkKey
(
distributionPrice
,
similVal
[
'Price_Layer'
]):
if
checkKey
(
distributionPrice
,
similVal
[
'Price_Layer'
]):
distributionPrice
[
similVal
[
'Price_Layer'
]]
+=
1
distributionPrice
[
similVal
[
'Price_Layer'
]]
+=
1
else
:
else
:
if
(
similVal
[
'Price_Layer'
]
<
45000
):
if
(
similVal
[
'Price_Layer'
]
<
45000
):
distributionPrice
[
similVal
[
'Price_Layer'
]]
=
1
distributionPrice
[
similVal
[
'Price_Layer'
]]
=
1
except
:
pass
if
checkKey
(
distributionPosition
,
similVal
[
'Position_Layer'
]):
try
:
distributionPosition
[
similVal
[
'Position_Layer'
]]
+=
1
if
checkKey
(
distributionPosition
,
similVal
[
'Location_Layer'
]):
distributionPosition
[
similVal
[
'Location_Layer'
]]
+=
1
else
:
if
(
similVal
[
'Location_Layer'
]
<
45000
):
distributionPosition
[
similVal
[
'Location_Layer'
]]
=
1
except
:
pass
try
:
if
checkKey
(
distributionTotal_Demand
,
similVal
[
'Demand_Layer'
]):
distributionTotal_Demand
[
similVal
[
'Demand_Layer'
]]
+=
1
else
:
else
:
if
(
similVal
[
'Position_Layer'
]
<
45000
):
if
(
similVal
[
'Demand_Layer'
]
<
45000
):
distributionPosition
[
similVal
[
'Position_Layer'
]]
=
1
distributionTotal_Demand
[
similVal
[
'Demand_Layer'
]]
=
1
except
:
pass
print
(
"
\n
FinishedListDistrib
\n
"
)
print
(
"
\n
FinishedListDistrib
\n
"
)
...
@@ -120,37 +143,49 @@ def mainViz():
...
@@ -120,37 +143,49 @@ def mainViz():
#fig.suptitle('')
#fig.suptitle('')
#fig.text(0.5, 0.04, 'Euclidean Distance', ha='center', va='center')
#fig.text(0.5, 0.04, 'Euclidean Distance', ha='center', va='center')
list1
=
sorted
(
distributionSolar
.
items
())
# list1 = sorted(distributionSolar.items())
x2
,
y2
=
zip
(
*
list1
)
# x2,y2 = zip(*list1)
plt
.
bar
(
x2
,
y2
,
color
=
'purple'
,
label
=
"Solar"
,
width
=
0.2
)
# plt.bar(x2,y2,color='purple',label="Solar Production", width=0.2)
plt
.
legend
()
# plt.legend()
plt
.
set_title
(
'Solar'
)
# plt.title('Solar Production')
#plt.yscale('log')
# list1 = sorted(distributionEnergy.items())
# list1 = sorted(distributionEnergy.items())
# x,y = zip(*list1)
# x,y = zip(*list1)
# plt.bar(x, y, color='blue',label="Energy", width=0.2)
# plt.bar(x, y, color='blue',label="Energy
Consumption
", width=0.2)
# plt.legend()
# plt.legend()
# plt.set_title('Energy')
# plt.title('Energy Consumption')
# plt.yscale('log')
# list1 = sorted(distributionHeating.items())
# list1 = sorted(distributionHeating.items())
# x3,y3 = zip(*list1)
# x3,y3 = zip(*list1)
# plt.bar(x3,y3,color='red',label="Heating
", width=0.2
)
# plt.bar(x3,y3,color='red',label="Heating
Consumption", width=0.3
)
# plt.legend()
# plt.legend()
# plt.set_title('Heating')
# plt.title('Heating Consumption')
# plt.yscale('log')
# list1 = sorted(distributionPrice.items())
# list1 = sorted(distributionPrice.items())
# x4,y4 = zip(*list1)
# x4,y4 = zip(*list1)
# plt.bar(x4,y4,color='green',label="Price", width=0.2)
# plt.bar(x4,y4,color='green',label="Price", width=0.2)
# plt.legend()
# plt.legend()
# plt.set_title('Price')
# plt.title('Price')
# plt.yscale('log')
# list1 = sorted(distributionPosition.items())
# list1 = sorted(distributionPosition.items())
# x5,y5 = zip(*list1)
# x5,y5 = zip(*list1)
# plt.bar(x5,y5,color='grey',label="Location", width=0.2)
# plt.bar(x5,y5,color='grey',label="Location", width=0.2)
# plt.legend()
# plt.legend()
# plt.set_title('Position')
# plt.title('Location')
# plt.yscale('log')
list1
=
sorted
(
distributionTotal_Demand
.
items
())
x6
,
y6
=
zip
(
*
list1
)
plt
.
bar
(
x6
,
y6
,
color
=
'black'
,
label
=
"Total Demand"
,
width
=
0.2
)
plt
.
legend
()
plt
.
title
(
'Total Demand'
)
plt
.
yscale
(
'log'
)
...
@@ -179,8 +214,10 @@ def checkKey(dict, key):
...
@@ -179,8 +214,10 @@ def checkKey(dict, key):
#print("Not present")
#print("Not present")
return
False
return
False
#deleteWHOOLEData()
#processData()
#deleteSimilarityData()
#processData()
mainViz
()
mainViz
()
src/data-hub/role-stage-discovery-microservice/app/visualization/EnergyDataSubset.json
0 → 100644
View file @
8155f69d
This source diff could not be displayed because it is too large. You can
view the blob
instead.
src/data-hub/role-stage-discovery-microservice/app/visualization/visualizeRawData.py
0 → 100644
View file @
8155f69d
import
json
import
numpy
as
np
import
matplotlib.pyplot
as
plt
def
mainViz
():
print
(
"Opening JSON"
)
with
open
(
'EnergyDataSubset.json'
)
as
json_file
:
inputDict
=
json
.
load
(
json_file
)
distributionSolar
=
dict
()
distributionEnergy
=
dict
()
distributionHeating
=
dict
()
distributionPrice
=
dict
()
distributionDemand
=
dict
()
for
entry
in
inputDict
:
try
:
sVal
=
round
(
float
(
entry
[
'Solar_Production_kWh'
]),
2
)
if
(
checkKey
(
distributionSolar
,
sVal
)):
distributionSolar
[
sVal
]
+=
1
else
:
distributionSolar
[
sVal
]
=
1
except
Exception
as
E
:
print
(
E
)
try
:
eVal
=
round
(
float
(
entry
[
'Energy_Consumption_kWh'
]),
2
)
if
(
checkKey
(
distributionEnergy
,
eVal
)):
distributionEnergy
[
eVal
]
+=
1
else
:
distributionEnergy
[
eVal
]
=
1
except
:
pass
try
:
hVal
=
round
(
float
(
entry
[
'Heating_Consumption_kWh'
]),
2
)
if
(
hVal
>
0
):
if
(
checkKey
(
distributionHeating
,
hVal
)):
distributionHeating
[
hVal
]
+=
1
else
:
distributionHeating
[
hVal
]
=
1
except
:
pass
try
:
pVal
=
round
(
float
(
entry
[
'Price_AUD_MWh'
]),
2
)
if
(
checkKey
(
distributionPrice
,
pVal
)):
distributionPrice
[
pVal
]
+=
1
else
:
distributionPrice
[
pVal
]
=
1
except
:
pass
try
:
tdVal
=
round
(
float
(
entry
[
'Total_Demand_MWh'
]),
2
)
if
(
checkKey
(
distributionDemand
,
tdVal
)):
distributionDemand
[
tdVal
]
+=
1
else
:
distributionDemand
[
tdVal
]
=
1
except
:
pass
plt
.
ylabel
(
'Nr. of Entries'
)
# ### SOLAR
# list1 = sorted(distributionSolar.items())
# x2,y2 = zip(*list1)
# plt.bar(x2,y2,color='purple',label="Solar", width=0.005)
# plt.legend()
# plt.title('Solar Production')
# plt.xlabel('kWh')
# plt.show()
# plt.xlabel('Unit of measurement')
# plt.ylabel('Nr. of Entries')
# plt.xticks(np.linspace(0,4.5,num=20))
# ### ENERGY
# list1 = sorted(distributionEnergy.items())
# x2,y2 = zip(*list1)
# plt.bar(x2,y2,color='blue',label="Energy", width=0.005)
# plt.legend()
# plt.title('Energy Consumption')
# plt.xlabel('kWh')
# plt.show()
#plt.xticks(np.linspace(0,4.5,num=20))
## Heating
list1
=
sorted
(
distributionHeating
.
items
())
x2
,
y2
=
zip
(
*
list1
)
plt
.
bar
(
x2
,
y2
,
color
=
'red'
,
label
=
"Heating"
,
width
=
0.01
)
plt
.
legend
()
plt
.
title
(
'Heating Consumption'
)
plt
.
xlabel
(
'kWh'
)
plt
.
show
()
## Price
# #plt.xticks(np.linspace(0,100,num=10))
# list1 = sorted(distributionPrice.items())
# x2,y2 = zip(*list1)
# plt.bar(x2,y2,color='green',label="Price", width=0.5)
# plt.legend()
# plt.title('Price')
# plt.xlabel('MWh')
# plt.show()
### Demand
#plt.xticks(np.linspace(0,100,num=10))
# list1 = sorted(distributionDemand.items())
# x2,y2 = zip(*list1)
# plt.bar(x2,y2,color='gray',label="Demand", width=5)
# plt.legend()
# plt.title('Total Demand')
# plt.xlabel('MWh')
# plt.show()
print
(
"FIN"
)
def
checkKey
(
dict
,
key
):
if
key
in
dict
.
keys
():
#print("Present, ", end =" ")
#print(str(key)+ " : " + str(dict[key] ))
return
True
else
:
#print("Not present")
return
False
mainViz
()
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment