[gdal-dev] again .hdf to .tif

Vincent Schut schut at sarvision.nl
Thu Mar 26 11:25:05 EDT 2009


Yann Chemin wrote:
> Hi there,
>
> I am using this one right now on Level 2 and 3 MODIS products
>
> -------------------------------------------
> #!/bin/bash
> mkdir processed
> for file in *.hdf
> do SDS_list=$(gdalinfo $file | grep "SUBDATASET_.*_NAME.*")
> 	for subdataset in $SDS_list
> 	do echo ${subdataset#*=} > tempfile.txt
> 	out=$(sed 's/\(.*\):\(.*\):"\(.*\).A\(.*\)\.\h\(.*\)\.\(.*\)\.\(.*\).hdf":\(.*\):\(.*\)/\3\_\4\_h\5\_\8\_\9\.tif/'
> tempfile.txt)
> 	gdalwarp -of GTiff -t_srs EPSG:4326 ${subdataset#*=} processed/$out
> 	done
> done
> -------------------------------------
>
> maybe of help,
> Yann
>
>   
Note that, when you are using modis sinusoidal projected hdf products, 
you might have to use something like this to prevent a shift in the y 
direction which becomes more pronounced when further from the equator:

gdalwarp -s_srs '+proj=sinu +R=6371007.181 +nadgrids=@null +wktext' 
-t_srs EPSG:4326 <hdf> <out.tif>

to force gdalwarp to adjust for the custom ellipsoid that the modis 
sinusoidal projection uses. Or, at least, I had to some time ago. It 
might have been 'fixed' already.

Regards,
Vincent.
> 2009/3/26 Anja Roesel <anja.roesel at zmaw.de>:
>   
>> sorry i forgot to mention the error message:
>>     
>>> Segmentation fault
>>>       
>>
>>
>>
>> Hi list,
>>
>> I am trying to convert MODIS .hdf files to .tif files (it worked with
>> ASTER files earlier, thats why I am now really curious).
>>
>> i typed
>>
>>     
>>> gdalinfo MOD021KM.A2008134.1935.005.2009071201911.hdf
>>>       
>> result:
>> ......
>> SUBDATASET_1_NAME=HDF4_EOS:EOS_SWATH:"MOD021KM.A2008134.1935.005.2009071201911.hdf":MODIS_SWATH_Type_L1B:EV_1KM_RefSB
>> SUBDATASET_1_DESC=[15x2030x1354] EV_1KM_RefSB (16-bit unsigned integer)
>> SUBDATASET_2_NAME=HDF4_EOS:EOS_SWATH:"MOD021KM.A2008134.1935.005.2009071201911.hdf":MODIS_SWATH_Type_L1B:EV_1KM_RefSB_Uncert_Indexes
>> SUBDATASET_2_DESC=
>> ........
>>
>> then:
>>
>>     
>>> gdalwarp
>>>       
>> HDF4_EOS:EOS_SWATH:"MOD021KM.A2008134.1935.005.2009071201911.hdf":MODIS_SWATH_Type_L1B:EV_1KM_RefSB
>>  modis.tif
>>
>> Have you any ideas, what is the problem?
>> Thanks,
>> Anja
>>
>> _______________________________________________
>> gdal-dev mailing list
>> gdal-dev at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>>
>>     
>
>
>
>   



More information about the gdal-dev mailing list