Datasets:
Download scripts/get_data_metadata.py from paeslemesa/matchgeodem: direct link, hf CLI and curl.
- Browser
- Download file 1.16 kB
-
https://huggingface.co/datasets/paeslemesa/matchgeodem/resolve/5b000df8836b57cd3104eb7d1cd52d951f7450f4/scripts/get_data_metadata.py
- Command line
-
hf download hf://datasets/paeslemesa/matchgeodem@5b000df8836b57cd3104eb7d1cd52d951f7450f4/scripts/get_data_metadata.py
-
curl -L -o get_data_metadata.py https://huggingface.co/datasets/paeslemesa/matchgeodem/resolve/5b000df8836b57cd3104eb7d1cd52d951f7450f4/scripts/get_data_metadata.py
1.16 kB
| #%% | |
| from pathlib import Path | |
| import rasterio | |
| path = Path("/home/sabrina/Documents/Tese/05_Dataset/MatchGeo-DEM-v1") | |
| cities = {'ATA_MV', 'BRA_SP', 'CHN_WS', 'ESP_EH' ,'FIN_LM', 'GER_BN' ,'IDN_SV', 'KAZ_AC', 'KSA_WA' ,'NAM_HF' ,'NZL_KP' ,'PHL_TA', 'USA_GC'} | |
| print("===============================================\nEPSG") | |
| # 1. Get EPSG and WKT for all cities | |
| for city in {'ATA_MV', 'BRA_SP', 'CHN_WS', 'ESP_EH' ,'FIN_LM', 'GER_BN' ,'IDN_SV', 'KAZ_AC', 'KSA_WA' ,'NAM_HF' ,'NZL_KP' ,'PHL_TA', 'USA_GC'}: | |
| with rasterio.open(str(path) + f"/{city}/{city}.tif") as src: | |
| print( f"{city}: {src.crs}") | |
| #%% | |
| print("===============================================\nNumber of Tiles") | |
| # 2. Count tiles per city | |
| for city in cities: | |
| tile_path = Path(path, f"{city}/tiles") | |
| ntiles = list(tile_path.glob("*.tif")) | |
| print(f"{city} : {len(ntiles)}") | |
| #%% | |
| print("===============================================\nBounding Box") | |
| # 3. Get bounding box from GeoJSON | |
| for city in cities: | |
| with rasterio.open(Path(path, f"{city}/{city}.tif")) as src: | |
| profile = src.profile | |
| bounds = src.bounds | |
| print(f"{city} : {bounds}") | |
| # %% | |