Skip to content

Commit 0c3c1df

Browse files
update readme
1 parent 58af1b5 commit 0c3c1df

File tree

1 file changed

+74
-7
lines changed

1 file changed

+74
-7
lines changed

README.md

Lines changed: 74 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,29 @@
44

55
Python-based CLI tool to index raster files to DGGS in parallel, writing out to Parquet.
66

7-
Currently only supports H3 DGGS, and probably has other limitations since it has been developed for a specific internal use case, though it is intended as a general-purpose abstraction. Contributions, suggestions, bug reports and strongly worded letters are all welcome.
7+
Currently this supports the H3 and rHEALPix DGGSs. Contributions (particularly for additional DGGSs), suggestions, bug reports and strongly worded letters are all welcome.
88

9-
![Example use case for raster2dggs, showing how an input raster can be indexed at different H3 resolutions, while retaining information in separate, named bands](docs/imgs/raster2dggs-example.png "Example use case for raster2dggs, showing how an input raster can be indexed at different H3 resolutions, while retaining information in separate, named bands")
9+
![Example use case for raster2dggs, showing how an input raster can be indexed at different DGGS resolutions, while retaining information in separate, named bands](docs/imgs/raster2dggs-example.png "Example use case for raster2dggs, showing how an input raster can be indexed at different H3 resolutions, while retaining information in separate, named bands")
1010

1111
## Installation
1212

1313
`pip install raster2dggs`
1414

1515
## Usage
1616

17+
```
18+
raster2dggs --help [17:54:54]
19+
Usage: raster2dggs [OPTIONS] COMMAND [ARGS]...
20+
21+
Options:
22+
--version Show the version and exit.
23+
--help Show this message and exit.
24+
25+
Commands:
26+
h3 Ingest a raster image and index it to the H3 DGGS.
27+
rhp Ingest a raster image and index it to the rHEALPix DGGS.
28+
```
29+
1730
```
1831
raster2dggs h3 --help
1932
@@ -48,8 +61,8 @@ Options:
4861
-t, --threads INTEGER Number of threads to use when running in
4962
parallel. The default is determined based
5063
dynamically as the total number of available
51-
cores, minus one. [default: 7]
52-
-a, --aggfunc [count|mean|sum|prod|std|var|min|max|median]
64+
cores, minus one. [default: 11]
65+
-a, --aggfunc [count|mean|sum|prod|std|var|min|max|median|mode]
5366
Numpy aggregate function to apply when
5467
aggregating cell values after DGGS indexing,
5568
in case of multiple pixels mapping to the
@@ -69,6 +82,10 @@ Options:
6982
is a need to resample. This setting
7083
specifies this resampling algorithm.
7184
[default: average]
85+
--tempdir PATH Temporary data is created during the
86+
execution of this program. This parameter
87+
allows you to control where this data will
88+
be written.
7289
--version Show the version and exit.
7390
--help Show this message and exit.
7491
```
@@ -102,10 +119,56 @@ h3_09
102119
>>> o.h3.h3_to_geo_boundary().to_file('~/Downloads/Sen2_Test_h3-9.gpkg', driver='GPKG')
103120
```
104121

122+
For rHEALPix DGGS output, you can use [`rHP-Pandas`](https://github.com/manaakiwhenua/rHP-Pandas):
123+
124+
```python
125+
>>> import pandas as pd
126+
>>> import rhppandas
127+
>>> o = pd.read_parquet('./tests/data/output/11/Sen2_Test_rhp')
128+
>>> o
129+
band B02 B03 B04 B05 B06 B07 B08 B8A B11 B12
130+
rhp_11
131+
R88723652267 11 31 16 65 191 217 263 274 99 36
132+
R88723652268 11 30 15 66 190 214 258 269 96 34
133+
R88723652276 11 27 17 66 179 203 240 255 98 36
134+
R88723652277 13 30 19 68 179 204 246 260 108 41
135+
R88723652278 12 29 20 66 176 199 243 255 110 43
136+
... ... ... ... ... ... ... ... ... ... ...
137+
R88727068804 22 39 41 81 151 167 182 203 166 84
138+
R88727068805 22 40 42 81 150 166 185 203 167 85
139+
R88727068806 23 41 43 83 156 175 188 211 164 83
140+
R88727068807 23 41 42 82 154 171 186 207 164 83
141+
R88727068808 22 39 43 80 146 163 177 198 165 83
142+
143+
[223104 rows x 10 columns]
144+
>>> o.rhp.rhp_to_geo_boundary().to_file('~/Downloads/Sen2_Test_rhp-11.gpkg', driver='GPKG')
145+
```
146+
105147
## Installation
106148

107-
<!-- TODO: package raster2dggs and make available on PyPI -->
108-
<!-- TODO: package raster2dggs and make available on Conda -->
149+
PyPi:
150+
151+
```bash
152+
pip install raster2dggs
153+
```
154+
155+
Conda environment:
156+
157+
```yaml
158+
name: raster2dggs
159+
channels:
160+
- conda-forge
161+
channel_priority: strict
162+
dependencies:
163+
- python>=3.11,<3.12
164+
- pip=23.1.*
165+
- gdal>=3.8.5
166+
- pyproj=3.6.*
167+
- pip:
168+
- raster2dggs>=0.2.6
169+
```
170+
171+
<!-- TODO: package raster2dggs and make available on Conda without pip -->
109172
110173
### For development
111174
@@ -141,7 +204,11 @@ You may use these for testing. However you can also test with local files too, w
141204
raster2dggs h3 --resolution 11 -d 0 s3://raster2dggs-test-data/Sen2_Test.tif ./tests/data/output/11/Sen2_Test
142205
```
143206

207+
```bash
208+
raster2dggs rhp --resolution 11 -d 0 s3://raster2dggs-test-data/Sen2_Test.tif ./tests/data/output/11/Sen2_Test_rhp
144209
```
210+
211+
```bash
145212
raster2dggs h3 --resolution 13 --compression zstd --resampling nearest -a median -d 1 -u 2 s3://raster2dggs-test-data/TestDEM.tif ./tests/data/output/13/TestDEM
146213
```
147214

@@ -159,6 +226,6 @@ raster2dggs h3 --resolution 13 --compression zstd --resampling nearest -a median
159226

160227
APA/Harvard
161228

162-
> Ardo, J., & Law, R. (2023). raster2dggs (0.2.7) [Computer software]. https://github.com/manaakiwhenua/raster2dggs
229+
> Ardo, J., & Law, R. (2024). raster2dggs (0.2.7) [Computer software]. https://github.com/manaakiwhenua/raster2dggs
163230

164231
[![manaakiwhenua-standards](https://github.com/manaakiwhenua/raster2dggs/workflows/manaakiwhenua-standards/badge.svg)](https://github.com/manaakiwhenua/manaakiwhenua-standards)

0 commit comments

Comments
 (0)