2

In my project, I have hundreds of GeoTIFF files that needed to be converted to .bil files with .hdr (header). They are satellite rainfall data. Can anyone help with a quick method?

3
 import gdal 
 input = r"D:\ESCUELA\ hh.tif"
 out =  "D:\ESCUELA\ prueba.bil"

 gdal.Warp(srcDSOrSrcDSTab = input,
            destNameOrDestDS=out ,
            format= 'EHdr',
            dstSRS= 'EPSG:3795')

just add a loop for all the files in your path

   import gdal
   import os

   path = r'D:\ESCUELA\imgSat8'
   out = 'D:\ESCUELA\prueba'
   bandList = [band for band in os.listdir(path) if band[-4:]=='.TIF']
   iter =range(len(bandList))

   for i in iter:
         gdal.Warp(srcDSOrSrcDSTab = path + '\\'+ bandList[i],
          destNameOrDestDS=out+'\\'+bandList[i][:-4]+'.bil',
          format = 'EHdr',
          dstSRS='EPSG:3795')
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.