Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: Stamen, while importing the ImpactCalc method #909

Closed
satish-blip opened this issue Jul 6, 2024 · 2 comments
Closed

AttributeError: Stamen, while importing the ImpactCalc method #909

satish-blip opened this issue Jul 6, 2024 · 2 comments

Comments

@satish-blip
Copy link

Describe the bug
While trying to import the Calc method from engine we are getting AttributeError: Stamen. Going through some stack exchange reference it looks like Stamen has stopped providing support for base maps - https://stackoverflow.com/questions/77248120/stamen-terrain-map-not-working-in-cartopy

To Reproduce
Steps to reproduce the behavior/error:

Code example:

from climada.engine import ImpactCalc

Expected behavior
expected to setup the calculation engine.

Climada Version:
v4.1.1

System Information (please complete the following information):
Windows 10
3.9.19 | packaged by conda-forge | (main, Mar 20 2024, 12:38:46) [MSC v.1929 64 bit (AMD64)])

Additional context
The error is below:

KeyError Traceback (most recent call last)
File ~\anaconda3\envs\climada_env\lib\site-packages\xyzservices\lib.py:44, in Bunch.getattr(self, key)
43 try:
---> 44 return self.getitem(key)
45 except KeyError as err:

KeyError: 'Stamen'

The above exception was the direct cause of the following exception:

AttributeError Traceback (most recent call last)
Cell In[35], line 1
----> 1 from climada.engine import ImpactCalc

File ~\anaconda3\envs\climada_env\lib\site-packages\climada\engine_init_.py:21
1 """
2 This file is part of CLIMADA.
3
(...)
19 init engine
20 """
---> 21 from .impact import *
22 from .cost_benefit import *
23 from .impact_calc import *

File ~\anaconda3\envs\climada_env\lib\site-packages\climada\engine\impact.py:56
52 from climada.util.select import get_attributes_with_matching_dimension
54 LOGGER = logging.getLogger(name)
---> 56 class Impact():
57 """Impact definition. Compute from an entity (exposures and impact
58 functions) and hazard.
59
(...)
91 only filled if save_mat is True in calc()
92 """
94 def init(self,
95 event_id=None,
96 event_name=None,
(...)
107 imp_mat=None,
108 tag=None):

File ~\anaconda3\envs\climada_env\lib\site-packages\climada\engine\impact.py:608, in Impact()
603 axis.set_title(self._eai_title())
604 return axis
606 def plot_basemap_eai_exposure(self, mask=None, ignore_zero=False, pop_name=True,
607 buffer=0.0, extend='neither', zoom=10,
--> 608 url=ctx.providers.Stamen.Terrain,
609 axis=None, **kwargs):
610 """Plot basemap expected impact of each exposure within a period of 1/frequency_unit.
611
612 Parameters
(...)
638 cartopy.mpl.geoaxes.GeoAxesSubplot
639 """
640 if 'cmap' not in kwargs:

File ~\anaconda3\envs\climada_env\lib\site-packages\xyzservices\lib.py:46, in Bunch.getattr(self, key)
44 return self.getitem(key)
45 except KeyError as err:
---> 46 raise AttributeError(key) from err

AttributeError: Stamen

@satish-blip satish-blip added the bug label Jul 6, 2024
@peanutfun
Copy link
Member

@satish-blip Thank you for the bug report. The issue you experience was fixed in Climada v4.1.0, see the changelog and #796.

I assume you have installed the conda package of Climada follwing the "simple" installation instructions. Please try updating Climada, and ensure that v4.1.1 is indeed installed.

@peanutfun
Copy link
Member

Closing due to inactivity. @satish-blip, feel free to re-open the issue if your problem persists after following my instructions.

@peanutfun peanutfun closed this as not planned Won't fix, can't repro, duplicate, stale Jul 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants