def PrepareInputs(Raster,InputFolder,FolderName): """ ================================================================ PrepareInputs(Raster,InputFolder,FolderName) ================================================================ this function prepare downloaded raster data to have the same align and nodatavalue from a GIS raster (DEM, flow accumulation, flow direction raster) and return a folder with the output rasters with a name "New_Rasters" Inputs: 1-Raster: [String] path to the spatial information source raster to get the spatial information (coordinate system, no of rows & columns) A_path should include the name of the raster and the extension like "data/dem.tif" 2-InputFolder: [String] path of the folder of the rasters you want to adjust their no of rows, columns and resolution (alignment) like raster A the folder should not have any other files except the rasters 3-FolderName: [String] name to create a folder to store resulted rasters Example: Ex1: dem_path="01GIS/inputs/4000/acc4000.tif" prec_in_path="02Precipitation/CHIRPS/Daily/" Inputs.PrepareInputs(dem_path,prec_in_path,"prec") Ex2: dem_path="01GIS/inputs/4000/acc4000.tif" outputpath="00inputs/meteodata/4000/" evap_in_path="03Weather_Data/evap/" Inputs.PrepareInputs(dem_path,evap_in_path,outputpath+"evap") """ # input data validation # data type assert type(FolderName)== str, "FolderName input should be string type" # create a new folder for new created alligned rasters in temp # check if you can create the folder try: os.makedirs(os.path.join(os.environ['TEMP'],"AllignedRasters")) except WindowsError : # if not able to create the folder delete the folder with the same name and create one empty shutil.rmtree(os.path.join(os.environ['TEMP']+"/AllignedRasters")) os.makedirs(os.path.join(os.environ['TEMP'],"AllignedRasters")) temp=os.environ['TEMP']+"/AllignedRasters/" # match alignment GIS.MatchDataAlignment(Raster,InputFolder,temp) # create new folder in the current directory for alligned and nodatavalue matched cells try: os.makedirs(os.path.join(os.getcwd(),FolderName)) except WindowsError: print("please function is trying to create a folder with a name New_Rasters to complete the process if there is a folder with the same name please rename it to other name") # match nodata value GIS.MatchDataNoValuecells(Raster,temp,FolderName+"/") # delete the processing folder from temp shutil.rmtree(temp)