[R-sig-Geo] runGdal in MODIS package overrides the default in MODISoptions "asIn" pixel size and output a smaller resoultion pixels
Matteo Mattiuzzi
matteo.mattiuzzi at boku.ac.at
Sat Nov 22 20:21:05 CET 2014
Dear Amit,
I just want to correct my previous mail, runGdal uses gdalwarp not gdal_translate!
Matteo
>>> Amit Boshale <amit.boshale at yahoo.com> 11/20/14 11:08 AM >>>
Dear Matteo,
Thank you so much for the quick response :-)
Staying in Sinusoidal projection is a brilliant idea!
I will keep the Sinusoidal projection for the first raster, then convert its projection to WGS84 using QGIS and use it as the extend raster "r" you kindly mentioned. If the gdal did the same resampling, I will simply keep Sinusoidal projection for all and convert using QGIS.
Amit
Matteo Mattiuzzi <matteo.mattiuzzi at boku.ac.at> schrieb am 16:34 Mittwoch, 19.November 2014:
Dear Amit,
if you set pixelSize asIn, the handling of the pixelsize is done by gdal_translate, runGdal in such case does not provide any information about resolution to used 'gdal_translate'.
As your outProj is 4326 you have geographic coordinates, this means that in planar coordinates your grid is not the equal sized within your extent. I don't know how gdal decides about the resolution if no information has provided, and where it fixes the resolution (from source to target file), with where I mean if it is on a corner, in the middle or some mean of all...
To be precise (or little more precise), the MODIS 250 m resolution is 231,xx m and if you want to have more influence about the pixelsize (and you have no other option than using geographic coordinates), you could convert on the location you focus on the target pixelsize to degrees, having at least in a restricted area the resolution you wish. But I suggest you to stay in Sinusoidal projection and decide on it on a later point if needed:
runGdal( job="H12V12", product="MOD13Q1", tileH=12, tileV=12,
begin="2000049", end="2000049", SDSstring="111000000010",
outProj="asIn" ,pixelSize="asIn" )
this does not reproject at all, it simply extracts the hdf SDS to single layer tifs. This because your extent is defined with tileH and tileV and you outProj and pixelSize are asIn.
Or if you have a target raster where you work with in your current project you could also do:
r <- raster('yourrasterfile')
runGdal( job="H12V12", product="MOD13Q1", extent=r,
begin="2000049", end="2000049", SDSstring="111000000010" )
in this case the MODIS data will fit in any sense the r object (resolution, extent and projection)
I hope this helps,
Matteo
>>> Amit Boshale <amit.boshale at yahoo.com> 11/19/14 2:42 PM >>>
Dear MailLister,
I have a problem with runGdal function in MODIS package. At Nadir the resolution should be 250 m. The output of the following code result are NDVI, EVI, composite day of the year and VI quality Tifs (resolution of 150 m)
> library(MODIS)
> runGdal( job="H12V12", product="MOD13Q1", tileH=12, tileV=12, begin="2000049", end="2000049", SDSstring="111000000010", outProj="EPSG:4326 ,pixelSize="asIn" )
How to stop the re-sampling and keep the original 250 m resolution?
Any help is appreciate
Amit
> MODISoptions() All suggested packages are installed STORAGE:
_______________
localArcPath : E:/localArcPath/
outDirPath : E:/outDirPath/ DOWNLOAD:
_______________
MODISserverOrder : LPDAAC, LAADS
dlmethod : auto
stubbornness : high PROCESSING:
_______________
GDAL : GDAL 1.10.1, released 2013/08/26
MRT : Version 4.1 (March 2011)
pixelSize : asIn
outProj : asIn
resamplingType : NN
dataFormat : GTiff DEPENDENCIES:
_______________ NULL
> sessionInfo() R version 3.1.2 (2014-10-31)
Platform: x86_64-w64-mingw32/x64 (64-bit) locale:
[1] LC_COLLATE=German_Germany.1252 LC_CTYPE=German_Germany.1252
[3] LC_MONETARY=German_Germany.1252 LC_NUMERIC=C
[5] LC_TIME=German_Germany.1252 attached base packages:
[1] stats graphics grDevices utils datasets methods base other attached packages:
[1] XML_3.98-1.1 RCurl_1.95-4.3 bitops_1.0-6 rgeos_0.3-8 rgdal_0.9-1
[6] MODIS_0.10-18 raster_2.3-14 sp_1.0-16 loaded via a namespace (and not attached):
[1] grid_3.1.2 lattice_0.20-29 tools_3.1.2
[[alternative HTML version deleted]]
_______________________________________________
R-sig-Geo mailing list
R-sig-Geo at r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
More information about the R-sig-Geo
mailing list