Skip to content

Commit

Permalink
Merge branch 'develop' into feature/fix_knutson_scaling
Browse files Browse the repository at this point in the history
  • Loading branch information
aleeciu committed Nov 6, 2023
2 parents 034f8d0 + 240dafa commit 8681975
Show file tree
Hide file tree
Showing 9 changed files with 49 additions and 42 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ Code freeze date: YYYY-MM-DD

### Changed

- Update `CONTRIBUTING.md` to better explain types of contributions to this repository [#797](https://github.com/CLIMADA-project/climada_python/pull/797)
- The default tile layer in Exposures maps is not Stamen Terrain anymore, but [CartoDB Positron](https://github.com/CartoDB/basemap-styles). Affected methods are `climada.engine.Impact.plot_basemap_eai_exposure`,`climada.engine.Impact.plot_basemap_impact_exposure` and `climada.entity.Exposures.plot_basemap`. [#798](https://github.com/CLIMADA-project/climada_python/pull/798)

### Fixed

- Fix the dist_approx util function when used with method="geosphere" and log=True and points that are very close. [#792](https://github.com/CLIMADA-project/climada_python/pull/792)
Expand Down
22 changes: 20 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,26 @@
# CLIMADA Contribution Guide

Thank you for contributing to CLIMADA!
We welcome any contribution to CLIMADA and want to express our thanks to everybody who contributes.

## Overview
## What Warrants a Contribution?

Anything!
For orientation, these are some categories of possible contributions we can think of:

* **Technical problems and bugs:** Did you encounter a problem when using CLIMADA? Raise an [issue](https://github.com/CLIMADA-project/climada_python/issues) in our repository, providing a description or ideally a code replicating the error. Did you already find a solution to the problem? Please raise a pull request to help us resolve the issue!
* **Documentation and Tutorial Updates:** Found a typo in the documentation? Is a tutorial lacking some information you find important? Simply fix a line, or add a paragraph. We are happy to incorporate you additions! Please raise a pull request!
* **New Modules and Utility Functions:** Did you create a function or an entire module you find useful for your work? Maybe you are not the only one! Feel free to simply raise a pull request for functions that improve, e.g., plotting or data handling. As an entire module has to be carefully integrated into the framework, it might help if you talk to us first so we can design the module and plan the next steps. You can do that by raising an issue or starting a [discussion](https://github.com/CLIMADA-project/climada_python/discussions) on GitHub.

A good place to start a personal discussion is our monthly CLIMADA developers call.
Please contact the [lead developers](https://wcr.ethz.ch/research/climada.html) if you want to join.

## Why Should You Contribute?

* You will be listed as author of the CLIMADA repository in the [AUTHORS](AUTHORS.md) file.
* You will improve the quality of the CLIMADA software for you and for everybody else using it.
* You will gain insights into scientific software development.

## Minimal Steps to Contribute

Before you start, please have a look at our [Developer Guide][devguide].

Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ Please use the following logo if you are presenting results obtained with or thr

## Contributing

See the [Contribution Guide](CONTRIBUTING.md).
We welcome any contribution to this repository, be it bugfixes and other code changes and additions, documentation improvements, or tutorial updates.

If you would like to contribute, please refer to our [Contribution Guide](CONTRIBUTING.md).

## Versioning

Expand Down
8 changes: 4 additions & 4 deletions climada/engine/impact.py
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,7 @@ def plot_raster_eai_exposure(self, res=None, raster_res=None, save_tiff=None,

def plot_basemap_eai_exposure(self, mask=None, ignore_zero=False, pop_name=True,
buffer=0.0, extend='neither', zoom=10,
url=ctx.providers.Stamen.Terrain,
url=ctx.providers.CartoDB.Positron,
axis=None, **kwargs):
"""Plot basemap expected impact of each exposure within a period of 1/frequency_unit.
Expand All @@ -694,7 +694,7 @@ def plot_basemap_eai_exposure(self, mask=None, ignore_zero=False, pop_name=True,
zoom : int, optional
zoom coefficient used in the satellite image
url : str, optional
image source, e.g. ctx.providers.OpenStreetMap.Mapnik
image source, default: ctx.providers.CartoDB.Positron
axis : matplotlib.axes.Axes, optional
axis to use
kwargs : dict, optional
Expand Down Expand Up @@ -764,7 +764,7 @@ def plot_hexbin_impact_exposure(self, event_id=1, mask=None, ignore_zero=False,

def plot_basemap_impact_exposure(self, event_id=1, mask=None, ignore_zero=False,
pop_name=True, buffer=0.0, extend='neither', zoom=10,
url=ctx.providers.Stamen.Terrain,
url=ctx.providers.CartoDB.Positron,
axis=None, **kwargs):
"""Plot basemap impact of an event at each exposure.
Requires attribute imp_mat.
Expand All @@ -789,7 +789,7 @@ def plot_basemap_impact_exposure(self, event_id=1, mask=None, ignore_zero=False,
zoom : int, optional
zoom coefficient used in the satellite image
url : str, optional
image source, e.g. ctx.providers.OpenStreetMap.Mapnik
image source, default: ctx.providers.CartoDB.Positron
axis : matplotlib.axes.Axes, optional
axis to use
kwargs : dict, optional
Expand Down
4 changes: 2 additions & 2 deletions climada/entity/exposures/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -749,7 +749,7 @@ def plot_raster(self, res=None, raster_res=None, save_tiff=None,

def plot_basemap(self, mask=None, ignore_zero=False, pop_name=True,
buffer=0.0, extend='neither', zoom=10,
url=None, axis=None, **kwargs):
url=ctx.providers.CartoDB.Positron, axis=None, **kwargs):
"""Scatter points over satellite image using contextily
Parameters
Expand All @@ -771,7 +771,7 @@ def plot_basemap(self, mask=None, ignore_zero=False, pop_name=True,
zoom coefficient used in the satellite image
url : Any, optional
image source, e.g., ``ctx.providers.OpenStreetMap.Mapnik``.
Default: ``ctx.providers.Stamen.Terrain``
Default: ``ctx.providers.CartoDB.Positron``
axis : matplotlib.axes._subplots.AxesSubplot, optional
axis to use
kwargs : optional
Expand Down
5 changes: 1 addition & 4 deletions climada/test/test_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,7 @@ def test_ctx_osm_pass(self):
myexp.gdf['value'] = np.array([1, 1, 1])
myexp.check()

try:
myexp.plot_basemap(url=ctx.providers.OpenStreetMap.Mapnik)
except urllib.error.HTTPError:
self.assertEqual(1, 0)
myexp.plot_basemap(url=ctx.providers.OpenStreetMap.Mapnik)

def test_disc_rates(self):
"""Test plot function of discount rates."""
Expand Down
2 changes: 1 addition & 1 deletion climada/util/api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ def _divide_straight_from_multi(properties):
elif isinstance(_v, list):
multis[k] = _v
else:
raise ValueError("properties must be a string or a list of strings")
raise ValueError("the value of a property must be a string or a list of strings")
return straights, multis

@staticmethod
Expand Down
42 changes: 15 additions & 27 deletions doc/tutorial/climada_entity_Exposures.ipynb

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion requirements/env_climada.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,3 @@ dependencies:
- xarray>=2023.8
- xlrd>=2.0
- xlsxwriter>=3.1
- xyzservices=2023.10.0

0 comments on commit 8681975

Please sign in to comment.