fdetsch / MODIS

Download and processing framework for MODIS imagery. The package provides automated access to the global online data archives LP DAAC, LAADS and NSIDC as well as processing capabilities such as file conversion, mosaicking, subsetting and time series.
Other
58 stars 27 forks source link

Added extra numerical argument 'maskValue' to runGdal() which is excl… #41

Closed MagicForrest closed 6 years ago

MagicForrest commented 6 years ago

…uded from the gdalwarp interpolation via the '-srcnodata' argument. Note that if a no data value is already specified then this argument is ignored. Also note that I could only get this working with a single value despite the gdalwarp documentation saying that multiple values are possible.

This modification is extremely useful for me (and I assume others in my position) who just want to whack MODIS data onto raster grids in R using the gdal resample methods. With this, the package really is a one-stop shop for processing MODIS data. So I would be really grateful if you adopted this, especially as it doesn't effect existing behaviour.

I also don't fully understand exactly how the '-srcnodata' argument is created by the unmodified code, I am only assuming it is determined from a No Data value in the input SDS (via the getNa() function?). But I have made sure that if 'srcnodata' is defined, my addition does not overwrite it.

Finally, what would be even more useful would be to allow multiple maskValues, to exclude, for example, water and no fill and the No Data value from the original SDS. But I couldn't get that to work, although someone with more GDAL experience might manage. Or it could probably be done with multiple processing steps.