The input file is given as a list of full paths to the MODIS HDF files, one per line. The input file(s) have to be inside the folder where the HDF files are stored.
If mrtpath is not used, pyModis will use GDAL to convert HDF files to TIF (which is faster).
The mrtpath option is the path to the main folder of the MODIS Reprojection Tools (MRT) binaries, i.e. the folder which contains the bin/ and the data/ folder, since these two folders are essential for obtaining a successful result.
Warning:
NOTE: In order to work with the temporal framework of GRASS GIS the flag w must be set during the import with r.modis.import.
r.modis.import input=/path/to/file
Import of files from a list with all the subsets using MRT (if mrtpath is not provided, GDAL is used):
r.modis.import files=/path/to/listfile mrtpath=/path/to/mrt
Import of files from a list as mosaics per date without QA layers using MRT:
r.modis.import -mq files=/path/to/listfile mrtpath=/path/to/mrt
Import of a single file with user-specific subset of layers using GDAL:
r.modis.import input=/path/to/file spectral="( 1 0 1 0 )"
Import of files from a list with user-specific subset of layers and without QA layer using MRT:
r.modis.import -q files=/path/to/listfile mrtpath=/path/to/mrt spectral="( 1 )"
Import of a single subset of layers (i.e.: spectral="( 1 )") from each file of a list and write an outfile to be used with t.register to assign timestamps to maps in the temporal database and register them in a spacetime dataset. This option uses GDAL:
r.modis.import -wq files=/path/to/listfile spectral="( 1 )" outfile=/path/to/list_for_tregister.csv
# download the two years worth of data r.modis.download settings=~/.rmodis product=ndvi_terra_sixteen_5600 \ startday=2015-01-01 endday=2016-12-31 folder=$USER/data/ndvi_MOD13C1.006 # import band 1 = NDVI r.modis.import files=$USER/data/ndvi_MOD13C1.006/listfileMOD13C1.006.txt spectral="( 1 )" \ method=bilinear outfile=$USER/data/ndvi_MOD13C1.006/list_for_tregister.csv -w # create empty temporal DB t.create type=strds temporaltype=absolute output=ndvi_16_5600m title="Global NDVI 16 days MOD13C1" \ description="MOD13C1 Global NDVI 16 days" semantictype=mean # register maps within spacetime datasets (the file name is provided by # r.modis.import using -w flag and outfile option) t.register input=ndvi_16_5600m file=$USER/data/ndvi_MOD13C1.006/list_for_tregister.csv # verify and visualize timeline t.rast.list ndvi_16_5600m g.gui.timeline ndvi_16_5600m
r.modis.download settings=$HOME/SETTING product=lst_terra_eight_1000 \ tiles=h18v04,h18v05 startday=2016-12-23 endday=2016-12-31
r.modis.import -m files=$HOME/listfileMOD11A1.006.txt \ spectral="( 1 1 0 0 0 0 0 0 0 0 0 0 )"
for map in `g.list type=raster pattern="*_QC_Day"` ; do i.modis.qc input=${map} output=${map}_mandatory_qa \ productname=mod11A1 qcname=mandatory_qa_11A1 done for m in `g.list rast pat=*2016*LST_Day_1km` ; do # get name of product and date from filenames i=`echo $m | cut -c 1-16` # apply qa flags r.mapcalc --o expression="${m} = if(${i}_mosaic_QC_Day_mandatory_qa < 2, ${m}, null())" done
t.create type=strds temporaltype=absolute output=LST_Day_daily \ title="Daily LST Day 1km" \ description="Daily LST Day 1km MOD11A1.006, December 2016" t.register -i input=LST_Day_daily \ maps=`g.list type=raster pattern="*2016*LST_Day_1km" separator=comma` \ start="2016-12-23" increment="1 day"
t.rast.list LST_Day_daily g.gui.timeline LST_Day_daily
It is also possible to create a time series using the list of maps with start and end time written by r.modis.import with the w flag and outfile option.
# Import mosaics of LST Day for all dates using the list of downloaded files from # r.modis.download (see above) and get a list of the imported files along with # dates to use with t.register in the temporal framework r.modis.import -mw files=$HOME/listfileMOD11A1.006.txt \ spectral="( 1 0 0 0 0 0 0 0 0 0 0 0 )" outfile=$HOME/list_for_tregister.csv # Create time series and register maps t.create type=strds temporaltype=absolute output=LST_Day_daily \ title="Daily LST Day 1km" \ description="Daily LST Day 1km MOD11A1.006, December 2016" t.register input=LST_Day_daily file=$HOME/list_for_tregister.csv
GRASS GIS Wiki: temporal data processing
Map of MODIS Land products' Sinusoidal grid tiling system
Last changed: $Date: 2017-05-05 23:09:59 +0200 (Fri, 05 May 2017) $
Available at: r.modis.import source code (history)
Main index | Raster index | Topics index | Keywords index | Graphical index | Full index
© 2003-2018 GRASS Development Team, GRASS GIS 7.4.1svn Reference Manual