rusterize 0.1.1__cp310-abi3-macosx_11_0_arm64.whl → 0.2.0__cp310-abi3-macosx_11_0_arm64.whl

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.

Potentially problematic release.


This version of rusterize might be problematic. Click here for more details.

Binary file
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rusterize
3
- Version: 0.1.1
3
+ Version: 0.2.0
4
4
  Classifier: License :: OSI Approved :: MIT License
5
5
  Classifier: Operating System :: OS Independent
6
6
  Classifier: Programming Language :: Rust
@@ -22,13 +22,10 @@ Project-URL: repository, https://github.com/ttrotto/rusterize
22
22
  # rusterize
23
23
 
24
24
  High performance rasterization tool for Python built in Rust. This
25
- repository is heavily based on the [fasterize](https://github.com/ecohealthalliance/fasterize.git) package built in C++
26
- for R. This version ports it to Python with a Rust backend, with some useful improvements.
25
+ repository stems from the [fasterize](https://github.com/ecohealthalliance/fasterize.git) package built in C++
26
+ for R and ports parts of the logics into Python with a Rust backend, in addition to some useful improvements.
27
27
 
28
- Functionally, it takes an input [geopandas](https://geopandas.org/en/stable/)
29
- dataframes and returns a [xarray](https://docs.xarray.dev/en/stable/). It
30
- tighly mirrors the processing routine of fasterize, so it works only on
31
- (multi)polygon geometries at the moment.
28
+ **rusterize** is designed to work on *(multi)polygons* and *(multi)linestrings*. Functionally, it takes an input [geopandas](https://geopandas.org/en/stable/) dataframe and returns a [xarray](https://docs.xarray.dev/en/stable/).
32
29
 
33
30
  # Installation
34
31
 
@@ -68,7 +65,7 @@ This function has a simple API:
68
65
  ``` python
69
66
  from rusterize.core import rusterize
70
67
 
71
- # gdf = <import datasets as needed>
68
+ # gdf = <import/modify dataframe as needed>
72
69
 
73
70
  # rusterize
74
71
  rusterize(gdf,
@@ -87,7 +84,7 @@ rusterize(gdf,
87
84
  - `extent`: tuple of (xmin, ymin, xmax, ymax) for desired output extent
88
85
  - `field`: field to rasterize. Default is None (a value of `1` is rasterized).
89
86
  - `by`: column to rasterize. Assigns each group to a band in the
90
- stack. Values are taken from `field`. Default is None
87
+ stack. Values are taken from `field`. Default is None (singleband raster)
91
88
  - `fun`: pixel function to use when multiple values overlap. Default is
92
89
  `last`. Available options are `sum`, `first`, `last`, `min`, `max`, `count`, or `any`
93
90
  - `background`: background value in final raster. Default is None (NaN)
@@ -111,17 +108,18 @@ from shapely import wkt
111
108
  import matplotlib.pyplot as plt
112
109
 
113
110
  # example from fasterize
114
- polygons = [
111
+ geoms = [
115
112
  "POLYGON ((-180 -20, -140 55, 10 0, -140 -60, -180 -20), (-150 -20, -100 -10, -110 20, -150 -20))",
116
113
  "POLYGON ((-10 0, 140 60, 160 0, 140 -55, -10 0))",
117
- "POLYGON ((-125 0, 0 60, 40 5, 15 -45, -125 0))"
114
+ "POLYGON ((-125 0, 0 60, 40 5, 15 -45, -125 0))",
115
+ "MULTILINESTRING ((-180 -70, -140 -50), (-140 -50, -100 -70), (-100 -70, -60 -50), (-60 -50, -20 -70), (-20 -70, 20 -50), (20 -50, 60 -70), (60 -70, 100 -50), (100 -50, 140 -70), (140 -70, 180 -50))"
118
116
  ]
119
117
 
120
118
  # Convert WKT strings to Shapely geometries
121
- geometries = [wkt.loads(polygon) for polygon in polygons]
119
+ geometries = [wkt.loads(geom) for geom in geoms]
122
120
 
123
121
  # Create a GeoDataFrame
124
- gdf = gpd.GeoDataFrame({'value': range(1, len(polygons) + 1)}, geometry=geometries, crs='EPSG:32619')
122
+ gdf = gpd.GeoDataFrame({'value': range(1, len(geoms) + 1)}, geometry=geometries, crs='EPSG:32619')
125
123
 
126
124
  # rusterize
127
125
  output = rusterize(
@@ -230,14 +228,16 @@ Unit: seconds
230
228
  fasterize 62.12409 72.13832 74.53424 75.12375 77.72899 84.77415 20
231
229
  ```
232
230
 
231
+ In terms of (multi)line rasterization speed, here's a benchmark against `gdal_rasterize` using a layer from the province of Quebec, Canada, representing water courses for a total of ~4.5 million multilinestrings.
232
+
233
233
  # Comparison with other tools
234
234
 
235
- While `rusterize` is fast, there are other very fast solutions out there, including:
235
+ While **rusterize** is fast, there are other fast alternatives out there, including:
236
236
  - `GDAL`
237
237
  - `rasterio`
238
238
  - `geocube`
239
239
 
240
- However, `rusterize` allows for a seamless, Rust-native processing with similar or lower memory footprint that doesn't require you to leave Python, and returns the geoinformation you need for downstream processing.
240
+ However, **rusterize** allows for a seamless, Rust-native processing with similar or lower memory footprint that doesn't require you to leave Python, and returns the geoinformation you need for downstream processing with ample control over resolution, shape, and extent.
241
241
 
242
242
  The following is a time comparison run on a dataset with 340K+ geometries, rasterized at 2m resolution.
243
243
  ```
@@ -0,0 +1,7 @@
1
+ rusterize-0.2.0.dist-info/METADATA,sha256=m_0TCBYklNLCwsmLrN1Cd1lWP-zdxFikhL-HvxvsdL8,9035
2
+ rusterize-0.2.0.dist-info/WHEEL,sha256=WcVLymwUFXZZBOS7GhUoID5qvQcDPxnkUAYBKypRBtM,103
3
+ rusterize-0.2.0.dist-info/licenses/LICENSE,sha256=v-2DqBji_azGEWFDxBhw-CNIRu8450vBbloLx6UNqLU,1108
4
+ rusterize/__init__.py,sha256=OymrFdgWCN3VMuSM3oXoGKeagAd-5ayPsYyXnQ_HsDE,101
5
+ rusterize/core.py,sha256=9nsqL-v5Bw5DezS_kpnDx1eQHooJr6zK1TpWSKxJT94,4574
6
+ rusterize/rusterize.abi3.so,sha256=0d_KAWkiCN07KpjNUXObVsLVDDE4libsCEhqt2QnLPI,30890080
7
+ rusterize-0.2.0.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: maturin (1.8.2)
2
+ Generator: maturin (1.8.3)
3
3
  Root-Is-Purelib: false
4
4
  Tag: cp310-abi3-macosx_11_0_arm64
@@ -1,7 +0,0 @@
1
- rusterize-0.1.1.dist-info/METADATA,sha256=82TdiZEs_ruMJ_uAl_Spc_yKByUCVbK6f8BWSEJPMgU,8570
2
- rusterize-0.1.1.dist-info/WHEEL,sha256=j3ku1HwtRttgdyoybPiqmsz03FP6lDUkPQNFM63xZJo,103
3
- rusterize-0.1.1.dist-info/licenses/LICENSE,sha256=v-2DqBji_azGEWFDxBhw-CNIRu8450vBbloLx6UNqLU,1108
4
- rusterize/__init__.py,sha256=OymrFdgWCN3VMuSM3oXoGKeagAd-5ayPsYyXnQ_HsDE,101
5
- rusterize/core.py,sha256=9nsqL-v5Bw5DezS_kpnDx1eQHooJr6zK1TpWSKxJT94,4574
6
- rusterize/rusterize.abi3.so,sha256=RKMy-Y42SWYc2V7z0TuBd9U6Z2b58KunsvVs7Rmq3-s,30825760
7
- rusterize-0.1.1.dist-info/RECORD,,