4

I'm using gdalwarp to convert MODIS NDVI mosaics from Sinusoidal to epsg:4326. To save space I'm using VRT files until I reach the final product. Here is my workflow.

  1. Mosaic NDVI Modis tiles using pyModis and output as VRT. NoData value (-3000) is kept
  2. gdalwarp the VRT mosaic to epsg:4326, tiff output. Pixels with NoData recieve value 0

My gdalwarp command is:

gdalwarp -t_srs epsg:4326 -tr 0.002 0.002 modis_mosaic.vrt reprojetc_mosaic.tif

Gdalinfo on the reprojected file shows that NoData values are kept (-3000) but nodata pixels in the image are converted to 0. I'm using gdal 1.11.1 in Ubuntu linux

2

Doing some more searching I found out that a bug related to gdalwarp and NODATA was fixed in version 1.11.2.

http://trac.osgeo.org/gdal/wiki/Release/1.11.2-News

http://trac.osgeo.org/gdal/ticket/5675

Testing on another machine with gdal 1.11.2 worked.

1

Strangely, it look's like gdalwarp is missing the input vrt NoData declaration (well somehow still it declares it in output tiff...).

Which is a bit odd since you said that in step 1. the NoData value is kept. Check if element <NoDataValue>-3000</NoDataValue> exist for each band of your VRT dataset.

Beside above isue, you can try to force gdalwarp to use -3000 as NoData val with -srcnodata and -dstnodata parameters:

gdalwarp -t_srs epsg:4326 -tr 0.002 0.002 -srcnodata -3000 -dstnodata -3000 modis_mosaic.vrt reprojetc_mosaic.tif

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.