CLIMADA-project / climada_python

Python (3.8+) version of CLIMADA
GNU General Public License v3.0
321 stars 125 forks source link

Assign region id has difficulties at the coast line #825

Open chahank opened 11 months ago

chahank commented 11 months ago

The method to assign country codes to coordinates, util.coordinates.get_country_code does not work well close to the coastline. This is probably due to the use of cultural boundary maps from Natural Earth. Despite using the 10m resolution maps, coastlines seem rough. This is important because the method does 1. mask out all points not on land 2. assign country ids. Thus, points that are incorrectly set in the water will have the id 0 for water.

This is particularly not surprising, but we might be able to improve upon it. This issue is to document this and allow room for discussion. Maybe one could improve by combining different maps from natural earth (such as coastlines + small islands with boundary lines (countries with sea territory)). Or by using another service if needed (e.g. a google earth API?)

Here are two examples for which the method util.coordinates.get_country_code would assign 0 as country id to the points (i.e., not in country but in water/ocean):

Screenshot 2023-12-07 at 10 51 09 Screenshot 2023-12-07 at 10 51 43 Screenshot 2023-12-07 at 10 53 18 Screenshot 2023-12-07 at 10 53 00
peanutfun commented 11 months ago

Thanks for the thorough report! It seems like the Natural Earth data resolution is too coarse for this kind of application.

By the way, I just realized that "10m" does not stand for "10 meters" but a 1:10 million map resolution. Not sure if I was the only one who assumed that 😅 The Natural Earth website states "Show the world on a large wall poster." for the 1:10m resolution. If I understand correctly, these maps are really meant for showing large-scale, global features. I might make sense to look for another data provider when determining the "on land" property of coordinates, as you suggest.

chahank commented 11 months ago

Oh, thanks, that makes so much more sense!

peanutfun commented 9 months ago

The ArcGIS World Countries feature layer might be a useful source. But the arcgis Python plugin is not available for osx-arm64 platforms (yet?)

spjuhel commented 7 months ago

Could this https://github.com/thampiman/reverse-geocoder be useful?

chahank commented 7 months ago

That looks indeed very nice! And only two dependencies that we already have. However, it is unclear whether it remains maintained or not.