Skip to content

Commit 7d1cecb

Browse files
authored
Basic LZMA example (#20)
1 parent 87b3772 commit 7d1cecb

File tree

3 files changed

+70
-0
lines changed

3 files changed

+70
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
"""Generate a basic uint8 GeoTIFF."""
2+
3+
from pathlib import Path
4+
5+
import numpy as np
6+
7+
from rasterio_generated.write_utils import write_cog
8+
9+
HERE = Path(__file__).parent
10+
11+
12+
def generate(output_path: Path) -> None:
13+
"""Generate a basic 256x256 uint8 GeoTIFF wdith gradient pattern."""
14+
data = np.arange(128, dtype=np.uint8).reshape(1, 128)
15+
data = np.repeat(data, 128, axis=0)
16+
17+
write_cog(
18+
output_path,
19+
data,
20+
blocksize=64,
21+
compress="LZMA",
22+
nodata=0,
23+
)
1.36 KB
Binary file not shown.
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
```
2+
Driver: GTiff
3+
File: rasterio_generated/fixtures/uint8_1band_lzma_block64.tif
4+
COG: True
5+
Compression: LZMA
6+
ColorSpace: None
7+
8+
Profile
9+
Width: 128
10+
Height: 128
11+
Bands: 1
12+
Tiled: True
13+
Dtype: uint8
14+
NoData: 0.0
15+
Alpha Band: False
16+
Internal Mask: False
17+
Interleave: BAND
18+
ColorMap: False
19+
ColorInterp: ('gray',)
20+
Scales: (1.0,)
21+
Offsets: (0.0,)
22+
23+
Geo
24+
Crs: EPSG:4326
25+
Origin: (0.0, 0.0)
26+
Resolution: (0.01, -0.01)
27+
BoundingBox: (0.0, -1.28, 1.28, 0.0)
28+
MinZoom: 7
29+
MaxZoom: 7
30+
31+
Image Metadata
32+
AREA_OR_POINT: Area
33+
34+
Image Structure
35+
LAYOUT: COG
36+
COMPRESSION: LZMA
37+
INTERLEAVE: BAND
38+
OVERVIEW_RESAMPLING: BILINEAR
39+
40+
Band 1
41+
ColorInterp: gray
42+
43+
IFD
44+
Id Size BlockSize Decimation
45+
0 128x128 64x64 0
46+
1 64x64 64x64 2
47+
```

0 commit comments

Comments
 (0)