This is my first post, I hope I don't screw it up. We have about 400 MODIS HDF4 files we are looking to batch process in the ArcGIS 10 or Python environment. The tools we are looking to use are Extract Subdataset (HDF4 files have subdatasets and we are only interested in one of them, which its index number is 1), ProjectRaster(to UTM 11 NAD 83), convert HDF4 files to TIFF (although I believe this can be done when executing the Extract Subdataset tool as it lets you choose an output file format), Int (we need the raster file to have an attribute table with pixel values). I've tried performing these tasks in modelbuilder in batch mode but i've had no success in properly setting it up.
We are interested in both the ModelBuilder and Python approach.
It would be great if someone can post some batch processing code that would apply to these tools.
Answer
Sounds do-able. I would suggest looking at the docs, specifically the sections on listing data and the tools you need to use, such as the Extract Subdataset tool - there are lots of samples in both of those sections to get you going. If I understand the issue properly, you need to get a list of the rasters, then iterate through that list, processing as you go: Extract Subdataset (save as tiff) -> Project -> Convert to int (you could use Map Algebra to do that).
EDIT: To change the filename, use some slicing to get only the name without the extension:
arcpy.ExtractSubDataset_management(hdf,"U:\\temp\\hdf\\subdataset_files\\" + hdf[:4] + ".tif", "0")
No comments:
Post a Comment