https://github.com/BostelmannLGLN/LGLN-OpenData-Notebooks/blob/main/requirements.txt
#!pip install -r requirements.txt
from pathlib import Path
import rasterio
from rasterio.plot import show
import matplotlib.pyplot as plt
from IPython.display import Video
import animation, functions
tmp_path = Path('sentinel-2-tmp')
name, be_name, area, tiles = functions.load_tiles(region='NI', use_cos=True)
#name, be_name, area, tiles = functions.load_tiles(region='NI', landkreis='Hannover', use_cos=True)
#tiles.plot(edgecolor='black', figsize=(16, 16))
TODO: Auswahl per Karte
tiles.explore()
selected_tiles = tiles
tile_nrs = ['8-25245768']
name = 'Hameln'
tile_nrs = ['8-25405800']
name = 'Hannover-Limmer'
tile_nrs = ['8-25485800']
name = 'Hannover-Eilenriede'
tile_nrs = ['8-25965736']
name = 'Harz (Okertalsperre)'
tile_nrs = ['8-25885736']
name = 'Clausthal-Zellerfeld'
selected_tiles = tiles[tiles['be8_nr'].isin(tile_nrs)]
selected_tiles
# Datum
date_str = '2021' # e.g. '20' or '2020' or '202009' or '20200921'
# Dateiendung: z.B.: 'TCI_10m' oder '0m'
channel = 'TCI_10m'
bucket = {
'endpoint_url': 'https://cloud.code-de.org:8080/swift/v1/AUTH_622a231224cb46c6982643e55e817c98/',
'name': 'tiles'
}
selected_tiles, dates, tiles_count = functions.available_dates(selected_tiles, date_str, bucket)
dates
logo_path = (Path('./logos/cartohack_logo_left.png'), Path('./logos/logo_right.png'))
#dates = ['20170328','20210330'] # Beispiel Clausthal-Zellerfeld
#dates = ['20160505', '20170719', '20180505', '20190425', '20200419', '20210509'] #Beispiel-Limmer
for tile_nr in selected_tiles.index:
animation_path = animation.animate_tiles_from_cos(tile_nr,
dates,
bucket_credentials=bucket,
tmp_path=tmp_path,
type='mp4',
channel='TCI_10m',
duration=0.4,
add_bar=True,
add_name=True,
center_text='8 km x 8 km ',
logo_path=logo_path,
name=name)
Video(animation_path, html_attributes='loop autoplay')