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:40, in Energyscope.es_model(self) 39 modules.activate(ampl_uuid) ---> 40 self.__es_model = AMPL() 41 except SystemError: 42 # 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 = 20260325; 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 69c3f51a 69849912 d6f590c2 a68b4c4e 37f410d8 1d84d764 408ac6dc 47231324 87d62375 4007eca8 a0e719c9 916249a0 869b0c73 5680548f 306efff3 614c12a9 97049aee e9523e79 d1f7568d 709d094e f2d9049e e245eaad f2a58e50 c78fd065 e719ca0e 1bb1c2af 526fd351 74f45a16 20f297d4 a3f0aef4 74fbd74c 33741102 23dd4b13 08d00f5c 859a74e3 5434f6f8 84667b85 58929dd7 23a78832 217a283e d6d5b591 e305a9f5 a325bba9 74516632 972887d2 4526b326 a0f7f98e 82fea584 351fc686 2112f9e5 20a7fe47 7712644c 11bb135d 41302e44 15b67517 7fcbbed9 b9b50b54 672beb57 788b0d46 d5067cab 7f779196 447f1195 36d58b18 dc11ad92 1c5e53e7 1e135007 4f72f568 52355525 aceb236e 4fc462af 6f9a2723 7a835685 3d82c8e3 4e0b9252 619733fc 8a82f798 cd0e3c94 5ecd2dc6 08c77870 0ba5f65f 6b05e4fd 51c0d66a c4c125e0 5550096d a9c283b7 247df3ad a7814a30 fc53be8c 44456631 c38031da a1 Computed 1-1-0-f82a98db runner--pdbxrphm-project-62195384-concurrent-0 5E:E0:FF:5E:52:90 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:82, in Energyscope.calc(self, ds, parser) 78 def calc(self, ds: Dataset = None, parser: Callable[[AMPL], Result] = parse_result) -> Result: 79 """ 80 Calls AMPL with `df` as .dat and returns the parsed result. 81 """ ---> 82 if self.es_model.getSets().__len__() == 0: # Check if AMPL instance is empty 83 self._initial_run(ds=ds) 85 # Solve the model File /builds/energyscope/energyscope/src/energyscope/energyscope.py:43, in Energyscope.es_model(self) 40 self.__es_model = AMPL() 41 except SystemError: 42 # Try to create the object a second time to prevent errors when starting `ampl_lic` ---> 43 self.__es_model = AMPL() 44 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 = 20260325; 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 69c3f51a 69849912 d6f590c2 a68b4c4e 37f410d8 1d84d764 408ac6dc 47231324 87d62375 4007eca8 a0e719c9 916249a0 869b0c73 5680548f 306efff3 614c12a9 97049aee e9523e79 d1f7568d 709d094e f2d9049e e245eaad f2a58e50 c78fd065 e719ca0e 1bb1c2af 526fd351 74f45a16 20f297d4 a3f0aef4 74fbd74c 33741102 23dd4b13 08d00f5c 859a74e3 5434f6f8 84667b85 58929dd7 23a78832 217a283e d6d5b591 e305a9f5 a325bba9 74516632 972887d2 4526b326 a0f7f98e 82fea584 351fc686 2112f9e5 20a7fe47 7712644c 11bb135d 41302e44 15b67517 7fcbbed9 b9b50b54 672beb57 788b0d46 d5067cab 7f779196 447f1195 36d58b18 dc11ad92 1c5e53e7 1e135007 4f72f568 52355525 aceb236e 4fc462af 6f9a2723 7a835685 3d82c8e3 4e0b9252 619733fc 8a82f798 cd0e3c94 5ecd2dc6 08c77870 0ba5f65f 6b05e4fd 51c0d66a c4c125e0 5550096d a9c283b7 247df3ad a7814a30 fc53be8c 44456631 c38031da a1 Computed 1-1-0-f82a98db runner--pdbxrphm-project-62195384-concurrent-0 5E:E0:FF:5E:52:90 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