The nout output map holds the number of detected seasons. Output raster maps with the start and end dates of each season are produced for at most n number of seasons.
A season is a period of time that might include gaps up to max_gap. For each season identified, two start dates and two end dates are determined. The start date "start1" and the end date "end1" indicate the start and end of the core season, while the start date "start2" and the end date "end2" indicate the start and end of the full season including some periods shorter than min_length separated by gaps shorter than max_gap at the beginning and end of the season. A core season is at least min_length long and might contain gaps shorter than the max_gap inbetween, but not at the beginning or end. A full season, on the other hand, can have blocks shorter than min_length at the beginning or end as long as these blocks are separated by gaps shorter than the max_gap. Let's consider an example to visualize core and full seasons. We have a certain time series in which 0 means below the threshold and 1 means that the value is above the threshold set:
000101111010111101000
# core season: 000001111111111100000 #full season 000111111111111111000
The length of the longest core and full seasons can be stored in the max_length_core and max_length_full output maps.
/etc/security/limits.conf # <domain> <type> <item> <value> your_username hard nofile 4096
cat /proc/sys/fs/file-max
Use the -z flag to analyze large amount of raster maps without hitting open files limit and the size limit of command line arguments. This will however increase the processing time. For every single row in the output map(s) all input maps are opened and closed. The amount of RAM will rise linear with the number of specified input maps.
The input and file options are mutually exclusive. Input is a text file with a new line separated list of raster map names.
# download two years of data: MOD13C1, global NDVI, 16-days, 5600 m 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 -w files=$USER/data/ndvi_MOD13C1.006/listfileMOD13C1.006.txt \ spectral="( 1 )" method=bilinear outfile=$HOME/list_for_tregister.csv # 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 datasets (using outfile from r.modis.import -w) t.register input=ndvi_16_5600m file=$HOME/list_for_tregister.csv
g.gui.tplot strds=ndvi_16_5600m coordinates=146.537059538,-29.744835966
Now, identify seasons based on a fixed threshold and a minimum duration. The threshold and duration were visually estimated from the time series plot for the example.
r.seasons input=`g.list rast pat=MOD13* sep=,` prefix=ndvi_season n=3 \ nout=ndvi_season threshold_value=3000 min_length=6 # the outputs are: g.list type=raster pattern=ndvi_season* ndvi_season ndvi_season1_end1 ndvi_season1_end2 ndvi_season1_start1 ndvi_season1_start2 ndvi_season2_end1 ndvi_season2_end2 ndvi_season2_start1 ndvi_season2_start2 ndvi_season3_end1 ndvi_season3_end2 ndvi_season3_start1 ndvi_season3_start2
And finally, let's visualize ndvi_season and start1 and end1 of season 2:
# set comparable color table to plot start and end r.colors map=ndvi_season2_start1,ndvi_season2_end1 color=viridis
Available at: r.seasons source code (history)
Main index | Raster index | Topics index | Keywords index | Graphical index | Full index
© 2003-2020 GRASS Development Team, GRASS GIS 7.8.3dev Reference Manual