I experienced unexpected behaviour of rasterio and I couldn't understand yet where is my mistake.
I have opened rasterio TIFF, did some manipulations on it as numpy array and then export it as TIFF using rasterio.open and dst.write.
The problem is that the saving fails many times due to the name I give to the TIFF.
This is how I tried to do this:
src=#original tiff with metadata numpy_res=#the array of the results after the analysis tiff_name='results/test7/2021-01-10/246/534514d2a593107sat31ecnvy4u0e1694k/results.tiff' with rasterio.open(tiff_name, 'w', driver='GTiff', height=numpy_res.shape, width=numpy_res.shape, count=1, dtype=numpy_res.dtype, crs=src.crs, nodata=None, # change if data has nodata value transform=src.transform) as dst: dst.write(numpy_res, 1)
this is fails with next error :
RasterioIOError: Attempt to create new tiff file 'results/test7/2021-01-10/246/534514d2a593107sat31ecnvy4u0e1694k/results.tiff' failed: No such file or directory
now , I have to say that I do have folder called results, which is empty folder tha suppose to save the resulted array.
I have also try to change result to another name of folder that is not exists yet but that didn't work.
The weird thing is that if I give it simple name without the directory, such as:
it does work, but then it does not save it to the folder I want. Also, if I write the directory as shwn in the docomentrt, the:
it does not throw any error, though it also does not create new folder 'tmp' and the result cannot be found.
My end goal is to be able to save the results into the folder I specify.