I have downloaded 12 raster files (for each month) from sentinel-2 for my study area. And then converted to NDVI(vegetation index). After that I used convert-geotiff (https://github.com/openwfm/convert_geotiff) to convert my raster files to raster binary. I should do this conversion because these data should be placed in WRF model. After I converted the first raster file, tended to convert the second file, however I saw that after the second conversion the tool over writed the first converted binary files, while I need to have binary files in continuous with the first converted binary files.(For example after conversion of the first raster file I should have a,b,c raster binary files, and after the second conversion I should have d,e,f raster binary files. so total files are :a,b,c,d,e,f. But the tool over writes a,b,c files, and I have always a,b,c files). So how can I prevent over writing please?
How to convert several raster files to binary raster using convert-geotiff tool without over writing
-
Rename the files or move them into another directory before running the tool again. Or contact the author and discuss if they are willing to add on option for outputnames. It probably helps if you can sponsor the development.– user30184Commented Feb 25, 2022 at 11:08
-
@user30184 I allocated different names to each file, and by moving them to another directory the issue is still exists! I have contacted the author but he did not help!!!– setiCommented Feb 25, 2022 at 13:23
-
Do you really mean that if you move the the first result files a,b, and c away into another directory and rename them into foo_a, foo_b, and foo_c, the utility still overwrites them?– user30184Commented Feb 25, 2022 at 13:30
-
@user30184 a,b,c was just an example, and the raster binary raster files produced by the tools are so many, and it is not easy to rename them. Inaddition, I need them in continuous order. If I move the fist conversion results to another folder, the tool generates the same names for the second raster files. I need new and continues names.– setiCommented Feb 25, 2022 at 13:42
-
@user30184 I add images to make it more clear. Please have a look at them.– setiCommented Feb 25, 2022 at 13:47
1 Answer
By the documentation https://github.com/openwfm/convert_geotiff is seems that the names of the tiles is important because the tiling schema is based on file names. It is also hard coded that tiles get written into the working directory.
All of the files will be created in the current directory, so it is best to run the program from an empty directory.
What I suggest to do is to create as many empty subdirectories as you have source images. Then change the working directory into one of the subdirectories and run convert_geotiff for the corresponding source image. The source image does not need to be in the working directory. Then you have processed the first image, change into the next sub-directory, and continue. There is no need to move the tiles because they will appear directly into correct subdirectory. The whole process can be made automatic with a simple shell script.