Skip to content
Merged
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
46 changes: 46 additions & 0 deletions rasterio_generated/fixtures/uint16_3band_zstd_predictor2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
"""
Generate a 3-band, tiled, ZSTD compressed GeoTIFF with uint16 dtype, predictor 2, and
band interleave.
"""

from pathlib import Path

import numpy as np
from rasterio.enums import ColorInterp

from rasterio_generated.write_utils import write_cog

HERE = Path(__file__).parent


def generate(output_path: Path) -> None:
"""
Generate a 3x16x16 tiled uint16 GeoTIFF with ZSTD compression, predictor=2 and
band interleave format.
"""
# Create RGB gradient pattern
r = np.linspace(0, 256, 128, dtype=np.uint16)
g = np.full(shape=128, fill_value=128, dtype=np.uint16)
b = np.linspace(256, 0, 128, dtype=np.uint16)

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,
compress="ZSTD",
interleave="band", # planar configuration
colorinterp=[
ColorInterp.red,
ColorInterp.green,
ColorInterp.blue,
],
predictor=2,
)
Binary file not shown.
54 changes: 54 additions & 0 deletions rasterio_generated/fixtures/uint16_3band_zstd_predictor2_info.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
```
Driver: GTiff
File: rasterio_generated/fixtures/uint16_3band_zstd_predictor2.tif
COG: True
Compression: ZSTD
ColorSpace: None

Profile
Width: 128
Height: 128
Bands: 3
Tiled: True
Dtype: uint16
NoData: 0.0
Alpha Band: False
Internal Mask: False
Interleave: BAND
ColorMap: False
ColorInterp: ('red', 'green', 'blue')
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: ZSTD
INTERLEAVE: BAND
OVERVIEW_RESAMPLING: BILINEAR
PREDICTOR: 2

Band 1
ColorInterp: red

Band 2
ColorInterp: green

Band 3
ColorInterp: blue

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