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

dependency upgrades #682

Merged
merged 10 commits into from
Apr 12, 2023
5 changes: 5 additions & 0 deletions climada/engine/unsequa/unc_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -783,11 +783,16 @@ def plot_sensitivity(self, salib_si='S1', salib_si_conf='S1_conf',

for ax, metric in zip(flat_axes, metric_list):
df_S = self.get_sensitivity(salib_si, [metric]).select_dtypes('number')
if not df_S.columns[df_S.isnull().all()].empty:
LOGGER.warning("All-NaN columns encountered: %s",
list(df_S.columns[df_S.isnull().all()]))
df_S = df_S.loc[:, df_S.notnull().any()]
if df_S.empty:
ax.set_xlabel('Input parameter')
ax.remove()
continue
df_S_conf = self.get_sensitivity(salib_si_conf, [metric]).select_dtypes('number')
df_S_conf = df_S_conf.loc[:, df_S.columns]
if df_S_conf.empty:
df_S.plot(ax=ax, kind='bar', **kwargs)
df_S.plot(ax=ax, kind='bar', yerr=df_S_conf, **kwargs)
Expand Down
3 changes: 2 additions & 1 deletion climada/entity/exposures/litpop/litpop.py
Original file line number Diff line number Diff line change
Expand Up @@ -731,7 +731,8 @@ def _get_litpop_single_polygon(polygon, reference_year, res_arcsec, data_dir,
global_origins=global_origins,
)
except ValueError as err:
if "height must be > 0" in err.args[0] or "width must be > 0" in err.args[0]:
if ("height must be > 0" in str(err) or "width must be > 0" in str(err) # rasterio 1.2
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do not allow rasterio v1.2 anymore, so this case could be removed, right?

or "Invalid dataset dimensions :" in str(err)): # rasterio 1.3
# no grid point within shape after reprojection, None is returned.
if verbose:
LOGGER.info('No data point on destination grid within polygon.')
Expand Down
2 changes: 1 addition & 1 deletion climada/hazard/test/test_tc_tracks.py
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ def test_to_geodataframe_line(self):
split.set_index('sid', inplace=True)
self.assertIsInstance(split.loc['1980052S16155'].geometry, MultiLineString)
self.assertIsInstance(split.loc['2018079S09162'].geometry, LineString)
self.assertEqual(len(split.loc['1980052S16155'].geometry), 8)
self.assertEqual(len(split.loc['1980052S16155'].geometry.geoms), 8)
self.assertFalse(split.loc['2018079S09162'].geometry.is_simple)

nosplit = anti_track.to_geodataframe(split_lines_antimeridian=False)
Expand Down
9 changes: 8 additions & 1 deletion climada/util/coordinates.py
Original file line number Diff line number Diff line change
Expand Up @@ -2639,14 +2639,21 @@ def align_raster_data(source, src_crs, src_transform, dst_crs=None, dst_resoluti
dst_transform, dst_shape = subraster_from_bounds(global_transform, dst_bounds)

destination = np.zeros(dst_shape, dtype=source.dtype)
rasterio.warp.reproject(source=source,
try:
rasterio.warp.reproject(source=source,
destination=destination,
src_transform=src_transform,
src_crs=src_crs,
dst_transform=dst_transform,
dst_crs=dst_crs,
resampling=resampling,
**kwargs)
except Exception as raster_exc:
# rasterio doesn't expose all of their error classes
# in particular: rasterio._err.CPLE_AppDefinedError
# so we transform the exception to something that can be excepted
# e.g. in litpop._get_litpop_single_polygon
raise ValueError(raster_exc) from raster_exc

if conserve == 'mean':
destination *= source.mean() / destination.mean()
Expand Down
66 changes: 33 additions & 33 deletions requirements/env_climada.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,43 +4,43 @@ channels:
- defaults
dependencies:
- bottleneck>=1.3
- cartopy>=0.20.0,<0.20.3 # 0.20.3 has an issue with geographic crs in plots
- cfgrib>=0.9.7,<0.9.10 # 0.9.10 cannot read the icon_grib files from https://opendata.dwd.de
- contextily>=1.0
- dask>=2.25
- gdal!=3.4.1 # has an issue with fiona on Windows (#403)
- geopandas>=0.8
- h5py>=2.10
- haversine>=2.3
- matplotlib>=3.2,<3.6 # 3.6 requires cartopy 0.21 (s. https://github.com/SciTools/cartopy/pull/2054)
- netcdf4>=1.5
- numba>=0.51,!=0.55.0 # 0.55.0 has a bug breaking coverage reports
- openpyxl>=3.0
- pandas-datareader>=0.9
- pathos>=0.2
- pint>=0.15
- cartopy>=0.21
- cfgrib>=0.9.9,<0.9.10 # 0.9.10 cannot read the icon_grib files from https://opendata.dwd.de
- contextily>=1.3
- dask>=2023
- eccodes>=2.27,<2.28 # 2.28 changed some labels, in particular: gust -> i20fg
- gdal>=3.6
- geopandas>=0.12
- h5py>=3.8
- haversine>=2.8
- matplotlib>=3.5
- netcdf4>=1.6
- numba>=0.56
- openpyxl>=3.1
- pandas-datareader>=0.10
- pathos>=0.3
- pint>=0.20
- pip
- proj!=9.0.0 # there are issues with proj 9.0.0 (#381)
- pycountry>=20.7
- proj>=9.1
- pycountry>=22.3
- pyepsg>=0.4
- pytables>=3.6
- pytables>=3.7
- python=3.9
- pyxlsb>=1.0
- rasterio>=1.2.7,<1.3 # 1.3 yields different results for some tests (#512)
- requests>=2.24
- salib>=1.3.0
- scikit-learn>=1.0
- scipy>=1.6
- sparse>=0.13
- statsmodels>=0.11
- tabulate>=0.8
- tqdm>=4.48
- xarray>=0.13
- xlrd>=1.2
- xlsxwriter>=1.3
- rasterio>=1.3
- requests>=2.28
- salib>=1.4
- scikit-learn>=1.2
- scipy>=1.10
- sparse>=0.14
- statsmodels>=0.13
- tabulate>=0.9
- tqdm>=4.65
- xarray>=2023.3
- xlrd>=2.0
- xlsxwriter>=3.0
- xmlrunner>=1.7
- pip:
- deprecation>=2.1
- overpy>=0.4
- peewee>=3.14
- SALib==1.3.12
- overpy>=0.6
- peewee>=3.16
6 changes: 3 additions & 3 deletions requirements/env_developer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ dependencies:
- ipykernel
- mccabe>=0.6
- pandoc
- sphinx>=2.0
- sphinx>=6.1
- pip
- pip:
- coverage>=4.5
- coverage>=7.2
- descartes
- nbformat
- pylint==2.7.1 # 2.7.2 and higher: false positive E1136 and E1137
- readthedocs-sphinx-ext>=2.1
- readthedocs-sphinx-ext>=2.2
- nbsphinx
- myst-parser
- sphinx-markdown-tables
Expand Down