Hi,
I am processing 190s HDF files from a Folder (J:\RapidEyr_Atcor\HDF). Here is the example of file name in the HDF Folder:
AtmosCorrected_4549227_2014-12-23_RE1_3A_278182.hdf
AtmosCorrected_4549227_2015-02-15_RE1_3A_278163.hdf
AtmosCorrected_4549227_2015-01-13_RE1_3A_278182.hdf
AtmosCorrected_4549227_2015-03-23_RE1_3A_278102.hdf
Each HDF file contains 13 bands. But I want to extract first 5 bands and convert to TIFF files and save them in a folder. Since 1 have 190 HDF files, I want to create 190 folders in J:\RapidEyr_Atcor\TIFF . Folder name should be like this:
J:\RapidEyr_Atcor\TIF \4549227_2014-12-23_RE1_3A_278182,
J:\RapidEyr_Atcor\TIF \4549227_2015-02-15_RE1_3A_278163
J:\RapidEyr_Atcor\TIF \4549227_2015-01-13_RE1_3A_278182
J:\RapidEyr_Atcor\TIF \4549227_2015-03-23_RE1_3A_278102
Each folder will be contained 5 tiff files. The file names would be:
4549227_2015-02-15_RE1_3A_278163_b1. tif,
4549227_2015-02-15_RE1_3A_278163_b2.tif,
4549227_2015-02-15_RE1_3A_278163_b3.tif,
4549227_2015-02-15_RE1_3A_278163_b4.tif,
4549227_2015-02-15_RE1_3A_278163_b5.tif
Following in ArcPython Script works fine when input HDF files already have been in different sub folders according to the date and tiles. But I have problem to define Folder names and files names in the folder. If someone help me out, then it will be save me a lot of time.
Thanks
Zia
#------------- import arcpy try: arcpy.env.workspace = r"J:\RapidEyr_Atcor\HDF" rasterListA = arcpy.ListRasters() for raster in rasterListA: tifOutA=" M:\\TIF\\"+raster[15:40] arcpy.ExtractSubDataset_management(raster,tifOutA+"_B1"+".tif", "0") arcpy.ExtractSubDataset_management(raster,tifOutA+"_B2"+".tif", "1") arcpy.ExtractSubDataset_management(raster,tifOutA+"_B3"+".tif", "2") arcpy.ExtractSubDataset_management(raster,tifOutA+"_B4"+".tif", "3") arcpy.ExtractSubDataset_management(raster,tifOutA+"_B5"+".tif", "4") except: print "Extract Subdataset example failed." print arcpy.GetMessages()
could you format your code using one of the methods here Code Formatting... the basics++
your indentation is either incorrect or it didn't get carried over during the copy-paste