Plot 11 resources treemap
In [1]:
Copied!
"""
Resources usage
===================================
Treemap of resources used by category.
"""
# mkdocs_gallery_thumbnail_path = '_static/plot_11_resources_treemap.png'
"""
Resources usage
===================================
Treemap of resources used by category.
"""
# mkdocs_gallery_thumbnail_path = '_static/plot_11_resources_treemap.png'
Out[1]:
'\nResources usage\n===================================\n\nTreemap of resources used by category.\n'
In [2]:
Copied!
from energyscope.energyscope import Energyscope
from energyscope.models import core
from energyscope.result import postprocessing
from energyscope.plots import plot_resources_use
from energyscope.energyscope import Energyscope
from energyscope.models import core
from energyscope.result import postprocessing
from energyscope.plots import plot_resources_use
In [3]:
Copied!
es_core = Energyscope(model=core)
results_core = postprocessing(es_core.calc(), df_monthly=False)
es_core = Energyscope(model=core)
results_core = postprocessing(es_core.calc(), df_monthly=False)
[INFO] Activating AMPL license with UUID
--------------------------------------------------------------------------- SystemError Traceback (most recent call last) File /builds/energyscope/energyscope/src/energyscope/energyscope.py:41, in Energyscope.es_model(self) 40 modules.activate(ampl_uuid) ---> 41 self.__es_model = AMPL() 42 except SystemError: 43 # Try to create the object a second time to prevent errors when starting `ampl_lic` File ~/.local/share/hatch/env/virtual/energyscope/4BIeM0-F/docs/lib/python3.10/site-packages/amplpy/ampl.py:105, in AMPL.__init__(self, environment) 104 if environment is None: --> 105 self._impl = amplpython.AMPL() 106 else: SystemError: License not valid. Message: License file /root/.local/share/hatch/env/virtual/energyscope/4BIeM0-F/docs/lib/python3.10/site-packages/ampl_module_base/bin/ampl.lic: Today = 20260304; found license file "/root/.local/share/hatch/env/virtual/energyscope/4BIeM0-F/docs/lib/python3.10/site-packages/ampl_module_base/bin/ampl.lic": # Bundle #7221.7759 expiring 20260215: ME-409 Energy conversion and renewable energy, Prof. Fran?ois Mar?chal, EPFL 69a7f014 37a0ac3b d337a22b 068a3ada 4390bed6 7bd26394 066db7e2 c26b5e03 b5b4a83e d46495c8 701c99f6 624b6ef4 0221ba5a 66420db8 a2e149a3 e41bb8be d5853041 8052b0ab 86e95af5 6790f2bc 93e8f2ff 25250e28 e2f3567e 23728ba4 b1b65e1f b2f50bb0 e4c65c2d 35277b67 4559d288 7e779c19 77d658bf 42e2d69d b1b60b24 d824ee98 62040ee8 c568251e 82cee987 fb646116 e7c6acef f15505dc c6bf8b65 27e743d5 93f20200 06a9b053 f768fe07 82031dc8 e78191bb 71ce9c56 455490c3 c2d3b3dd b6c1bbfe a25bde6f 3364b8b7 3788a8a5 41300547 76261cd1 3b8456f6 1ed597c7 667a346a e3653173 fddf1dc5 0509a735 2bf821eb f870b253 1a1e8ba4 12ae2640 e657c255 6bf77b60 966f6533 ca1cfab1 d769070c 5def2653 e88a71b4 69be7c11 fe11b2a3 9ec26506 c146d6f1 3739cc55 f215158a 0ee300c5 b5ead015 73179100 2a41f07e bee322c1 3dd8db11 df163c83 a855a2d4 0828ce4e 4cd03080 d5db8063 c1 Computed 1-1-0-f7e71178 runner--pdbxrphm-project-62195384-concurrent-0 86:7E:05:99:9C:E4 HOSTINFO.NPROC.4 HOSTINFO.CORES.4 HOSTINFO.PLATFORM.linux64 No ampl license for this machine. During handling of the above exception, another exception occurred: SystemError Traceback (most recent call last) Cell In[3], line 2 1 es_core = Energyscope(model=core) ----> 2 results_core = postprocessing(es_core.calc(), df_monthly=False) File /builds/energyscope/energyscope/src/energyscope/energyscope.py:83, in Energyscope.calc(self, ds, parser) 79 def calc(self, ds: Dataset = None, parser: Callable[[AMPL], Result] = parse_result) -> Result: 80 """ 81 Calls AMPL with `df` as .dat and returns the parsed result. 82 """ ---> 83 if self.es_model.getSets().__len__() == 0: # Check if AMPL instance is empty 84 self._initial_run(ds=ds) 86 # Solve the model File /builds/energyscope/energyscope/src/energyscope/energyscope.py:44, in Energyscope.es_model(self) 41 self.__es_model = AMPL() 42 except SystemError: 43 # Try to create the object a second time to prevent errors when starting `ampl_lic` ---> 44 self.__es_model = AMPL() 45 return self.__es_model File ~/.local/share/hatch/env/virtual/energyscope/4BIeM0-F/docs/lib/python3.10/site-packages/amplpy/ampl.py:105, in AMPL.__init__(self, environment) 103 environment = Environment() 104 if environment is None: --> 105 self._impl = amplpython.AMPL() 106 else: 107 self._impl = amplpython.AMPL(environment._impl) SystemError: License not valid. Message: License file /root/.local/share/hatch/env/virtual/energyscope/4BIeM0-F/docs/lib/python3.10/site-packages/ampl_module_base/bin/ampl.lic: Today = 20260304; found license file "/root/.local/share/hatch/env/virtual/energyscope/4BIeM0-F/docs/lib/python3.10/site-packages/ampl_module_base/bin/ampl.lic": # Bundle #7221.7759 expiring 20260215: ME-409 Energy conversion and renewable energy, Prof. Fran?ois Mar?chal, EPFL 69a7f014 37a0ac3b d337a22b 068a3ada 4390bed6 7bd26394 066db7e2 c26b5e03 b5b4a83e d46495c8 701c99f6 624b6ef4 0221ba5a 66420db8 a2e149a3 e41bb8be d5853041 8052b0ab 86e95af5 6790f2bc 93e8f2ff 25250e28 e2f3567e 23728ba4 b1b65e1f b2f50bb0 e4c65c2d 35277b67 4559d288 7e779c19 77d658bf 42e2d69d b1b60b24 d824ee98 62040ee8 c568251e 82cee987 fb646116 e7c6acef f15505dc c6bf8b65 27e743d5 93f20200 06a9b053 f768fe07 82031dc8 e78191bb 71ce9c56 455490c3 c2d3b3dd b6c1bbfe a25bde6f 3364b8b7 3788a8a5 41300547 76261cd1 3b8456f6 1ed597c7 667a346a e3653173 fddf1dc5 0509a735 2bf821eb f870b253 1a1e8ba4 12ae2640 e657c255 6bf77b60 966f6533 ca1cfab1 d769070c 5def2653 e88a71b4 69be7c11 fe11b2a3 9ec26506 c146d6f1 3739cc55 f215158a 0ee300c5 b5ead015 73179100 2a41f07e bee322c1 3dd8db11 df163c83 a855a2d4 0828ce4e 4cd03080 d5db8063 c1 Computed 1-1-0-f7e71178 runner--pdbxrphm-project-62195384-concurrent-0 86:7E:05:99:9C:E4 HOSTINFO.NPROC.4 HOSTINFO.CORES.4 HOSTINFO.PLATFORM.linux64 No ampl license for this machine.
In [4]:
Copied!
fig = plot_resources_use(results_core)
fig.show(renderer="notebook")
fig = plot_resources_use(results_core)
fig.show(renderer="notebook")
--------------------------------------------------------------------------- NameError Traceback (most recent call last) Cell In[4], line 1 ----> 1 fig = plot_resources_use(results_core) 2 fig.show(renderer="notebook") NameError: name 'results_core' is not defined