Get the sea level pressure
slp = getvar(ncfile, "slp",timeidx=1)
Name Version Build Channel
cartopy 0.20.2 py310hb89acbc_4 conda-forge
wrf-python 1.3.3 py310h3254323_0 conda-forge
error message
AttributeError Traceback (most recent call last)
Input In [7], in <cell line: 2>()
1 # Get the cartopy mapping object
----> 2 cart_proj = get_cartopy(slp)
File ~/anaconda3/envs/python_env/lib/python3.10/site-packages/wrf/util.py:3523, in get_cartopy(var, wrfin, varname, timeidx, method, squeeze, cache)
3459 def get_cartopy(var=None, wrfin=None, varname=None, timeidx=0, method="cat",
3460 squeeze=True, cache=None):
3461 """Return a :class:cartopy.crs.Projection subclass for the
3462 map projection.
3463
(...)
3521
3522 """
-> 3523 return _get_proj_obj("cartopy", var, wrfin, varname, timeidx, method,
3524 squeeze, cache)
File ~/anaconda3/envs/python_env/lib/python3.10/site-packages/wrf/util.py:3389, in _get_proj_obj(ob_type, var, wrfin, varname, timeidx, method, squeeze, cache, **kwargs)
3385 wrf_proj, geobnds = _get_wrf_proj_geobnds(var, wrfin, varname, timeidx,
3386 method, squeeze, cache)
3388 if ob_type == "cartopy":
-> 3389 proj_obj = wrf_proj.cartopy()
3390 elif ob_type == "basemap":
3391 try:
File ~/anaconda3/envs/python_env/lib/python3.10/site-packages/wrf/projection.py:419, in WrfProj.cartopy(self)
416 if not cartopy_enabled():
417 raise RuntimeError("'cartopy' is not "
418 "installed or is disabled")
--> 419 return self._cartopy()
File ~/anaconda3/envs/python_env/lib/python3.10/site-packages/wrf/projection.py:707, in Mercator._cartopy(self)
704 _cartopy = crs.Mercator(central_longitude=self._stand_lon,
705 globe=self._globe())
706 else:
--> 707 _cartopy = MercatorWithLatTS(central_longitude=self._stand_lon,
708 latitude_true_scale=self._lat_ts,
709 globe=self._globe())
711 return _cartopy
File ~/anaconda3/envs/python_env/lib/python3.10/site-packages/wrf/projection.py:64, in MercatorWithLatTS.init(self, central_longitude, latitude_true_scale, min_latitude, max_latitude, globe)
61 super(crs.Mercator, self).init(proj4_params, globe=globe)
63 # Calculate limits.
---> 64 limits = self.transform_points(
65 crs.Geodetic(),
66 np.array([-180, 180]) + central_longitude,
67 np.array([min_latitude, max_latitude]))
69 # When using a latitude of true scale, the min/max x-limits get set
70 # to the same value, so make sure the left one is negative
71 xlimits = limits[..., 0]
File ~/anaconda3/envs/python_env/lib/python3.10/site-packages/cartopy/crs.py:408, in CRS.transform_points(self, src_crs, x, y, z, trap)
405 x[to_180] = (((x[to_180] + 180) % 360) - 180)
406 try:
407 result[:, 0], result[:, 1], result[:, 2] =
--> 408 _safe_pj_transform(src_crs, self, x, y, z, trap=trap)
409 except ProjError as err:
410 msg = str(err).lower()
File ~/anaconda3/envs/python_env/lib/python3.10/site-packages/cartopy/crs.py:50, in _safe_pj_transform(src_crs, tgt_crs, x, y, z, trap)
49 def _safe_pj_transform(src_crs, tgt_crs, x, y, z=None, trap=True):
---> 50 transformer = _get_transformer_from_crs(src_crs, tgt_crs)
51 transformed_coords = transformer.transform(x, y, z, errcheck=trap)
52 if z is None:
File ~/anaconda3/envs/python_env/lib/python3.10/site-packages/cartopy/crs.py:1673, in Mercator.hash(self)
1672 def hash(self):
-> 1673 return hash((self.proj4_init, self._x_limits, self._y_limits))
AttributeError: 'MercatorWithLatTS' object has no attribute '_x_limits'
Get the sea level pressure
slp = getvar(ncfile, "slp",timeidx=1)
Name Version Build Channel
cartopy 0.20.2 py310hb89acbc_4 conda-forge
wrf-python 1.3.3 py310h3254323_0 conda-forge
error message
AttributeError Traceback (most recent call last)
Input In [7], in <cell line: 2>()
1 # Get the cartopy mapping object
----> 2 cart_proj = get_cartopy(slp)
File ~/anaconda3/envs/python_env/lib/python3.10/site-packages/wrf/util.py:3523, in get_cartopy(var, wrfin, varname, timeidx, method, squeeze, cache)
3459 def get_cartopy(var=None, wrfin=None, varname=None, timeidx=0, method="cat",
3460 squeeze=True, cache=None):
3461 """Return a :class:
cartopy.crs.Projectionsubclass for the3462 map projection.
3463
(...)
3521
3522 """
-> 3523 return _get_proj_obj("cartopy", var, wrfin, varname, timeidx, method,
3524 squeeze, cache)
File ~/anaconda3/envs/python_env/lib/python3.10/site-packages/wrf/util.py:3389, in _get_proj_obj(ob_type, var, wrfin, varname, timeidx, method, squeeze, cache, **kwargs)
3385 wrf_proj, geobnds = _get_wrf_proj_geobnds(var, wrfin, varname, timeidx,
3386 method, squeeze, cache)
3388 if ob_type == "cartopy":
-> 3389 proj_obj = wrf_proj.cartopy()
3390 elif ob_type == "basemap":
3391 try:
File ~/anaconda3/envs/python_env/lib/python3.10/site-packages/wrf/projection.py:419, in WrfProj.cartopy(self)
416 if not cartopy_enabled():
417 raise RuntimeError("'cartopy' is not "
418 "installed or is disabled")
--> 419 return self._cartopy()
File ~/anaconda3/envs/python_env/lib/python3.10/site-packages/wrf/projection.py:707, in Mercator._cartopy(self)
704 _cartopy = crs.Mercator(central_longitude=self._stand_lon,
705 globe=self._globe())
706 else:
--> 707 _cartopy = MercatorWithLatTS(central_longitude=self._stand_lon,
708 latitude_true_scale=self._lat_ts,
709 globe=self._globe())
711 return _cartopy
File ~/anaconda3/envs/python_env/lib/python3.10/site-packages/wrf/projection.py:64, in MercatorWithLatTS.init(self, central_longitude, latitude_true_scale, min_latitude, max_latitude, globe)
61 super(crs.Mercator, self).init(proj4_params, globe=globe)
63 # Calculate limits.
---> 64 limits = self.transform_points(
65 crs.Geodetic(),
66 np.array([-180, 180]) + central_longitude,
67 np.array([min_latitude, max_latitude]))
69 # When using a latitude of true scale, the min/max x-limits get set
70 # to the same value, so make sure the left one is negative
71 xlimits = limits[..., 0]
File ~/anaconda3/envs/python_env/lib/python3.10/site-packages/cartopy/crs.py:408, in CRS.transform_points(self, src_crs, x, y, z, trap)
405 x[to_180] = (((x[to_180] + 180) % 360) - 180)
406 try:
407 result[:, 0], result[:, 1], result[:, 2] =
--> 408 _safe_pj_transform(src_crs, self, x, y, z, trap=trap)
409 except ProjError as err:
410 msg = str(err).lower()
File ~/anaconda3/envs/python_env/lib/python3.10/site-packages/cartopy/crs.py:50, in _safe_pj_transform(src_crs, tgt_crs, x, y, z, trap)
49 def _safe_pj_transform(src_crs, tgt_crs, x, y, z=None, trap=True):
---> 50 transformer = _get_transformer_from_crs(src_crs, tgt_crs)
51 transformed_coords = transformer.transform(x, y, z, errcheck=trap)
52 if z is None:
File ~/anaconda3/envs/python_env/lib/python3.10/site-packages/cartopy/crs.py:1673, in Mercator.hash(self)
1672 def hash(self):
-> 1673 return hash((self.proj4_init, self._x_limits, self._y_limits))
AttributeError: 'MercatorWithLatTS' object has no attribute '_x_limits'