Skip to content

Commit

Permalink
Touch up exporters.py
Browse files Browse the repository at this point in the history
  • Loading branch information
DimitrisMantas committed Dec 31, 2024
1 parent 88c3fd3 commit 31942a9
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions roofsense/annotation/exporters.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,27 @@
import os
from typing import Any

import numpy as np
import rasterio.plot


def to_png(data: np.ndarray, path: str):
def to_png(
data: np.ndarray[[Any, Any, Any], np.dtype[np.number]],
filepath: str | bytes | os.PathLike,
) -> None:
"""Export the RGB bands of the input raster to a PNG file.
Args:
data:
The input raster. Must contain at least three bands in the RGB configuration.
filepath:
The destination filepath.
Returns:
None
"""
with rasterio.open(
path,
filepath,
mode="w",
count=3,
height=data.shape[1],
Expand Down

0 comments on commit 31942a9

Please sign in to comment.