I'm attempting to retile a large Tif files to sizes that can be used for training data in a Neural Network.
I have GDAL installed and the gdal_retile.py (opens as txt file if I type gdal_retile.py into prompt) script saved both in 'C:\User\Downloads' and in my 'C:\User\exampleFolderName\exampleFolderName' paths.
The data is stored as 'test.tif' in a hard drive 'D:/Training_data/testfolder'
The following script works:
import os
os.chdir(r'C:\User\Downloads')
os.system('python gdal_retile.py -ps 2000 2000 -targetDir D:/Training_data/testfolder test.tif')
But this script does not:
import os
os.chdir(r'C:\User\exampleFolderName\exampleFolderName')
os.system('python gdal_retile.py -ps 2000 2000 -targetDir D:/Training_data/testfolder test.tif')
returning error:
'ERROR 4: test.tif: No such file or directory
Error building tile index'
both have the exact same scripts saved in them and they are definetely saved in the correct place, as can be seen if os.system('dir') is run.
Why does it work in one directory and not the other?
edit: gdal command from:Splitting raster into smaller chunks using GDAL?
cd
'ing to that directory and seeing if test.tiff really exists? Are you sure you wanted to go two levels deep? Check if the chdir fails (permissions?)