I am using pymodis to reproject and mosaic the datasets using MRT. I have successfully reprojected the data using pymodis package as below :
list_modis=glob.glob('*.hdf')
for i in range(0,len(list_modis)):
name=parameter_file(INPUT_folder,list_modis[i],left_x,right_x,top_y,bottom_y)
x=pymodis.convertmodis.convertModis(list_modis[i],'param.prm','C:\\MRT\\')
x.run()
This works perfectly well, but when I am using Create Mosaic I got problem. Please suggest me where I have made mistake.
y=pymodis.convertmodis.createMosaic('mosaicinput.txt','mosaic','C:\\MRT\\')
y.run()
Mosaicinput.txt has following files:
MOD15A2.A2001025.h27v08.005.2006356072429.hdf MOD15A2.A2001025.h27v09.005.2006356181328.hdf MOD15A2.A2001025.h28v08.005.2006356073508.hdf MOD15A2.A2001025.h28v09.005.2006356075256.hdf
When I run this code, I got the following error :
Traceback (most recent call last): File "C:\Users\Jaya_HOME\Desktop\WEB DHM Toolbox\script\modis_mosaic.py", line 125, in y.run() File "C:\Python27\ArcGIS10.1\lib\site-packages\pymodis\convertmodis.py", line 177, in run self.write_mosaic_xml() File "C:\Python27\ArcGIS10.1\lib\site-packages\pymodis\convertmodis.py", line 156, in write_mosaic_xml pmm = parseModisMulti(listHDF) File "C:\Python27\ArcGIS10.1\lib\site-packages\pymodis\parsemodis.py", line 555, in __init__ self.parModis.append(parseModis(i)) File "C:\Python27\ArcGIS10.1\lib\site-packages\pymodis\parsemodis.py", line 64, in __init__ raise IOError('{name} does not exist'.format(name=filename)) IOError: MOD15A2.A2001025.h27v08.005.2006356072429.hdf MOD15A2.A2001025.h27v09.005.2006356181328.hdf MOD15A2.A2001025.h28v08.005.2006356073508.hdf MOD15A2.A2001025.h28v09.005.2006356075256.hdf does not exist
This is the syntax of this module :
class pymodis.convertmodis.createMosaic(listfile, outprefix, mrtpath, subset=False)[source] A class to convert several MODIS tiles into a mosaic Parameters: listfile (str) – the path to file with the list of HDF MODIS file outprefix (str) – the prefix for output files mrtpath (str) – the full path to mrt directory which contains the bin and data directories subset (str) – a string composed by 1 and 0 according with the layer to mosaic. The string should something like ‘1 0 1 0 0 0 0’