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

Issues using runGdal #35

Closed PMoreno92 closed 6 years ago

PMoreno92 commented 6 years ago

Good morning Matt,

I am a beginner using the MODIS package and data. I have been trying to use runGdal to download and transform some MODIS data into geoTIFFs files. I did install OSGeo4W and the path is well set, but I did not install MRT as I was not planning to use it.

I have been trying to download the code using:

getProduct("MOD13A3")
getCollection("MOD13A3", forceCheck = TRUE)
tfs = runGdal("MOD13A3", begin = "2000032", end = "2000061",
              SDSstring = "005", job = "Trial")

If I specify the tile I get the following message:

Error in rgdal::rawTransform(projfrom, projto, nrow(xy), xy[, 1], xy[, : no arguments in initialization list

When I ignore the tile, I am able to choose it from the map. The tfs that it creates is a list with the two file names that are blank (chr(0)). I also tried it with the data of Austria from the example with the same results. When I don't specify the job, it creates the HDF files in the local archives but nothing in the output directory. I also tried using lpdaacLogin() and adding the LAADS server with the same results.

These are my specs

'MRT_HOME' not set/found! MRT is NOT enabled! See: 'https://lpdaac.usgs.gov/tools/modis_reprojection_tool'

STORAGE:


localArcPath : C:/Users/p.morenog/Documents/MODIS_ARC/ outDirPath : C:/Users/p.morenog/Documents/MODIS_ARC/PROCESSED/

DOWNLOAD:


MODISserverOrder : LAADS, LPDAAC dlmethod : auto stubbornness : high wait : 0.5 quiet : TRUE

PROCESSING:


GDAL : GDAL 2.2.3, released 2017/11/20 MRT : Not available. Use 'MODIS:::checkTools('MRT')' for more information! pixelSize : asIn outProj : GEOGRAPHIC resamplingType : NN dataFormat : GTiff

Thank you

fdetsch commented 6 years ago

Hi @PMoreno92,

you're almost there. Please mind that SDSstring understand strings that consist of 0 and 1 only. For example, if you want to extract the NDVI and corresponding pixel reliability from each MOD13A3 .hdf file, you are required to enter the following:

clc = getCollection("MOD13A3", forceCheck = TRUE)
tfs = runGdal("MOD13A3", collection = clc
              , begin = "2000032", end = "2000061"
              , tileH = 21, tileV = 8
              , SDSstring = "10000000001", job = "Trial")
tfs

tfs $MOD13A3.006 $MOD13A3.006$2000-02-01 [1] "C:/Users/fdetsch/DOCUME\~1/MODIS_\~1/PROCES\~1/Trial/MOD13A3.A2000032.1_km_monthlyNDVI.tif"
[2] "C:/Users/fdetsch/DOCUME\~1/MODIS
\~1/PROCES\~1/Trial/MOD13A3.A2000032.1_km_monthly_pixel_reliability.tif"

$MOD13A3.006$2000-03-01 [1] "C:/Users/fdetsch/DOCUME\~1/MODIS_\~1/PROCES\~1/Trial/MOD13A3.A2000061.1_km_monthlyNDVI.tif"
[2] "C:/Users/fdetsch/DOCUME\~1/MODIS
\~1/PROCES\~1/Trial/MOD13A3.A2000061.1_km_monthly_pixel_reliability.tif"

This works both with (as shown in the example above) and without tileH,tileV specified. See also MOD13A3 V006 | LP DAAC for detailed information about the exact order of scientific data sets.

In addition, make sure to use the latest 'develop' version of MODIS (devtools::install_github("MatMatt/MODIS", ref = "develop")). There's a lot of coding work going on lately, and the next release will likely hit CRAN within the next couple of days.

Cheers, Florian

PMoreno92 commented 6 years ago

Good afternoon Florian,

This worked correctly. Thank you for your help.

Have a nice day, Pablo