Skip to content

Commit d3fee1c

Browse files
committed
add lerc deflate, lerc zstd, jxl images
1 parent 7d1cecb commit d3fee1c

10 files changed

+215
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
"""Generate a float32 GeoTIFF with LERC compression."""
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 128x128 tiled float32 GeoTIFF with LERC compression."""
14+
data = np.linspace(0.0, 1.0, 128 * 128, dtype=np.float32).reshape(128, 128)
15+
16+
write_cog(
17+
output_path,
18+
data,
19+
blocksize=64,
20+
compress="LERC_DEFLATE",
21+
)
Binary file not shown.
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
```
2+
Driver: GTiff
3+
File: rasterio_generated/fixtures/float32_1band_lerc_deflate_block32.tif
4+
COG: True
5+
Compression: LERC_DEFLATE
6+
ColorSpace: None
7+
8+
Profile
9+
Width: 128
10+
Height: 128
11+
Bands: 1
12+
Tiled: True
13+
Dtype: float32
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: LERC_DEFLATE
37+
LERC_VERSION: 2.4
38+
INTERLEAVE: BAND
39+
OVERVIEW_RESAMPLING: BILINEAR
40+
41+
Band 1
42+
ColorInterp: gray
43+
44+
IFD
45+
Id Size BlockSize Decimation
46+
0 128x128 64x64 0
47+
1 64x64 64x64 2
48+
```
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
"""Generate a float32 GeoTIFF with LERC compression."""
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 128x128 tiled float32 GeoTIFF with LERC compression."""
14+
data = np.linspace(0.0, 1.0, 128 * 128, dtype=np.float32).reshape(128, 128)
15+
16+
write_cog(
17+
output_path,
18+
data,
19+
blocksize=64,
20+
compress="LERC_ZSTD",
21+
)
68.9 KB
Binary file not shown.
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
```
2+
Driver: GTiff
3+
File: rasterio_generated/fixtures/float32_1band_lerc_zstd_block32.tif
4+
COG: True
5+
Compression: LERC_ZSTD
6+
ColorSpace: None
7+
8+
Profile
9+
Width: 128
10+
Height: 128
11+
Bands: 1
12+
Tiled: True
13+
Dtype: float32
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: LERC_ZSTD
37+
LERC_VERSION: 2.4
38+
INTERLEAVE: BAND
39+
OVERVIEW_RESAMPLING: BILINEAR
40+
41+
Band 1
42+
ColorInterp: gray
43+
44+
IFD
45+
Id Size BlockSize Decimation
46+
0 128x128 64x64 0
47+
1 64x64 64x64 2
48+
```
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="JXL",
22+
nodata=0,
23+
)
1.33 KB
Binary file not shown.
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
```
2+
Driver: GTiff
3+
File: rasterio_generated/fixtures/uint8_1band_jxl_block64.tif
4+
COG: True
5+
Compression: JXL
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: JXL
37+
INTERLEAVE: BAND
38+
OVERVIEW_RESAMPLING: BILINEAR
39+
COMPRESSION_REVERSIBILITY: LOSSLESS
40+
JXL_EFFORT: 5
41+
42+
Band 1
43+
ColorInterp: gray
44+
45+
IFD
46+
Id Size BlockSize Decimation
47+
0 128x128 64x64 0
48+
1 64x64 64x64 2
49+
```

rasterio_generated/write_utils.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ def write_cog(
3232
"LERC_DEFLATE",
3333
"LERC_ZSTD",
3434
"LZMA",
35+
"PACKBITS",
36+
"CCITTRLE",
37+
"CCITTFAX3",
38+
"CCITTFAX4",
39+
"JXL",
3540
]
3641
| None = None,
3742
interleave: Literal["pixel", "band", "tile"] = "pixel",

0 commit comments

Comments
 (0)