pyaerocom icon indicating copy to clipboard operation
pyaerocom copied to clipboard

Replacement for the geojsoncontour package needs to be found

Open jgriesfeller opened this issue 2 years ago • 2 comments

The development of the geojsoncontour package has been abandoned. The last commit id from 5 November 2020. According to it's setup.py the last supported Python version is 3.7

We need to find a replacement or fork it (has MIT license)

Used for aeroval's contour plots (maps)

jgriesfeller avatar Dec 04 '23 11:12 jgriesfeller

  • Alternative approach https://github.com/matplotlib/matplotlib/issues/27443#issuecomment-1840542609
  • @AugustinMortier's work around for CAMS2_35b https://gitlab.met.no/cams2_35b/scripts/-/blob/main/pyaeralert/utils.py?ref_type=heads

lewisblake avatar Dec 06 '23 08:12 lewisblake

depends on: metno/pyaro-readers#27

heikoklein avatar Jan 25 '24 14:01 heikoklein

A solution to this issue could be to convert the contours to shapely objects https://gis.stackexchange.com/questions/99917/converting-matplotlib-contour-objects-to-shapely-objects and then use shapely's geojson output https://shapely.readthedocs.io/en/stable/reference/shapely.to_geojson.html

heikoklein avatar Jun 05 '24 08:06 heikoklein

You might want to have a look at the approach I took in the issue quoted in a previous comment. I believe this would be more efficient: it's using contourpy (instead of matplotlib) and shapely. This was written for predefined layers, so the main thing here would be to generate the layers automatically based on range values given for specific parameters.

The contourpy approach was recommended by matplotlib people: https://github.com/matplotlib/matplotlib/issues/27443

AugustinMortier avatar Jun 05 '24 12:06 AugustinMortier

contourpy might be worth a look, but it is a external one-man dependency. In addition, contourpy does not handle colors, so information about colors of the different ranges needs to be added, and conversion to geojson (which is the topic of this issue) is still left to another library shapely.

heikoklein avatar Jun 06 '24 15:06 heikoklein

https://github.com/bartromgens/geojsoncontour/issues/25

lewisblake avatar Jul 01 '24 09:07 lewisblake

@jgriesfeller and I have been added as maintainers for geojsoncontour and can contribute to it's development for this project. A replacement is no longer necessary.

lewisblake avatar Jul 02 '24 09:07 lewisblake