Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Code freeze date: YYYY-MM-DD

### Removed
- `climada.util.earth_engine.py` Google Earth Engine methods did not facilitate direct use of GEE data in CLIMADA. Code was relocated to [climada-snippets](https://github.com/CLIMADA-project/climada-snippets). [#1109](https://github.com/CLIMADA-project/climada_python/pull/1109)
- `doc.climada_util_earth_engine.ipynb` Tutorial about GEE not relevant to CLIMADA Core. Tutorial notebook was relocated to [climada-snippets](https://github.com/CLIMADA-project/climada-snippets).[#1109](https://github.com/CLIMADA-project/climada_python/pull/1109)
- `doc.climada_util_earth_engine.ipynb` Tutorial about GEE not relevant to CLIMADA Core. Tutorial notebook was relocated to [climada-snippets](https://github.com/CLIMADA-project/climada-snippets). [#1109](https://github.com/CLIMADA-project/climada_python/pull/1109)

## 6.1.0

Expand Down Expand Up @@ -158,9 +158,9 @@ Removed:
- `climada.entity.impact_funcs.trop_cyclone.ImpfSetTropCyclone.get_impf_id_regions_per_countries` function [#1034](https://github.com/CLIMADA-project/climada_python/pull/1034)
- `climada.hazard.tc_tracks.BasinBoundsStorm` Enum class `climada.hazard.tc_tracks.subset_by_basin` function [#1031](https://github.com/CLIMADA-project/climada_python/pull/1031)
- `climada.hazard.tc_tracks.TCTracks.subset_years` function [#1023](https://github.com/CLIMADA-project/climada_python/pull/1023)
-`climada.hazard.tc_tracks.compute_track_density` function, `climada.hazard.tc_tracks.compute_genesis_density` function, `climada.hazard.plot.plot_track_density` function
- `climada.hazard.tc_tracks.compute_track_density` function, `climada.hazard.tc_tracks.compute_genesis_density` function, `climada.hazard.plot.plot_track_density` function
[#1003](https://github.com/CLIMADA-project/climada_python/pull/1003)
-`climada.hazard.tc_tracks.TCTracks.from_FAST` function, add Australia basin (AU) [#993](https://github.com/CLIMADA-project/climada_python/pull/993)
- `climada.hazard.tc_tracks.TCTracks.from_FAST` function, add Australia basin (AU) [#993](https://github.com/CLIMADA-project/climada_python/pull/993)
- Add `osm-flex` package to CLIMADA core [#981](https://github.com/CLIMADA-project/climada_python/pull/981)
- `doc.tutorial.climada_entity_Exposures_osm.ipynb` tutorial explaining how to use `osm-flex` with CLIMADA
- `climada.util.coordinates.bounding_box_global` function [#980](https://github.com/CLIMADA-project/climada_python/pull/980)
Expand Down
20 changes: 11 additions & 9 deletions climada/entity/exposures/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -644,15 +644,17 @@ def assign_centroids(

Caution: nearest neighbourg matching can introduce serious artefacts
such as:
- exposure and hazard centroids with shifted grids can lead
to systematically wrong assignements.
- hazard centroids covering larger areas than exposures may lead
to sub-optimal matching if the threshold is too large
- projected crs often diverge at the anti-meridian and close points
on either side will be at a large distance. For proper handling
of the anti-meridian please use degree coordinates in EPSG:4326.
This might be relevant for countries like the Fidji or the US that
cross the anti-meridian.

- exposure and hazard centroids with shifted grids can lead
to systematically wrong assignements.
- hazard centroids covering larger areas than exposures may lead
to sub-optimal matching if the threshold is too large
- projected crs often diverge at the anti-meridian and close points
on either side will be at a large distance. For proper handling
of the anti-meridian please use degree coordinates in EPSG:4326.
This might be relevant for countries like the Fidji or the US that
cross the anti-meridian.


Users are free to implement their own matching alrogithm and save the
matching centroid index in the appropriate column ``centr_[hazard.HAZ_TYPE]``.
Expand Down
13 changes: 8 additions & 5 deletions climada/hazard/tc_tracks.py
Original file line number Diff line number Diff line change
Expand Up @@ -2281,7 +2281,9 @@ def compute_track_density(
wind_min: float = None,
wind_max: float = None,
) -> tuple[np.ndarray, np.ndarray, np.ndarray]:
"""Compute tropical cyclone track density. Before using this function,
"""Compute tropical cyclone track density.

Before using this function,
apply the same temporal resolution to all tracks by calling :py:meth:`equal_timestep` on
the TCTrack object. Due to the computational cost of the this function, it is not
recommended to use a grid resolution higher tha 0.1°. Also note that the time step (in hours)
Expand All @@ -2291,7 +2293,7 @@ def compute_track_density(
it returns the absolute count per bin. To plot the output of this function,
use :py:meth:`plot_track_density`.

Parameters:
Parameters
----------
tc_track: TCTracks object
track object containing a list of all tracks
Expand All @@ -2310,7 +2312,8 @@ def compute_track_density(
wind_max: float (optional), default: None
Maximal wind speed below which to select tracks (exclusive if wind_min is also provided,
otherwise inclusive).
Returns:

Returns
-------
hist_count: np.ndarray
2D matrix containing the absolute count per grid cell of track point.
Expand All @@ -2319,8 +2322,8 @@ def compute_track_density(
lon_bins: np.ndarray
longitude bins in which the point were counted

Example:
--------
Example
-------
>>> tc_tracks = TCTrack.from_ibtracs_netcdf("path_to_file")
>>> tc_tracks.equal_timestep(time_step_h = 1)
>>> hist_count, _, _ = compute_track_density(tc_track = tc_tracks, res = 2)
Expand Down
30 changes: 17 additions & 13 deletions climada/util/coordinates.py
Original file line number Diff line number Diff line change
Expand Up @@ -1136,8 +1136,7 @@ def estimate_matching_threshold(coords_to_assign):


def degree_to_km(degree):
r"""
Convert an angle from degrees to kilometers.
r"""Convert an angle from degrees to kilometers.

This function converts a given angle in degrees to its equivalent distance in
kilometers on the Earth's surface. It assumes a spherical Earth with a constant
Expand All @@ -1160,8 +1159,10 @@ def degree_to_km(degree):
Notes
-----
The conversion is based on the formula:

.. math::
distance = angle_{radians} \\times R

where R is the Earth's radius in km.
Comment thread
spjuhel marked this conversation as resolved.
Outdated

Examples
Expand All @@ -1173,8 +1174,7 @@ def degree_to_km(degree):


def km_to_degree(km):
r"""
Convert a distance from kilometers to degrees.
r"""Convert a distance from kilometers to degrees.

This function converts a given distance in kilometers on the Earth's surface
to its equivalent angle in degrees. It assumes a spherical Earth with a
Expand All @@ -1197,8 +1197,10 @@ def km_to_degree(km):
Notes
-----
The conversion is based on the formula:

.. math::
angle_{radians} = distance / R

where R is the Earth's radius in km.
Comment thread
spjuhel marked this conversation as resolved.
Outdated

Examples
Expand Down Expand Up @@ -1412,15 +1414,17 @@ def match_centroids(

Caution: nearest neighbourg matching can introduce serious artefacts
such as:
- coordinates centroids with shifted grids can lead
to systematically wrong assignements.
- centroids covering larger areas than coordinates may lead
to sub-optimal matching if the threshold is too large
- projected crs often diverge at the anti-meridian and close points
on either side will be at a large distance. For proper handling
of the anti-meridian please use degree coordinates in EPSG:4326.
This might be relevant for countries like the Fidji or the US that
cross the anti-meridian.

- coordinates centroids with shifted grids can lead
to systematically wrong assignements.
- centroids covering larger areas than coordinates may lead
to sub-optimal matching if the threshold is too large
- projected crs often diverge at the anti-meridian and close points
on either side will be at a large distance. For proper handling
of the anti-meridian please use degree coordinates in EPSG:4326.
This might be relevant for countries like the Fidji or the US that
cross the anti-meridian.

"""

try:
Expand Down
24 changes: 8 additions & 16 deletions doc/api/climada/climada.util.rst
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,6 @@ climada\.util\.dwd\_icon\_loader module
:undoc-members:
:show-inheritance:

climada\.util\.earth\_engine module
-----------------------------------

.. automodule:: climada.util.earth_engine
:members:
:undoc-members:
:show-inheritance:

climada\.util\.files\_handler module
------------------------------------

Expand All @@ -97,14 +89,14 @@ climada\.util\.hdf5\_handler module
:undoc-members:
:show-inheritance:

climada\.util\.interpolation module
-----------------------------------
.. automodule:: climada.util.interpolation
:members:
:undoc-members:
:show-inheritance:
climada\.util\.interpolation module
-----------------------------------

.. automodule:: climada.util.interpolation
:members:
:undoc-members:
:show-inheritance:

climada\.util\.lines\_polys\_handler module
-------------------------------------------

Expand Down
1 change: 0 additions & 1 deletion doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
"sphinx_mdinclude",
"myst_nb",
"sphinx_markdown_tables",
"readthedocs_ext.readthedocs",
]

# read the docs version used for links
Expand Down
2 changes: 1 addition & 1 deletion doc/getting-started/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ However, if you want to develop CLIMADA, we strongly recommend you install them.

With the ``climada_env`` activated, enter the workspace directory and then the CLIMADA repository as above.
Then, add the ``test`` extra specification to the ``pip install`` command (**mind the quotation marks**,
and see also `pip install examples <https://pip.pypa.io/en/stable/cli/pip_install/#examples>`_):
and see also `pip install examples <https://pip.pypa.io/en/stable/cli/pip_install/#examples>`_):

.. code-block:: shell

Expand Down
Loading