rastr 0.1.0__py3-none-any.whl → 0.3.0__py3-none-any.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 rastr might be problematic. Click here for more details.
- rastr/_version.py +16 -3
- rastr/arr/fill.py +9 -2
- rastr/create.py +155 -35
- rastr/gis/fishnet.py +13 -4
- rastr/gis/smooth.py +7 -4
- rastr/io.py +68 -3
- rastr/meta.py +49 -10
- rastr/raster.py +256 -66
- rastr-0.3.0.dist-info/METADATA +138 -0
- rastr-0.3.0.dist-info/RECORD +15 -0
- rastr-0.1.0.dist-info/METADATA +0 -44
- rastr-0.1.0.dist-info/RECORD +0 -15
- {rastr-0.1.0.dist-info → rastr-0.3.0.dist-info}/WHEEL +0 -0
- {rastr-0.1.0.dist-info → rastr-0.3.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: rastr
|
|
3
|
+
Version: 0.3.0
|
|
4
|
+
Summary: Geospatial Raster datatype library for Python.
|
|
5
|
+
Project-URL: Source Code, https://github.com/tonkintaylor/rastr
|
|
6
|
+
Project-URL: Bug Tracker, https://github.com/tonkintaylor/rastr/issues
|
|
7
|
+
Project-URL: Releases, https://github.com/tonkintaylor/rastr/releases
|
|
8
|
+
Project-URL: Source Archive, https://github.com/tonkintaylor/rastr/archive/46f802e7abd275eff61c73c5edc147d92966c886.zip
|
|
9
|
+
Author-email: Tonkin & Taylor Limited <Sub-DisciplineData+AnalyticsStaff@tonkintaylor.co.nz>, Nathan McDougall <nmcdougall@tonkintaylor.co.nz>, Ben Karl <bkarl@tonkintaylor.co.nz>
|
|
10
|
+
License-Expression: MIT
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
17
|
+
Requires-Python: >=3.10
|
|
18
|
+
Requires-Dist: affine>=2.4.0
|
|
19
|
+
Requires-Dist: branca>=0.8.1
|
|
20
|
+
Requires-Dist: folium>=0.20.0
|
|
21
|
+
Requires-Dist: geopandas>=1.1.1
|
|
22
|
+
Requires-Dist: matplotlib>=3.10.5
|
|
23
|
+
Requires-Dist: numpy>=2.2.6
|
|
24
|
+
Requires-Dist: pandas>=2.3.1
|
|
25
|
+
Requires-Dist: pydantic>=2.11.7
|
|
26
|
+
Requires-Dist: pyproj>=3.7.1
|
|
27
|
+
Requires-Dist: rasterio>=1.4.3
|
|
28
|
+
Requires-Dist: scikit-image>=0.25.2
|
|
29
|
+
Requires-Dist: scipy>=1.15.3
|
|
30
|
+
Requires-Dist: shapely>=2.1.1
|
|
31
|
+
Requires-Dist: tqdm>=4.67.1
|
|
32
|
+
Requires-Dist: typing-extensions>=4.14.1
|
|
33
|
+
Description-Content-Type: text/markdown
|
|
34
|
+
|
|
35
|
+
<h1 align="center">
|
|
36
|
+
<img src="https://raw.githubusercontent.com/tonkintaylor/rastr/refs/heads/develop/docs/logo.svg"><br>
|
|
37
|
+
</h1>
|
|
38
|
+
|
|
39
|
+
# rastr
|
|
40
|
+
|
|
41
|
+
[](<https://pypi.python.org/pypi/rastr>)
|
|
42
|
+
[](https://github.com/astral-sh/uv)
|
|
43
|
+
[](https://github.com/astral-sh/ruff)
|
|
44
|
+
[](https://github.com/usethis-python/usethis-python)
|
|
45
|
+
|
|
46
|
+
A lightweight geospatial raster datatype library for Python focused on simplicity.
|
|
47
|
+
|
|
48
|
+
## Overview
|
|
49
|
+
|
|
50
|
+
`rastr` provides an intuitive interface for creating, reading, manipulating, and exporting geospatial raster data in Python.
|
|
51
|
+
|
|
52
|
+
### Features
|
|
53
|
+
|
|
54
|
+
- 🧮 **Complete raster arithmetic**: Full support for mathematical operations (`+`, `-`, `*`, `/`) between rasters and scalars.
|
|
55
|
+
- 📊 **Flexible visualization**: Built-in plotting with matplotlib and interactive mapping with folium.
|
|
56
|
+
- 🗺️ **Geospatial analysis tools**: Contour generation, Gaussian blurring, and spatial sampling.
|
|
57
|
+
- 🛠️ **Data manipulation**: Fill NaN values, extrapolate missing data, and resample to different resolutions.
|
|
58
|
+
- 🔗 **Seamless integration**: Works with GeoPandas, rasterio, and the broader Python geospatial ecosystem.
|
|
59
|
+
- ↔️ **Vector-to-raster workflows**: Convert GeoDataFrame polygons, points, and lines to raster format.
|
|
60
|
+
|
|
61
|
+
## Installation
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
# With uv
|
|
65
|
+
uv add rastr
|
|
66
|
+
|
|
67
|
+
# With pip
|
|
68
|
+
pip install rastr
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Quick Start
|
|
72
|
+
|
|
73
|
+
```python
|
|
74
|
+
from pyproj.crs.crs import CRS
|
|
75
|
+
from rasterio.transform import from_origin
|
|
76
|
+
from rastr.create import full_raster
|
|
77
|
+
from rastr.meta import RasterMeta
|
|
78
|
+
from rastr.raster import RasterModel
|
|
79
|
+
|
|
80
|
+
# Create an example raster
|
|
81
|
+
raster = RasterModel.example()
|
|
82
|
+
|
|
83
|
+
# Basic arithmetic operations
|
|
84
|
+
doubled = raster * 2
|
|
85
|
+
summed = raster + 10
|
|
86
|
+
combined = raster + doubled
|
|
87
|
+
|
|
88
|
+
# Create full rasters with specified values
|
|
89
|
+
cell_size = 1.0
|
|
90
|
+
empty_raster = full_raster(
|
|
91
|
+
RasterMeta(
|
|
92
|
+
cell_size=cell_size,
|
|
93
|
+
crs=CRS.from_epsg(2193),
|
|
94
|
+
transform=from_origin(0, 100, cell_size, cell_size),
|
|
95
|
+
),
|
|
96
|
+
bounds=(0, 0, 100, 100),
|
|
97
|
+
fill_value=0.0,
|
|
98
|
+
)
|
|
99
|
+
|
|
100
|
+
# Visualize the data
|
|
101
|
+
ax = raster.plot(cbar_label="Values")
|
|
102
|
+
|
|
103
|
+
# Interactive web mapping (requires folium)
|
|
104
|
+
m = raster.explore(opacity=0.8, colormap="plasma")
|
|
105
|
+
|
|
106
|
+
# Sample values at specific coordinates
|
|
107
|
+
xy_points = [(100.0, 200.0), (150.0, 250.0)]
|
|
108
|
+
values = raster.sample(xy_points)
|
|
109
|
+
|
|
110
|
+
# Generate contour lines
|
|
111
|
+
contours = raster.contour(levels=[0.1, 0.5, 0.9], smoothing=True)
|
|
112
|
+
|
|
113
|
+
# Apply spatial operations
|
|
114
|
+
blurred = raster.blur(sigma=2.0) # Gaussian blur
|
|
115
|
+
filled = raster.extrapolate(method="nearest") # Fill NaN values via nearest-neighbours
|
|
116
|
+
resampled = raster.resample(new_cell_size=0.5) # Change resolution
|
|
117
|
+
|
|
118
|
+
# Export to file
|
|
119
|
+
raster.to_file("output.tif")
|
|
120
|
+
|
|
121
|
+
# Convert to GeoDataFrame for vector analysis
|
|
122
|
+
gdf = raster.as_geodataframe(name="elevation")
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## Limitations
|
|
126
|
+
|
|
127
|
+
Current version limitations:
|
|
128
|
+
|
|
129
|
+
- Only Single-band rasters are supported.
|
|
130
|
+
- In-memory processing only (streaming support planned).
|
|
131
|
+
- Square cells only (rectangular cell support planned).
|
|
132
|
+
- Only float dtypes (integer support planned).
|
|
133
|
+
|
|
134
|
+
### Contributing
|
|
135
|
+
|
|
136
|
+
See the
|
|
137
|
+
[CONTRIBUTING.md](https://github.com/usethis-python/usethis-python/blob/main/CONTRIBUTING.md)
|
|
138
|
+
file.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
rastr/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
rastr/_version.py,sha256=5zTqm8rgXsWYBpB2M3Zw_K1D-aV8wP7NsBLrmMKkrAQ,704
|
|
3
|
+
rastr/create.py,sha256=6aHpRFRXmpXzuzTt-SxY_BfVc7dXKCBLCArb7DjUrsM,13494
|
|
4
|
+
rastr/io.py,sha256=RgkiV_emOPjTFeI2a1aCBtfWwrSLH0XmP8rx9tu6PAI,2952
|
|
5
|
+
rastr/meta.py,sha256=5iDvGkYe8iMMkPV6gSL04jNcLRhuRNFqe9AppUpp55E,2928
|
|
6
|
+
rastr/raster.py,sha256=iHN8L91HW-cpDexZYgDnLaOw-N6KktQpXIusvUEiL0o,29931
|
|
7
|
+
rastr/arr/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
8
|
+
rastr/arr/fill.py,sha256=80ucb36el9s042fDSwK1SZJhp_GNJNMM0fpQTWmJvgE,1001
|
|
9
|
+
rastr/gis/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
10
|
+
rastr/gis/fishnet.py,sha256=Ic-0HV61ST8OxwhyoMyV_ybihs2xuhgAY-3n4CknAt8,2670
|
|
11
|
+
rastr/gis/smooth.py,sha256=3HQDQHQM5_LeNk21R8Eb8VpF727JcXq21HO9JMvcpW4,4810
|
|
12
|
+
rastr-0.3.0.dist-info/METADATA,sha256=pr4zdjI5FPlVynm2W09ErYddJ0Nmvx9wICWzBH2IpNI,4953
|
|
13
|
+
rastr-0.3.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
14
|
+
rastr-0.3.0.dist-info/licenses/LICENSE,sha256=7qUsx93G2ATTRLZiSYuQofwAX_uWvrqnAiMK8PzxvNc,1080
|
|
15
|
+
rastr-0.3.0.dist-info/RECORD,,
|
rastr-0.1.0.dist-info/METADATA
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: rastr
|
|
3
|
-
Version: 0.1.0
|
|
4
|
-
Summary: Geospatial Raster datatype library for Python.
|
|
5
|
-
Project-URL: Source Code, https://github.com/tonkintaylor/rastr
|
|
6
|
-
Project-URL: Bug Tracker, https://github.com/tonkintaylor/rastr/issues
|
|
7
|
-
Project-URL: Releases, https://github.com/tonkintaylor/rastr/releases
|
|
8
|
-
Project-URL: Source Archive, https://github.com/tonkintaylor/rastr/archive/ac9cfaefef4030485d30ce79b97a000821338bd2.zip
|
|
9
|
-
Author-email: Tonkin & Taylor Limited <Sub-DisciplineData+AnalyticsStaff@tonkintaylor.co.nz>, Nathan McDougall <nmcdougall@tonkintaylor.co.nz>
|
|
10
|
-
License-Expression: MIT
|
|
11
|
-
License-File: LICENSE
|
|
12
|
-
Classifier: Programming Language :: Python :: 3 :: Only
|
|
13
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
14
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
-
Classifier: Programming Language :: Python :: 3.13
|
|
17
|
-
Requires-Python: >=3.10
|
|
18
|
-
Requires-Dist: affine>=2.4.0
|
|
19
|
-
Requires-Dist: folium>=0.20.0
|
|
20
|
-
Requires-Dist: geopandas>=1.1.1
|
|
21
|
-
Requires-Dist: matplotlib>=3.10.5
|
|
22
|
-
Requires-Dist: numpy>=2.2.6
|
|
23
|
-
Requires-Dist: pandas>=2.3.1
|
|
24
|
-
Requires-Dist: pydantic>=2.11.7
|
|
25
|
-
Requires-Dist: pyproj>=3.7.1
|
|
26
|
-
Requires-Dist: rasterio>=1.4.3
|
|
27
|
-
Requires-Dist: scikit-image>=0.25.2
|
|
28
|
-
Requires-Dist: scipy>=1.15.3
|
|
29
|
-
Requires-Dist: shapely>=2.1.1
|
|
30
|
-
Requires-Dist: tqdm>=4.67.1
|
|
31
|
-
Requires-Dist: typing-extensions>=4.14.1
|
|
32
|
-
Requires-Dist: xyzservices>=2025.4.0
|
|
33
|
-
Description-Content-Type: text/markdown
|
|
34
|
-
|
|
35
|
-
# Rastr
|
|
36
|
-
|
|
37
|
-
[](<https://pypi.python.org/pypi/rastr>)
|
|
38
|
-
[](https://github.com/astral-sh/uv)
|
|
39
|
-
[](https://github.com/astral-sh/ruff)
|
|
40
|
-
[](https://github.com/usethis-python/usethis-python)
|
|
41
|
-
|
|
42
|
-
Geospatial Raster datatype library for Python.
|
|
43
|
-
|
|
44
|
-
Currently, only single-banded rasters with square cells are supported.
|
rastr-0.1.0.dist-info/RECORD
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
rastr/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
rastr/_version.py,sha256=-LyU5F1uZDjn6Q8_Z6-_FJt_8RE4Kq9zcKdg1abSSps,511
|
|
3
|
-
rastr/create.py,sha256=tHLVnGarMt04p1z8CVknMWMjQLKrb0WrcP_Wgdw8xr4,9346
|
|
4
|
-
rastr/io.py,sha256=GLj2o26L2bLLXys2wTSKk1mM-FRDciOt7Ty7r87gVg4,961
|
|
5
|
-
rastr/meta.py,sha256=b_knC8a5qWcAZKm8RrZ7bYTLuOtfGQsIp73JMcq8cU0,1384
|
|
6
|
-
rastr/raster.py,sha256=PzmMLJqf6nhYNu81dqLJ9iZpkxOBrn02FtI-5o3meL4,22996
|
|
7
|
-
rastr/arr/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
8
|
-
rastr/arr/fill.py,sha256=7N3ECMli7ssNJJk5qgDoj_3xExgu03nohGPgUKWxcCk,903
|
|
9
|
-
rastr/gis/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
10
|
-
rastr/gis/fishnet.py,sha256=LZqtI9cgYPacuWNfIfdbTkRMRSnJCQdYlaT2eVPmorM,2459
|
|
11
|
-
rastr/gis/smooth.py,sha256=LbWvAG1O-O5H6P5LrbwD03mbnXVYjkH1re-_iZ4arIU,4754
|
|
12
|
-
rastr-0.1.0.dist-info/METADATA,sha256=IKTH8nVmhO3FRMTHWKk0zpdxt5kxw5giusz-7perakI,2143
|
|
13
|
-
rastr-0.1.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
14
|
-
rastr-0.1.0.dist-info/licenses/LICENSE,sha256=7qUsx93G2ATTRLZiSYuQofwAX_uWvrqnAiMK8PzxvNc,1080
|
|
15
|
-
rastr-0.1.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|