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 = 20261125; 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 6b0715eb f6423010 33929c94 8087b33a 708ce3f4 a0d09341 d0ce0cd7 b5639d3e 36daa0cf 15d4ebcf 678f2ba4 75886164 8758ed7b 941607ef 164be8a9 f2658fc7 a1919eeb 56f72066 a60c23a3 d58be1d2 e04e9d15 03b78a2e 60e11fbe a29588f6 72be05ed 0172dc3a b12a4dbf 2555c3dd ddffc5fc 2793fd11 311d0f9a 67484f60 b77c7030 80d66888 e16ae3ff a0d56e16 1cdc78a6 536797f5 775a6e56 578f9f12 8c92ba8e 3176f063 955a3d8f 95ca934e 1da10434 33f444c7 10a91a22 30fc7c66 39607d85 77c26acc a57c1e07 118bdcc4 4a42a8f1 d0f57c3e 176758dc 749a6849 a87a8b70 1182d317 b5e2276e b647ec32 1a5a8597 23556436 f28971a8 a62d5c9f 312398c7 a662f7b5 b303a426 82996244 9350a22f 77072f3a 616ba929 a4365010 af8bfa83 64228326 800e03ad 02e5d452 d6cda714 21219f9b d29376c4 22d1a6cb 23025369 53233052 b418c7ef c1a70781 5bb42ac6 d365f3fb a2f7b2d4 54673f17 89d09c0e 4443c7d6 47f0d49f 440d0c33 3814864c 41d2b71d 95075822 72f748b9 bd9aa062 50d5b2c1 b52ad8f8 43aab8e9 88 Computed 1-1-0-1f286bcf runner--pdbxrphm-project-62195384-concurrent-0 36:BC:CA:46:B7:AA 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 = 20261125; 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 6b0715eb f6423010 33929c94 8087b33a 708ce3f4 a0d09341 d0ce0cd7 b5639d3e 36daa0cf 15d4ebcf 678f2ba4 75886164 8758ed7b 941607ef 164be8a9 f2658fc7 a1919eeb 56f72066 a60c23a3 d58be1d2 e04e9d15 03b78a2e 60e11fbe a29588f6 72be05ed 0172dc3a b12a4dbf 2555c3dd ddffc5fc 2793fd11 311d0f9a 67484f60 b77c7030 80d66888 e16ae3ff a0d56e16 1cdc78a6 536797f5 775a6e56 578f9f12 8c92ba8e 3176f063 955a3d8f 95ca934e 1da10434 33f444c7 10a91a22 30fc7c66 39607d85 77c26acc a57c1e07 118bdcc4 4a42a8f1 d0f57c3e 176758dc 749a6849 a87a8b70 1182d317 b5e2276e b647ec32 1a5a8597 23556436 f28971a8 a62d5c9f 312398c7 a662f7b5 b303a426 82996244 9350a22f 77072f3a 616ba929 a4365010 af8bfa83 64228326 800e03ad 02e5d452 d6cda714 21219f9b d29376c4 22d1a6cb 23025369 53233052 b418c7ef c1a70781 5bb42ac6 d365f3fb a2f7b2d4 54673f17 89d09c0e 4443c7d6 47f0d49f 440d0c33 3814864c 41d2b71d 95075822 72f748b9 bd9aa062 50d5b2c1 b52ad8f8 43aab8e9 88 Computed 1-1-0-1f286bcf runner--pdbxrphm-project-62195384-concurrent-0 36:BC:CA:46:B7:AA 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