Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
"""Generate a 3-band, tiled GeoTIFF.

Useful for testing band-interleave without zstd support.
"""

from pathlib import Path

import numpy as np

from rasterio_generated.write_utils import write_cog

HERE = Path(__file__).parent


def generate(output_path: Path) -> None:
"""Generate a 3x128x128 tiled int8 GeoTIFF compression."""
# Create RGB gradient pattern
r = np.linspace(-64, 64, 128, dtype=np.int8)
g = np.full(shape=128, fill_value=64, dtype=np.int8)
b = np.linspace(64, -64, 128, dtype=np.int8)

data = np.stack(
[
np.tile(r, (128, 1)),
np.tile(g.reshape(-1, 1), (1, 128)),
np.tile(b, (128, 1)),
]
)

write_cog(
output_path,
data,
blocksize=64,
interleave="band",
nodata_type="mask",
)
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
```
Driver: GTiff
File: rasterio_generated/fixtures/int8_3band_deflate_block64_band_iterleave.tif
COG: True
Compression: DEFLATE
ColorSpace: None

Profile
Width: 128
Height: 128
Bands: 3
Tiled: True
Dtype: int8
NoData: None
Alpha Band: False
Internal Mask: False
Interleave: BAND
ColorMap: False
ColorInterp: ('gray', 'undefined', 'undefined')
Scales: (1.0, 1.0, 1.0)
Offsets: (0.0, 0.0, 0.0)

Geo
Crs: EPSG:4326
Origin: (0.0, 0.0)
Resolution: (0.01, -0.01)
BoundingBox: (0.0, -1.28, 1.28, 0.0)
MinZoom: 7
MaxZoom: 7

Image Metadata
AREA_OR_POINT: Area

Image Structure
LAYOUT: COG
COMPRESSION: DEFLATE
INTERLEAVE: BAND
OVERVIEW_RESAMPLING: BILINEAR

Band 1
ColorInterp: gray

Band 2
ColorInterp: undefined

Band 3
ColorInterp: undefined

IFD
Id Size BlockSize Decimation
0 128x128 64x64 0
1 64x64 64x64 2
```