#Config.json file { "input_file": "../data/input_data.npy", "output_dir": "../../pygis/temp", "filename_prefix": "temperature", "crs": "+proj=latlong", "driver": "GTiff" } --------------end of config.json--------------------------------------------------------- # Python script that reads variables from the above config.json file import rasterio from rasterio.transform import Affine import datetime import json import os # Load config from JSON with open("config.json", "r") as f: config = json.load(f) input_file = config["input_file"] output_dir = config["output_dir"] filename_prefix = config["filename_prefix"] driver = config["driver"] # Use timestamp for unique filename timestamp = datetime.datetime.now().strftime("%Y%m%d_%H%M%S") filename = f"{filename_prefix}_{timestamp}.tif" output_file = os.path.join(output_dir, filename) # Read input GeoTIFF with rasterio.open(input_file) as src: Z = src.read(1) # Read first band input_transform = src.transform input_crs = src.crs dtype = src.dtypes[0] height = src.height width = src.width # Use CRS from config if provided, else use input CRS crs = config.get("crs", input_crs) # Write new GeoTIFF with rasterio.open( output_file, mode="w", driver=driver, height=height, width=width, count=1, dtype=dtype, crs=crs, transform=input_transform, ) as dst: dst.write(Z, 1) print(f"Successfully created: {output_file}") ------------------------end of Python Script----------------------------------------------