Time series: Difference between revisions

From GRASS-Wiki
Jump to navigation Jump to search
 
(11 intermediate revisions by 2 users not shown)
Line 1: Line 1:
=== Setting and querying time stamps ===


=== Time stamps ===
Metadata:
* {{cmd|r.timestamp}} - set and retrieve
* {{cmd|r.support}} - add further metadata


* {{cmd|r.support}}
=== Time series in GRASS GIS 7 ===
* {{cmd|r.timestamp}}
 
* [[Temporal data processing]] - the TGRASS framework
* A huge set of '''new modules''' is available: http://grass.osgeo.org/grass70/manuals/temporal.html
* A '''presentation''' and '''support material''' is available in the attachment section of the lecture: http://www.geostat-course.org/Topic_Gebbert
* Older brainstorming: SQL database support for a raster map timeseries is discussed in the [[Time series development]] wiki page.
 
 
=== Raster map time series analysis ===
 
* {{cmd|r.series}} - module to analyse series of raster maps, considering the stack of input maps along the time axis
* {{AddonSrc|raster|r.hants|version=7}}: performs a harmonic analysis of time series in order to estimate missing values and identify outliers (install with g.extension)
* {{AddonSrc|raster|r.regression.series|version=7}}: module to calculate linear regression parameters between two time series, e.g. NDVI and precipitation (install with g.extension)


=== Common legends for many raster maps ===
=== Common legends for many raster maps ===
Line 13: Line 27:
* Draw legend to color table extent with "{{cmd|d.legend}} range=min,max"
* Draw legend to color table extent with "{{cmd|d.legend}} range=min,max"


Example using [[MODIS#Pathfinder|Pathfinder SST]] data:
Example using [[AVHRR|Pathfinder AVHRR SST]] data:
 
<source lang="bash">
MAP_PATTERN='*.s0451pfv50-sst*degC.q4'
# find overall min/max
  ALL_MIN=999999
  ALL_MIN=999999
  ALL_MAX=-999999
  ALL_MAX=-999999
   
   
MAP_PATTERN='*.s0451pfv50-sst*degC.q4'
# find overall min/max
  for MAP in `g.mlist rast pattern=$MAP_PATTERN` ; do
  for MAP in `g.mlist rast pattern=$MAP_PATTERN` ; do
   eval `r.info -r $MAP`
   eval `r.info -r $MAP`
   ALL_MAX=`echo "$max $ALL_MAX" | awk '{if ($1 > $2) print $1; else print $2}'`
   ALL_MAX=`echo "$max $ALL_MAX" | awk '{if ($1 > $2) print $1; else print $2}'`
   ALL_MIN=`echo "$min $ALL_MIN" | awk '{if ($1 < $2) print $1; else print $2}'`
   ALL_MIN=`echo "$min $ALL_MIN" | awk '{if ($1 < $2) print $1; else print $2}'`
  done
  done
Line 30: Line 44:
  ONETHIRD=`echo $ALL_MIN $ALL_MAX | awk '{print ($2 - $1)/3.0 + $1}'`
  ONETHIRD=`echo $ALL_MIN $ALL_MAX | awk '{print ($2 - $1)/3.0 + $1}'`
  TWOTHIRD=`echo $ALL_MIN $ALL_MAX | awk '{print 2*($2 - $1)/3.0 + $1}'`  
  TWOTHIRD=`echo $ALL_MIN $ALL_MAX | awk '{print 2*($2 - $1)/3.0 + $1}'`  
 
  # create full-scale color table for first map
  # create full-scale color table for first map
  FIRST_MAP=`g.mlist rast pattern=$MAP_PATTERN | head -n 1`
  FIRST_MAP=`g.mlist rast pattern=$MAP_PATTERN | head -n 1`
Line 45: Line 59:
     r.colors $MAP rast=$FIRST_MAP
     r.colors $MAP rast=$FIRST_MAP
  done
  done
 
  # draw
  # draw
  for MAP in `g.mlist rast pattern=$MAP_PATTERN` ; do
  for MAP in `g.mlist rast pattern=$MAP_PATTERN` ; do
Line 51: Line 65:
     d.legend $MAP range=$ALL_MIN,$ALL_MAX
     d.legend $MAP range=$ALL_MIN,$ALL_MAX
  done
  done
 
</source>


* For {{cmd|ps.map}} use the '''colortable''' instruction's "range" parameter.
* For {{cmd|ps.map}} use the '''colortable''' instruction's "range" parameter.


=== Animation ===
=== Animations ===


* see the [[Movies]] wiki page
* see the [[Movies]] wiki page
=== Development ===
* SQL database support for a raster map timeseries is discussed in the [[Time series development]] wiki page.


[[Category:FAQ]]
[[Category:FAQ]]
[[Category:Image processing]]
[[Category:Temporal]]

Latest revision as of 15:59, 26 August 2014

Setting and querying time stamps

Metadata:

Time series in GRASS GIS 7


Raster map time series analysis

  • r.series - module to analyse series of raster maps, considering the stack of input maps along the time axis
  • r.hants (src): performs a harmonic analysis of time series in order to estimate missing values and identify outliers (install with g.extension)
  • r.regression.series (src): module to calculate linear regression parameters between two time series, e.g. NDVI and precipitation (install with g.extension)

Common legends for many raster maps

The general idea is to:

  • Calculate the overall min/max covering all maps with "r.info -r"
  • Create a full-scale color table with "r.colors rules=" on the first map
  • Copy that color table to other maps in the series with "r.colors rast="
  • Draw legend to color table extent with "d.legend range=min,max"

Example using Pathfinder AVHRR SST data:

 MAP_PATTERN='*.s0451pfv50-sst*degC.q4'
 
 # find overall min/max
 ALL_MIN=999999
 ALL_MAX=-999999
 
 for MAP in `g.mlist rast pattern=$MAP_PATTERN` ; do
   eval `r.info -r $MAP`
   ALL_MAX=`echo "$max $ALL_MAX" | awk '{if ($1 > $2) print $1; else print $2}'`
   ALL_MIN=`echo "$min $ALL_MIN" | awk '{if ($1 < $2) print $1; else print $2}'`
 done
 
 echo "all_min=$ALL_MIN   all_max=$ALL_MAX"
 ONETHIRD=`echo $ALL_MIN $ALL_MAX | awk '{print ($2 - $1)/3.0 + $1}'`
 TWOTHIRD=`echo $ALL_MIN $ALL_MAX | awk '{print 2*($2 - $1)/3.0 + $1}'` 
 
 # create full-scale color table for first map
 FIRST_MAP=`g.mlist rast pattern=$MAP_PATTERN | head -n 1`
 
 r.colors $FIRST_MAP color=rules << EOF
  $ALL_MIN blue
  $ONETHIRD cyan
  $TWOTHIRD yellow
  $ALL_MAX red
 EOF
 
 # apply color table to all other maps 
 for MAP in `g.mlist rast pattern=$MAP_PATTERN` ; do
    r.colors $MAP rast=$FIRST_MAP
 done
 
 # draw
 for MAP in `g.mlist rast pattern=$MAP_PATTERN` ; do
    d.rast -o $MAP
    d.legend $MAP range=$ALL_MIN,$ALL_MAX
 done
  • For ps.map use the colortable instruction's "range" parameter.

Animations