dggrid4py 0.5.0.dev0__tar.gz → 0.5.1.dev0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,37 +1,30 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dggrid4py
3
- Version: 0.5.0.dev0
3
+ Version: 0.5.1.dev0
4
4
  Summary: a Python library to run highlevel functions of DGGRIDv7 and v8
5
- License: AGPL-3.0-or-later
5
+ License-Expression: AGPL-3.0-or-later
6
6
  License-File: LICENSE
7
- Keywords: python,GIS,DGGS,DGGRID,hexagons,grids,spatial statistics
7
+ Keywords: python,GIS,DGGS,DGGRID,hexagons,grids,spatial statistics,IGEO7
8
8
  Author: Alexander Kmoch
9
9
  Author-email: alexander.kmoch@ut.ee
10
- Requires-Python: >=3.9,<4.0.0
10
+ Requires-Python: >=3.9, <4.0.0
11
11
  Classifier: Development Status :: 5 - Production/Stable
12
12
  Classifier: Environment :: Console
13
13
  Classifier: Intended Audience :: Education
14
14
  Classifier: Intended Audience :: Science/Research
15
15
  Classifier: License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)
16
+ Classifier: Programming Language :: Python :: 3
16
17
  Classifier: Operating System :: MacOS :: MacOS X
17
18
  Classifier: Operating System :: POSIX
18
- Classifier: Operating System :: POSIX :: Linux
19
19
  Classifier: Operating System :: Unix
20
- Classifier: Programming Language :: Python :: 3
21
- Classifier: Programming Language :: Python :: 3.9
22
- Classifier: Programming Language :: Python :: 3.10
23
- Classifier: Programming Language :: Python :: 3.11
24
- Classifier: Programming Language :: Python :: 3.12
25
- Classifier: Programming Language :: Python :: 3.13
26
- Classifier: Programming Language :: Python :: 3.14
20
+ Classifier: Operating System :: POSIX :: Linux
27
21
  Classifier: Topic :: Scientific/Engineering :: GIS
28
22
  Requires-Dist: fiona (>=1.8.0,<2.0.0)
29
23
  Requires-Dist: geopandas (>=0.9.0,<=1.1.0)
30
24
  Requires-Dist: numpy (>=1.22.0,<=2.3.0)
31
25
  Requires-Dist: pandas (>=1.4.0,<2.4.0)
26
+ Requires-Dist: pygeodesy (==25.10.10)
32
27
  Requires-Dist: shapely (>=1.8.0,<=2.1.0)
33
- Project-URL: Homepage, https://github.com/allixender/dggrid4py
34
- Project-URL: Repository, https://github.com/allixender/dggrid4py
35
28
  Description-Content-Type: text/markdown
36
29
 
37
30
  # dggrid4py - a Python library to run highlevel functions of DGGRID
@@ -11,5 +11,6 @@
11
11
  from .dggrid_runner import DGGRIDv7, DGGRIDv8, Dggs, dgselect, dggs_types
12
12
  import dggrid4py.igeo7 as igeo7
13
13
  import dggrid4py.tool as tool
14
+ from .auxlat import geoseries_to_authalic, geoseries_to_geodetic, geodetic_to_authalic, authalic_to_geodetic
14
15
 
15
- __version__ = "0.5.0-dev"
16
+ __version__ = "0.5.1-dev"
@@ -0,0 +1,37 @@
1
+ from pygeodesy.ellipsoids import Ellipsoids
2
+ from shapely.geometry import Point, Polygon
3
+
4
+ wgs84 = Ellipsoids.WGS84
5
+
6
+ def authalic_to_geodetic(lat_authalic):
7
+ return wgs84.auxAuthalic(lat_authalic, inverse=True)
8
+
9
+ def geodetic_to_authalic(lat_geodetic):
10
+ return wgs84.auxAuthalic(lat_geodetic, inverse=False)
11
+
12
+ def _apply_to_simple_shapely_polygon(polygon, func):
13
+ # cannot be a complex polygon, e.g. with holes, just a simple one like the hexagons or bbox
14
+ # multigeometries should be treated separately
15
+ # it is assumed that coordinates are in lat/lon (either on authalic sphere or ellipsoid/wgs84)
16
+ return Polygon([ (lon, func(lat)) for (lon, lat) in polygon.exterior.coords])
17
+
18
+ def _apply_to_shapely_point(point, func):
19
+ # points is a list of shapely Point objects
20
+ return Point(point.x, func(point.y))
21
+
22
+ def _apply_to_shapely_points(points, func):
23
+ # points is a list of shapely Point objects
24
+ return [ Point(point.x, func(point.y)) for point in points]
25
+
26
+
27
+ def geoseries_to_authalic(geoseries):
28
+ # geoseries is a geopandas GeoSeries of shapely geometries
29
+ return geoseries.apply(lambda geom: geom if geom.is_empty else
30
+ (_apply_to_shapely_point(geom, geodetic_to_authalic) if isinstance(geom, Point) else
31
+ _apply_to_simple_shapely_polygon(geom, geodetic_to_authalic)))
32
+
33
+ def geoseries_to_geodetic(geoseries):
34
+ # geoseries is a geopandas GeoSeries of shapely geometries
35
+ return geoseries.apply(lambda geom: geom if geom.is_empty else
36
+ (_apply_to_shapely_point(geom, authalic_to_geodetic) if isinstance(geom, Point) else
37
+ _apply_to_simple_shapely_polygon(geom, authalic_to_geodetic)))
@@ -26,7 +26,7 @@ def download_executable(url, folder="./"):
26
26
  # Return the absolute path
27
27
  return os.path.abspath(local_path)
28
28
 
29
-
29
+ # TODO: could be cache checked
30
30
  def get_portable_executable(folder="./"):
31
31
  import platform
32
32
 
@@ -1,15 +1,18 @@
1
- [tool.poetry]
1
+ [project]
2
2
  name = "dggrid4py"
3
- version = "0.5.0-dev"
3
+ version = "0.5.1-dev"
4
4
  description = "a Python library to run highlevel functions of DGGRIDv7 and v8"
5
- authors = ["Alexander Kmoch <alexander.kmoch@ut.ee>",
6
- "Wai Tik Chan <wai.tik.chan@ut.ee>",
7
- "Luís Moreira de Sousa <luis.de.sousa@protonmail.ch>"]
5
+ authors = [
6
+ { name = "Alexander Kmoch", email = "alexander.kmoch@ut.ee" },
7
+ { name = "Wai Tik Chan", email = "wai.tik.chan@ut.ee>" },
8
+ { name = "Luís Moreira de Sousa", email = "luis.de.sousa@protonmail.ch" },
9
+ { name = "Francis Charette-Migneault", email = "francis.charette-migneault@crim.ca" }
10
+ ]
8
11
  license = "AGPL-3.0-or-later"
9
12
  readme = "README.md"
10
13
  repository = "https://github.com/allixender/dggrid4py"
11
14
  homepage = "https://github.com/allixender/dggrid4py"
12
- keywords = ["python", "GIS", "DGGS", "DGGRID", "hexagons", "grids", "spatial statistics"]
15
+ keywords = ["python", "GIS", "DGGS", "DGGRID", "hexagons", "grids", "spatial statistics", "IGEO7"]
13
16
  classifiers = [
14
17
  "Development Status :: 5 - Production/Stable",
15
18
  "Environment :: Console",
@@ -32,6 +35,7 @@ pandas = ">=1.4.0, <2.4.0"
32
35
  fiona = ">=1.8.0, <2.0.0"
33
36
  shapely = ">=1.8.0, <=2.1.0"
34
37
  geopandas = ">=0.9.0, <=1.1.0"
38
+ pygeodesy = "25.10.10"
35
39
 
36
40
 
37
41
  [tool.poetry.group.dev.dependencies]
File without changes
File without changes