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 69c3f7d0 3513383f d6013cb5 f4a4db2a 12bfbdc5 2d976ff9 260e90c6 173ee068 d0a50de4 ed43ce45 259b4c0a 77c07638 b5a9a48e 2db3f184 a5226894 11da24aa e01a2ea1 44759aa6 93451864 33330d2f 3223cae2 c0b7b9ff d084a298 f224ded7 e15302b6 2a429a84 4025f149 f7dfd593 b15041f5 34b96ed5 2ddaf056 ead062bb df0a5632 470ca872 3542c965 aed32861 d572e617 7783de93 c3833125 033444dd c86f23b2 935842e5 92b675b6 5c1a47f3 e4610273 116adc61 85070484 4f44a848 f5cdbdb4 87b39f96 69fbdab6 2b1aa3dc 69efe487 b5afc427 0eaa1d83 0cbb1ad6 bf8c76a0 762ee602 ef625397 2da491b1 b17af055 70ea5736 d1e71e25 9bb8b954 d8a11f26 46d96b83 991ae2d0 be90023c a3ba8011 329d5b24 dd5d3df6 20785a6b d7a0d0d0 51e4f280 a00e0224 ad663a1f aba49234 40af0274 a63eddb0 8483ecdb fcac5d01 83cc9cb7 c94aac75 49d267fc b68f1312 37d31f07 7a0dcd44 15c4cb8d bc2903f1 b49a1069 35 Computed 1-1-0-10220046 runner--pdbxrphm-project-62195384-concurrent-0 FA:61:DB:37:C3:4C 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 69c3f7d0 3513383f d6013cb5 f4a4db2a 12bfbdc5 2d976ff9 260e90c6 173ee068 d0a50de4 ed43ce45 259b4c0a 77c07638 b5a9a48e 2db3f184 a5226894 11da24aa e01a2ea1 44759aa6 93451864 33330d2f 3223cae2 c0b7b9ff d084a298 f224ded7 e15302b6 2a429a84 4025f149 f7dfd593 b15041f5 34b96ed5 2ddaf056 ead062bb df0a5632 470ca872 3542c965 aed32861 d572e617 7783de93 c3833125 033444dd c86f23b2 935842e5 92b675b6 5c1a47f3 e4610273 116adc61 85070484 4f44a848 f5cdbdb4 87b39f96 69fbdab6 2b1aa3dc 69efe487 b5afc427 0eaa1d83 0cbb1ad6 bf8c76a0 762ee602 ef625397 2da491b1 b17af055 70ea5736 d1e71e25 9bb8b954 d8a11f26 46d96b83 991ae2d0 be90023c a3ba8011 329d5b24 dd5d3df6 20785a6b d7a0d0d0 51e4f280 a00e0224 ad663a1f aba49234 40af0274 a63eddb0 8483ecdb fcac5d01 83cc9cb7 c94aac75 49d267fc b68f1312 37d31f07 7a0dcd44 15c4cb8d bc2903f1 b49a1069 35 Computed 1-1-0-10220046 runner--pdbxrphm-project-62195384-concurrent-0 FA:61:DB:37:C3:4C 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