I have downloaded numerous hdf files from an ftp site. Let's say I already have 500 hdf files, 250Half of them were level 1 hdf files and the rest were level 2. The level 1Lvl1 format is: A2001031505000 Afile.L1A_LACA1_AC.sample.hdf and the levellvl 2 format is: A2001017054000Afile.L2_LACA1_AC.sample.hdf
As what you will observe they differ in this part L1A_LAC, L2_LAC. Now, howHow will I do a batch process in projecting all the level 2 hdflevel2 files only? How will I filter these files and create a new directory for the filtered files?
Any help will be appreciated.
Thanks!
C:\User\Desktop\sample>projected\sample>project.bat
C:\User\Desktop\sample>set\sample>set in_path=D:\path\to\file
C:\User\Desktop\sample>set\sample>set out_path=D:\newfolder
C:\User\Desktop\sample>md\sample>md D:\newfolder
A subdirectory or file D:\newfolder already exists.
C:\User\Desktop\sample>cd\sample>cd D:\path\to\file
C:\User\Desktop\sample>FORFILES\sample>FORFILES /m *L2_LAC**A1_AC*.hdf /C "cmd /c gdalwarp -geoloc -t_srs "+proj=longlat +datum=WGS84" -te 113.205 1.120 157.105 2.005 @path D:\[email protected]"
ERROR: Invalid argument/option - '+datum=WGS84 -te 113.205 1.120 157.105 2.005 @path D:\[email protected]'.
Type "FORFILES /?" for usage.
C:\User\Desktop\sample>projected\sample>project.bat
C:\User\Desktop\sample>set\sample>set in_path=D:\path\to\file
C:\User\Desktop\sample>set\sample>set out_path=D:\newfolder
C:\User\Desktop\sample>md\sample>md D:\newfolder
C:\User\Desktop\sample>cd\sample>cd D:\path\to\file
C:\User\Desktop\sample>FORFILES\sample>FORFILES /m *L2_LAC**A1_AC*.hdf /C "cmd /c gdalwarp -geoloc -t_srs "+proj=longlat +datum=WGS84" -te 113.205 1.120 157.105 2.005 @path D:\[email protected]"
ERROR: Files of type "*L2_LAC*"*A1_AC*.hdf" not found.
C:\User\Desktop\sample>projected\sample>projected.bat
C:\User\Desktop\sample>set\sample>set in_path=D:\path\to\file
C:\User\Desktop\sample>set\sample>set out_path=D:\newfolder
C:\User\Desktop\sample>md\sample>md D:\newfolder
C:\User\Desktop\sample>cd\sample>cd /d D:\path\to\file
C:\User\Desktop\sample>FORFILES\sample>FORFILES /m *L2_LAC**A1_AC*.hdf /C "cmd /c gdalwarp -geoloc -t_srs "+proj=longlat +datum=WGS84" -te 113.205 1.120 157.105 2.005 @path D:\newfolder/@fname.tif"
ERROR 1: Translating source or target SRS failed:
'+proj=longlat
C:\User\Desktop\sample>gdalwarp\sample>gdalwarp -geoloc -t_srs "+proj=longlat +datum=WGS84" -te 113.205 1.120 157.105 2.005 HDF4_SDS:hdf:"A2001017054000"Afile.L2_LACA1_AC.sample.hdf":01 sample.tif
Creating output file that is 1941P x 1670L.
Processing input file HDF4_SDS:hdf:"A2001017054000"Afile.L2_LACA1_AC.sample.hdf":01.
0...10...20...30...40...50...60...70...80...90...100 - done.