Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
MacroMIP
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Blanz, Dr. Benjamin
MacroMIP
Commits
fbf697f6
Commit
fbf697f6
authored
9 months ago
by
Benjamin Blanz
Browse files
Options
Downloads
Patches
Plain Diff
changed data paths to include model name
parent
031903bb
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
resultsFigures/IIASA_ABM_Raw_Results_Analysis.py
+17
-20
17 additions, 20 deletions
resultsFigures/IIASA_ABM_Raw_Results_Analysis.py
with
17 additions
and
20 deletions
resultsFigures/IIASA_ABM_Raw_Results_Analysis.py
+
17
−
20
View file @
fbf697f6
...
...
@@ -156,12 +156,11 @@ sectors_nace_62_colors = cm.tab20(np.linspace(0, 1, len(sectors_nace_62)))
#%% load data
print
(
'
loading data
'
)
# `data` is a dictionary with variable names as keys and loaded matrices as values
base
=
loadmat
(
'
data/Baseline.mat
'
)
shock_eq
=
loadmat
(
'
data/Earthquake_Q1.mat
'
)
shock_f
=
loadmat
(
'
data/Flood_Q1.mat
'
)
shock_eq_f
=
loadmat
(
'
data/Earthquake_Q1_Flood_Q5.mat
'
)
shock_f_eq
=
loadmat
(
'
data/Flood_Q1_Earthquake_Q5.mat
'
)
base
=
loadmat
(
'
data/IIASA_ABM/Baseline.mat
'
)
shock_eq
=
loadmat
(
'
data/IIASA_ABM/Earthquake_Q1.mat
'
)
shock_f
=
loadmat
(
'
data/IIASA_ABM/Flood_Q1.mat
'
)
shock_eq_f
=
loadmat
(
'
data/IIASA_ABM/Earthquake_Q1_Flood_Q5.mat
'
)
shock_f_eq
=
loadmat
(
'
data/IIASA_ABM/Flood_Q1_Earthquake_Q5.mat
'
)
scenarios
=
[
shock_f
,
shock_eq
,
shock_f_eq
,
shock_eq_f
]
scenarios_names
=
[
"
flood
"
,
"
earthquake
"
,
"
consecutive flood earthquake
"
,
"
cosecutive earthquake flood
"
]
...
...
@@ -278,10 +277,9 @@ for s in range(len(scenarios)):
scenarios_dif
[
s
][
thingsWeCareAbout
[
j
]]
=
scenarios
[
s
][
thingsWeCareAbout
[
j
]]
-
base
[
thingsWeCareAbout
[
j
]]
scenarios_dif_rel
[
s
][
thingsWeCareAbout
[
j
]]
=
(
scenarios
[
s
][
thingsWeCareAbout
[
j
]]
-
base
[
thingsWeCareAbout
[
j
]])
/
base
[
thingsWeCareAbout
[
j
]]
#%% time series plots
print
(
'
plotting time series
'
)
figdir
=
'
figures/timeseries
'
figdir
=
'
figures/
IIASA_ABM/
timeseries
'
plotTypes
=
[
'
abs
'
,
'
dif_rel
'
]
...
...
@@ -354,11 +352,11 @@ for plotType in plotTypes:
#%% spatial plot
print
(
'
plotting maps
'
)
basefigdir
=
'
figures/maps
'
basefigdir
=
'
figures/
IIASA_ABM/
maps
'
subfig_size
=
(
15
,
15
)
nrows
=
3
ncols
=
6
ncols
=
5
max_val
=
0
min_val
=
0
for
s
in
range
(
len
(
scenarios
)):
...
...
@@ -367,12 +365,11 @@ for s in range(len(scenarios)):
max_val
=
max
(
abs
(
min_val
),
abs
(
max_val
))
min_val
=
-
max_val
scenariosToPlot
=
[
0
,
1
,
2
,
3
]
scenariosToPlot
=
[
1
,
0
,
2
,
3
]
plotType
=
'
dif_rel
'
for
scenario_index
in
scenariosToPlot
:
timestep
=
'
Q4
'
if
os
.
path
.
isfile
(
basefigdir
+
'
/map-
'
+
thing
+
'
_in_
'
+
scenarios_names
[
scenario_index
]
+
'
_scenario_as_
'
+
plotType
+
'
.png
'
):
print
(
'
skipping spatial plots for scenario
'
+
scenarios_names
[
scenario_index
]
+
'
file exists.
'
)
else
:
...
...
@@ -390,7 +387,7 @@ for scenario_index in scenariosToPlot:
fig
.
suptitle
(
thing
+
'
in
'
+
scenarios_names
[
scenario_index
]
+
'
scenario as
'
+
plotType
)
row
=
0
col
=
0
for
index
,
timestep
in
enumerate
(
time_steps
):
for
index
,
timestep
in
enumerate
(
time_steps
[
1
:]
):
thing_df_1
=
thing_df
[
thing_df
[
'
time
'
]
==
timestep
]
...
...
@@ -483,7 +480,7 @@ country_index = 22
scenario_index
=
1
base_radius
=
0.5
nrows
=
3
ncols
=
6
ncols
=
5
subfig_size
=
[
3
,
3
]
wedgeprops
=
{
"
edgecolor
"
:
"
k
"
,
"
linewidth
"
:
0.5
}
...
...
@@ -569,11 +566,11 @@ def addBrokenDonutPlot(piedata,ax,halo=False):
#%% pie / broken donutcharts by country
nrows
=
3
ncols
=
6
ncols
=
5
for
bakedGoodType
in
[
'
pies
'
,
'
brokendonouts
'
]:
for
bakedGoodType
in
[
'
brokendonouts
'
]:
print
(
'
plotting
'
+
bakedGoodType
+
'
by country
'
)
basefigdir
=
'
figures/
'
+
bakedGoodType
basefigdir
=
'
figures/
IIASA_ABM/
'
+
bakedGoodType
for
country_index
in
range
(
len
(
country_codes
)):
for
scenario_index
in
[
0
,
1
,
2
,
3
]:
figdir
=
basefigdir
+
'
/
'
+
scenarios_names
[
scenario_index
]
...
...
@@ -666,7 +663,7 @@ ncols=6
for
bakedGoodType
in
[
'
pies
'
,
'
brokendonouts
'
]:
print
(
'
plotting
'
+
bakedGoodType
+
'
by time
'
)
basefigdir
=
'
figures/
'
+
bakedGoodType
basefigdir
=
'
figures/
IIASA_ABM/
'
+
bakedGoodType
for
time_index
,
timestep
in
enumerate
(
time_steps
):
for
scenario_index
in
[
0
,
1
,
2
,
3
]:
figir
=
basefigdir
+
'
/
'
+
scenarios_names
[
scenario_index
]
...
...
@@ -885,7 +882,7 @@ min_val = -max_val
scenariosToPlot
=
[
0
,
1
,
2
,
3
]
for
insetType
in
[
'
bars
'
,
'
brokendonut
'
]:
basefigdir
=
'
figures/maps-
'
+
insetType
basefigdir
=
'
figures/
IIASA_ABM/
maps-
'
+
insetType
for
scenario_index
in
scenariosToPlot
:
figdir
=
basefigdir
+
'
/
'
+
scenarios_names
[
scenario_index
]
if
os
.
path
.
isfile
(
figdir
+
'
/brokendonut-
'
+
sector_thing
+
'
_in_
'
+
...
...
@@ -907,7 +904,7 @@ for insetType in ['bars','brokendonut']:
# initialize the figure
nrows
=
3
ncols
=
6
ncols
=
5
fig
,
axes
=
plt
.
subplots
(
nrows
,
ncols
,
figsize
=
(
subfig_size
[
0
]
*
ncols
,
subfig_size
[
1
]
*
nrows
))
plt
.
tight_layout
()
fig
.
suptitle
(
thing
+
'
in
'
+
scenarios_names
[
scenario_index
]
+
'
scenario as
'
+
plotType
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment