dggrid4py 0.4.2__tar.gz → 0.5.0.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.
- {dggrid4py-0.4.2 → dggrid4py-0.5.0.dev0}/PKG-INFO +13 -13
- {dggrid4py-0.4.2 → dggrid4py-0.5.0.dev0}/README.md +11 -10
- {dggrid4py-0.4.2 → dggrid4py-0.5.0.dev0}/dggrid4py/__init__.py +2 -2
- {dggrid4py-0.4.2 → dggrid4py-0.5.0.dev0}/dggrid4py/dggrid_runner.py +906 -563
- {dggrid4py-0.4.2 → dggrid4py-0.5.0.dev0}/pyproject.toml +3 -2
- {dggrid4py-0.4.2 → dggrid4py-0.5.0.dev0}/LICENSE +0 -0
- {dggrid4py-0.4.2 → dggrid4py-0.5.0.dev0}/dggrid4py/igeo7.py +0 -0
- {dggrid4py-0.4.2 → dggrid4py-0.5.0.dev0}/dggrid4py/igeo7_ext.py +0 -0
- {dggrid4py-0.4.2 → dggrid4py-0.5.0.dev0}/dggrid4py/interrupt.py +0 -0
- {dggrid4py-0.4.2 → dggrid4py-0.5.0.dev0}/dggrid4py/tool.py +0 -0
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: dggrid4py
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.5.0.dev0
|
|
4
4
|
Summary: a Python library to run highlevel functions of DGGRIDv7 and v8
|
|
5
5
|
License: AGPL-3.0-or-later
|
|
6
6
|
License-File: LICENSE
|
|
7
7
|
Keywords: python,GIS,DGGS,DGGRID,hexagons,grids,spatial statistics
|
|
8
8
|
Author: Alexander Kmoch
|
|
9
9
|
Author-email: alexander.kmoch@ut.ee
|
|
10
|
-
Requires-Python: >=3.
|
|
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
|
|
@@ -18,7 +18,6 @@ Classifier: Operating System :: POSIX
|
|
|
18
18
|
Classifier: Operating System :: POSIX :: Linux
|
|
19
19
|
Classifier: Operating System :: Unix
|
|
20
20
|
Classifier: Programming Language :: Python :: 3
|
|
21
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
22
21
|
Classifier: Programming Language :: Python :: 3.9
|
|
23
22
|
Classifier: Programming Language :: Python :: 3.10
|
|
24
23
|
Classifier: Programming Language :: Python :: 3.11
|
|
@@ -48,15 +47,15 @@ GNU AFFERO GENERAL PUBLIC LICENSE
|
|
|
48
47
|
- [DGGRID Version 8.3 on GitHub](https://github.com/sahrk/DGGRID)
|
|
49
48
|
- [DGGRID User Manual](https://github.com/sahrk/DGGRID/blob/d08e10d761f7bedd72a253ab1057458f339de51e/dggridManualV81b.pdf)
|
|
50
49
|
|
|
51
|
-
You need the
|
|
50
|
+
You need the `dggrid` tool compiled available on the system.
|
|
52
51
|
|
|
53
|
-
Besides some
|
|
52
|
+
Besides some low-level access influence the dggrid operations' metafile creation, a few high-level functions are integrated to work with the more comfortable geopython libraries, like shapely and geopandas
|
|
54
53
|
|
|
55
54
|
- grid_cell_polygons_for_extent(): fill extent/subset with cells at resolution (clip or world)
|
|
56
55
|
- grid_cell_polygons_from_cellids(): geometry_from_cellid for dggs at resolution (from id list)
|
|
57
56
|
- grid_cellids_for_extent(): get_all_indexes/cell_ids for dggs at resolution (clip or world)
|
|
58
57
|
- cells_for_geo_points(): poly_outline for point/centre at resolution
|
|
59
|
-
- address_transform(): conversion
|
|
58
|
+
- address_transform(): conversion between cell_id address types, like SEQNUM, Z7, or Q2DI
|
|
60
59
|
|
|
61
60
|
|
|
62
61
|
```python
|
|
@@ -66,7 +65,7 @@ import shapely
|
|
|
66
65
|
from dggrid4py import DGGRIDv7
|
|
67
66
|
|
|
68
67
|
|
|
69
|
-
# create an
|
|
68
|
+
# create an initial instance that knows where the dggrid tool lives, configure temp workspace and log/stdout output
|
|
70
69
|
# if you have
|
|
71
70
|
dggrid_instance = DGGRIDv7(executable='<path_to>/dggrid', working_dir='.', capture_logs=False, silent=False, tmp_geo_out_legacy=False, debug=False)
|
|
72
71
|
|
|
@@ -79,10 +78,10 @@ gdf1.to_file('isea4t_5.shp')
|
|
|
79
78
|
gdf_centroids = dggrid_instance.grid_cell_centroids_for_extent(dggs_type='ISEA7H', resolution=4, mixed_aperture_level=None, clip_geom=None)
|
|
80
79
|
|
|
81
80
|
# clip extent
|
|
82
|
-
clip_bound = shapely.geometry.box(20.2,57.00, 28.4,60.0
|
|
81
|
+
clip_bound = shapely.geometry.box(20.2,57.00, 28.4,60.0)
|
|
83
82
|
|
|
84
83
|
# ISEA7H grid at resolution 9, for extent of provided WGS84 rectangle into GeoDataFrame to Shapefile
|
|
85
|
-
gdf3 = dggrid_instance.grid_cell_polygons_for_extent('ISEA7H', 9, clip_geom=
|
|
84
|
+
gdf3 = dggrid_instance.grid_cell_polygons_for_extent('ISEA7H', 9, clip_geom=clip_bound)
|
|
86
85
|
print(gdf3.head())
|
|
87
86
|
gdf3.to_file('grids/est_shape_isea7h_9.shp')
|
|
88
87
|
|
|
@@ -92,6 +91,8 @@ print(df1.head(8))
|
|
|
92
91
|
df1.to_csv('isea7h_8_stats.csv', index=False)
|
|
93
92
|
|
|
94
93
|
# generate the DGGS grid cells that would cover a GeoDataFrame of points, return Polygons with cell IDs as GeoDataFrame
|
|
94
|
+
points = [shapely.Point(20.5, 57.5), shapely.Point(21.0, 58.0)]
|
|
95
|
+
geodf_points_wgs84 = geopandas.GeoDataFrame({'name': ['A', 'B']}, geometry=points, crs='EPSG:4326')
|
|
95
96
|
gdf4 = dggrid_instance.cells_for_geo_points(geodf_points_wgs84, False, 'ISEA7H', 5)
|
|
96
97
|
print(gdf4.head())
|
|
97
98
|
gdf4.to_file('polycells_from_points_isea7h_5.shp')
|
|
@@ -102,7 +103,7 @@ print(gdf5.head())
|
|
|
102
103
|
gdf5.to_file('geopoint_cellids_from_points_isea4h_8.shp')
|
|
103
104
|
|
|
104
105
|
# generate DGGS grid cell polygons based on 'cell_id_list' (a list or np.array of provided cell_ids)
|
|
105
|
-
gdf6 = dggrid_instance.grid_cell_polygons_from_cellids(cell_id_list=[1, 4, 8], 'ISEA7H', 5)
|
|
106
|
+
gdf6 = dggrid_instance.grid_cell_polygons_from_cellids(cell_id_list=[1, 4, 8], dggs_type='ISEA7H', resolution=5)
|
|
106
107
|
print(gdf6.head())
|
|
107
108
|
gdf6.to_file('from_seqnums_isea7h_5.shp')
|
|
108
109
|
|
|
@@ -110,7 +111,7 @@ gdf6.to_file('from_seqnums_isea7h_5.shp')
|
|
|
110
111
|
gdf7 = dggrid_instance.grid_cell_polygons_for_extent('ISEA7H', 3, split_dateline=True)
|
|
111
112
|
gdf7.to_file('global_isea7h_3_interrupted.shp')
|
|
112
113
|
|
|
113
|
-
gdf_z1 = dggrid_instance.grid_cell_polygons_for_extent('IGEO7', 5, clip_geom=
|
|
114
|
+
gdf_z1 = dggrid_instance.grid_cell_polygons_for_extent('IGEO7', 5, clip_geom=clip_bound, output_address_type='Z7_STRING')
|
|
114
115
|
print(gdf_z1.head(3))
|
|
115
116
|
|
|
116
117
|
df_z1 = dggrid_instance.guess_zstr_resolution(gdf_z1['name'].values, 'IGEO7', input_address_type='Z7_STRING')
|
|
@@ -131,7 +132,7 @@ if you don't have a special local distribution of the dggrid-tool or if you didn
|
|
|
131
132
|
|
|
132
133
|
```python
|
|
133
134
|
|
|
134
|
-
from dggrid4py import tool
|
|
135
|
+
from dggrid4py import DGGRIDv7, tool
|
|
135
136
|
|
|
136
137
|
dggrid_exec = tool.get_portable_executable(".")
|
|
137
138
|
dggrid_instance_portable = DGGRIDv7(executable=dggrid_exec, working_dir='.', capture_logs=False, silent=True, has_gdal=False, tmp_geo_out_legacy=True, debug=False)
|
|
@@ -163,4 +164,3 @@ working on an updated conda package. Currently DGGRID v8.3 is available on conda
|
|
|
163
164
|
|
|
164
165
|
Some reading to be excited about: [discourse.pangeo.io](https://discourse.pangeo.io/t/discrete-global-grid-systems-dggs-use-with-pangeo/2274)
|
|
165
166
|
|
|
166
|
-
|
|
@@ -11,15 +11,15 @@ GNU AFFERO GENERAL PUBLIC LICENSE
|
|
|
11
11
|
- [DGGRID Version 8.3 on GitHub](https://github.com/sahrk/DGGRID)
|
|
12
12
|
- [DGGRID User Manual](https://github.com/sahrk/DGGRID/blob/d08e10d761f7bedd72a253ab1057458f339de51e/dggridManualV81b.pdf)
|
|
13
13
|
|
|
14
|
-
You need the
|
|
14
|
+
You need the `dggrid` tool compiled available on the system.
|
|
15
15
|
|
|
16
|
-
Besides some
|
|
16
|
+
Besides some low-level access influence the dggrid operations' metafile creation, a few high-level functions are integrated to work with the more comfortable geopython libraries, like shapely and geopandas
|
|
17
17
|
|
|
18
18
|
- grid_cell_polygons_for_extent(): fill extent/subset with cells at resolution (clip or world)
|
|
19
19
|
- grid_cell_polygons_from_cellids(): geometry_from_cellid for dggs at resolution (from id list)
|
|
20
20
|
- grid_cellids_for_extent(): get_all_indexes/cell_ids for dggs at resolution (clip or world)
|
|
21
21
|
- cells_for_geo_points(): poly_outline for point/centre at resolution
|
|
22
|
-
- address_transform(): conversion
|
|
22
|
+
- address_transform(): conversion between cell_id address types, like SEQNUM, Z7, or Q2DI
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
```python
|
|
@@ -29,7 +29,7 @@ import shapely
|
|
|
29
29
|
from dggrid4py import DGGRIDv7
|
|
30
30
|
|
|
31
31
|
|
|
32
|
-
# create an
|
|
32
|
+
# create an initial instance that knows where the dggrid tool lives, configure temp workspace and log/stdout output
|
|
33
33
|
# if you have
|
|
34
34
|
dggrid_instance = DGGRIDv7(executable='<path_to>/dggrid', working_dir='.', capture_logs=False, silent=False, tmp_geo_out_legacy=False, debug=False)
|
|
35
35
|
|
|
@@ -42,10 +42,10 @@ gdf1.to_file('isea4t_5.shp')
|
|
|
42
42
|
gdf_centroids = dggrid_instance.grid_cell_centroids_for_extent(dggs_type='ISEA7H', resolution=4, mixed_aperture_level=None, clip_geom=None)
|
|
43
43
|
|
|
44
44
|
# clip extent
|
|
45
|
-
clip_bound = shapely.geometry.box(20.2,57.00, 28.4,60.0
|
|
45
|
+
clip_bound = shapely.geometry.box(20.2,57.00, 28.4,60.0)
|
|
46
46
|
|
|
47
47
|
# ISEA7H grid at resolution 9, for extent of provided WGS84 rectangle into GeoDataFrame to Shapefile
|
|
48
|
-
gdf3 = dggrid_instance.grid_cell_polygons_for_extent('ISEA7H', 9, clip_geom=
|
|
48
|
+
gdf3 = dggrid_instance.grid_cell_polygons_for_extent('ISEA7H', 9, clip_geom=clip_bound)
|
|
49
49
|
print(gdf3.head())
|
|
50
50
|
gdf3.to_file('grids/est_shape_isea7h_9.shp')
|
|
51
51
|
|
|
@@ -55,6 +55,8 @@ print(df1.head(8))
|
|
|
55
55
|
df1.to_csv('isea7h_8_stats.csv', index=False)
|
|
56
56
|
|
|
57
57
|
# generate the DGGS grid cells that would cover a GeoDataFrame of points, return Polygons with cell IDs as GeoDataFrame
|
|
58
|
+
points = [shapely.Point(20.5, 57.5), shapely.Point(21.0, 58.0)]
|
|
59
|
+
geodf_points_wgs84 = geopandas.GeoDataFrame({'name': ['A', 'B']}, geometry=points, crs='EPSG:4326')
|
|
58
60
|
gdf4 = dggrid_instance.cells_for_geo_points(geodf_points_wgs84, False, 'ISEA7H', 5)
|
|
59
61
|
print(gdf4.head())
|
|
60
62
|
gdf4.to_file('polycells_from_points_isea7h_5.shp')
|
|
@@ -65,7 +67,7 @@ print(gdf5.head())
|
|
|
65
67
|
gdf5.to_file('geopoint_cellids_from_points_isea4h_8.shp')
|
|
66
68
|
|
|
67
69
|
# generate DGGS grid cell polygons based on 'cell_id_list' (a list or np.array of provided cell_ids)
|
|
68
|
-
gdf6 = dggrid_instance.grid_cell_polygons_from_cellids(cell_id_list=[1, 4, 8], 'ISEA7H', 5)
|
|
70
|
+
gdf6 = dggrid_instance.grid_cell_polygons_from_cellids(cell_id_list=[1, 4, 8], dggs_type='ISEA7H', resolution=5)
|
|
69
71
|
print(gdf6.head())
|
|
70
72
|
gdf6.to_file('from_seqnums_isea7h_5.shp')
|
|
71
73
|
|
|
@@ -73,7 +75,7 @@ gdf6.to_file('from_seqnums_isea7h_5.shp')
|
|
|
73
75
|
gdf7 = dggrid_instance.grid_cell_polygons_for_extent('ISEA7H', 3, split_dateline=True)
|
|
74
76
|
gdf7.to_file('global_isea7h_3_interrupted.shp')
|
|
75
77
|
|
|
76
|
-
gdf_z1 = dggrid_instance.grid_cell_polygons_for_extent('IGEO7', 5, clip_geom=
|
|
78
|
+
gdf_z1 = dggrid_instance.grid_cell_polygons_for_extent('IGEO7', 5, clip_geom=clip_bound, output_address_type='Z7_STRING')
|
|
77
79
|
print(gdf_z1.head(3))
|
|
78
80
|
|
|
79
81
|
df_z1 = dggrid_instance.guess_zstr_resolution(gdf_z1['name'].values, 'IGEO7', input_address_type='Z7_STRING')
|
|
@@ -94,7 +96,7 @@ if you don't have a special local distribution of the dggrid-tool or if you didn
|
|
|
94
96
|
|
|
95
97
|
```python
|
|
96
98
|
|
|
97
|
-
from dggrid4py import tool
|
|
99
|
+
from dggrid4py import DGGRIDv7, tool
|
|
98
100
|
|
|
99
101
|
dggrid_exec = tool.get_portable_executable(".")
|
|
100
102
|
dggrid_instance_portable = DGGRIDv7(executable=dggrid_exec, working_dir='.', capture_logs=False, silent=True, has_gdal=False, tmp_geo_out_legacy=True, debug=False)
|
|
@@ -125,4 +127,3 @@ working on an updated conda package. Currently DGGRID v8.3 is available on conda
|
|
|
125
127
|
## greater context DGGS in Earth Sciences and GIS
|
|
126
128
|
|
|
127
129
|
Some reading to be excited about: [discourse.pangeo.io](https://discourse.pangeo.io/t/discrete-global-grid-systems-dggs-use-with-pangeo/2274)
|
|
128
|
-
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
# Date: 07-12-2022
|
|
9
9
|
#
|
|
10
10
|
|
|
11
|
-
from .dggrid_runner import DGGRIDv7, Dggs, dgselect, dggs_types
|
|
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
14
|
|
|
15
|
-
__version__ = "0.
|
|
15
|
+
__version__ = "0.5.0-dev"
|