25 lines
788 B
Python
25 lines
788 B
Python
import rasterio
|
|
import numpy as np
|
|
import matplotlib.pyplot as plt
|
|
import sys
|
|
|
|
# --- Konfiguration ---
|
|
tif_path = 'geodata/s2_2025.tif'
|
|
|
|
try:
|
|
with rasterio.open(tif_path) as src:
|
|
print(f"Datei: {tif_path}")
|
|
print(f"CRS: {src.crs}")
|
|
print(f"Breite x Höhe: {src.width} x {src.height}")
|
|
print(f"Bänder: {src.count}")
|
|
print(f"Datentyp: {src.dtypes}")
|
|
arr = src.read(1)
|
|
print(f"Min: {np.nanmin(arr)}, Max: {np.nanmax(arr)}")
|
|
plt.imshow(arr, cmap='gray')
|
|
plt.title('Erstes Band der TIFF-Datei')
|
|
plt.axis('off')
|
|
plt.savefig('datenvisualisierung/tif_check.png', bbox_inches='tight', dpi=200)
|
|
plt.show()
|
|
except Exception as e:
|
|
print(f"Fehler beim Laden der TIFF-Datei: {e}")
|
|
sys.exit(1)
|