t.rast.accumulate.html 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298
  1. <h2>DESCRIPTION</h2>
  2. <em>t.rast.accumulate</em> is designed to perform temporal accumulations
  3. of space time raster datasets.
  4. This module expects a space time raster dataset as input that will be
  5. sampled by a given <b>granularity</b>. All maps that have the start
  6. time during the actual granule will be accumulated with the predecessor
  7. granule accumulation result using the raster module
  8. <a href="r.series.accumulate.html">r.series.accumulate</a>. The default
  9. granularity is 1 day, but any temporal granularity can be set.
  10. <p>
  11. The <b>start</b> time and the <b>end</b> time of the accumulation
  12. process must be set, eg. <b>start="2000-03-01" end="2011-01-01"</b>. In
  13. addition, a <b>cycle</b>, eg. <b>cycle="8 months"</b>, can be specified,
  14. that defines after which interval of time the accumulation process
  15. restarts. The <b>offset</b> option specifies the time that should be
  16. skipped between two cycles, eg. <b>offset="4 months"</b>.
  17. <p>
  18. The <b>lower</b> and <b>upper</b> <b>limits</b> of the accumulation
  19. process can be set, either by using space time raster datasets or by
  20. using fixed values for all raster cells and time steps. The raster
  21. maps that specify the lower and upper limits of the actual granule
  22. will be detected using the following temporal relations: equals,
  23. during, overlaps, overlapped and contains. First, all maps with time
  24. stamps equal to the current granule will be detected, the first lower
  25. map and the first upper map found will be used as limit definitions.
  26. If no equal maps are found, then maps with a temporal during relation
  27. are detected, then maps that temporally overlap the actual granules,
  28. until maps that have a temporal contain relation are detected. If no
  29. maps are found or lower/upper STRDS are not defined, then the
  30. <b>limits</b> option is used, eg. <b>limits=10,30</b>.
  31. <p>
  32. The <b>upper</b> <b>limit</b> is only used in the Biologically
  33. Effective Degree Days calculation.
  34. <p>
  35. The options <b>shift</b>, <b>scale</b> and <b>method</b> are passed to
  36. <a href="r.series.accumulate.html">r.series.accumulate</a>.
  37. Please refer to the manual page of
  38. <a href="r.series.accumulate.html">r.series.accumulate</a> for detailed
  39. option description.
  40. <p>
  41. The <b>output</b> is a new space time raster dataset with the provided
  42. start time, end time and granularity containing the accumulated raster
  43. maps. The <b>base</b> name of the generated maps must always be set.
  44. The <b>output</b> space time raster dataset can then be analyzed using
  45. <a href="t.rast.accdetect.html">t.rast.accdetect</a> to detect specific
  46. accumulation patterns.
  47. <h2>EXAMPLE</h2>
  48. This is an example how to accumulate the daily mean temperature of
  49. Europe from 1990 to 2000 using the growing-degree-day method to detect
  50. grass hopper reproduction cycles that are critical to agriculture.
  51. <div class="code"><pre>
  52. # Get the temperature data
  53. wget http://www-pool.math.tu-berlin.de/~soeren/grass/temperature_mean_1990_2000_daily_celsius.tar.gz
  54. # Create a temporary location directory
  55. mkdir -p /tmp/grassdata/LL
  56. # Start GRASS and create a new location with PERMANENT mapset
  57. grass -c EPSG:4326 /tmp/grassdata/LL/PERMANENT
  58. # Import the temperature data
  59. t.rast.import input=temperature_mean_1990_2000_daily_celsius.tar.gz \
  60. output=temperature_mean_1990_2000_daily_celsius directory=/tmp
  61. # We need to set the region correctly
  62. g.region -p raster=`t.rast.list input=temperature_mean_1990_2000_daily_celsius column=name | tail -1`
  63. # We can zoom to the raster map
  64. g.region -p zoom=`t.rast.list input=temperature_mean_1990_2000_daily_celsius column=name | tail -1`
  65. #############################################################################
  66. #### ACCUMULATION USING GDD METHOD ##########################################
  67. #############################################################################
  68. # The computation of grashopper pest control cycles is based on:
  69. #
  70. # Using Growing Degree Days For Insect Management
  71. # Nancy E. Adams
  72. # Extension Educator, Agricultural Resources
  73. #
  74. # available here: http://extension.unh.edu/agric/gddays/docs/growch.pdf
  75. # Now we compute the Biologically Effective Degree Days
  76. # from 1990 - 2000 for each year (12 month cycle) with
  77. # a granularity of one day. Base temperature is 10&deg;C, upper limit is 30&deg;C.
  78. # Hence the accumulation starts at 10&deg;C and does not accumulate values above 30&deg;C.
  79. t.rast.accumulate input="temperature_mean_1990_2000_daily_celsius" \
  80. output="temperature_mean_1990_2000_daily_celsius_accumulated_10_30" \
  81. limits="10,30" start="1990-01-01" stop="2000-01-01" cycle="12 months" \
  82. basename="temp_acc_daily_10_30" method="bedd"
  83. #############################################################################
  84. #### ACCUMULATION PATTERN DETECTION #########################################
  85. #############################################################################
  86. # Now we detect the three grasshopper pest control cycles
  87. # First cycle at 325&deg;C - 427&deg;C GDD
  88. t.rast.accdetect input=temperature_mean_1990_2000_daily_celsius_accumulated_10_30@PERMANENT \
  89. occ=leafhopper_occurrence_c1_1990_2000 start="1990-01-01" stop="2000-01-01" \
  90. cycle="12 months" range=325,427 basename=lh_c1 indicator=leafhopper_indicator_c1_1990_2000
  91. # Second cycle at 685&deg;C - 813&deg;C GDD
  92. t.rast.accdetect input=temperature_mean_1990_2000_daily_celsius_accumulated_10_30@PERMANENT \
  93. occ=leafhopper_occurrence_c2_1990_2000 start="1990-01-01" stop="2000-01-01" \
  94. cycle="12 months" range=685,813 basename=lh_c2 indicator=leafhopper_indicator_c2_1990_2000
  95. # Third cycle at 1047&deg;C - 1179&deg;C GDD
  96. t.rast.accdetect input=temperature_mean_1990_2000_daily_celsius_accumulated_10_30@PERMANENT \
  97. occ=leafhopper_occurrence_c3_1990_2000 start="1990-01-01" stop="2000-01-01" \
  98. cycle="12 months" range=1047,1179 basename=lh_c3 indicator=leafhopper_indicator_c3_1990_2000
  99. #############################################################################
  100. #### YEARLY SPATIAL OCCURRENCE COMPUTATION OF ALL CYCLES ####################
  101. #############################################################################
  102. # Extract the areas that have full cycles
  103. t.rast.aggregate input=leafhopper_indicator_c1_1990_2000 gran="1 year" \
  104. output=leafhopper_cycle_1_1990_2000_yearly method=maximum basename=li_c1
  105. t.rast.mapcalc input=leafhopper_cycle_1_1990_2000_yearly basename=lh_clean_c1 \
  106. output=leafhopper_cycle_1_1990_2000_yearly_clean \
  107. expression="if(leafhopper_cycle_1_1990_2000_yearly == 3, 1, null())"
  108. t.rast.aggregate input=leafhopper_indicator_c2_1990_2000 gran="1 year" \
  109. output=leafhopper_cycle_2_1990_2000_yearly method=maximum basename=li_c2
  110. t.rast.mapcalc input=leafhopper_cycle_2_1990_2000_yearly basename=lh_clean_c2 \
  111. output=leafhopper_cycle_2_1990_2000_yearly_clean \
  112. expression="if(leafhopper_cycle_2_1990_2000_yearly == 3, 2, null())"
  113. t.rast.aggregate input=leafhopper_indicator_c3_1990_2000 gran="1 year" \
  114. output=leafhopper_cycle_3_1990_2000_yearly method=maximum basename=li_c3
  115. t.rast.mapcalc input=leafhopper_cycle_3_1990_2000_yearly basename=lh_clean_c3 \
  116. output=leafhopper_cycle_3_1990_2000_yearly_clean \
  117. expression="if(leafhopper_cycle_3_1990_2000_yearly == 3, 3, null())"
  118. t.rast.mapcalc input=leafhopper_cycle_1_1990_2000_yearly_clean,leafhopper_cycle_2_1990_2000_yearly_clean,leafhopper_cycle_3_1990_2000_yearly_clean \
  119. basename=lh_cleann_all_cycles \
  120. output=leafhopper_all_cycles_1990_2000_yearly_clean \
  121. expression="if(isnull(leafhopper_cycle_3_1990_2000_yearly_clean), \
  122. if(isnull(leafhopper_cycle_2_1990_2000_yearly_clean), \
  123. if(isnull(leafhopper_cycle_1_1990_2000_yearly_clean), \
  124. null() ,1),2),3)"
  125. cat > color.table << EOF
  126. 3 yellow
  127. 2 blue
  128. 1 red
  129. EOF
  130. t.rast.colors input=leafhopper_cycle_1_1990_2000_yearly_clean rules=color.table
  131. t.rast.colors input=leafhopper_cycle_2_1990_2000_yearly_clean rules=color.table
  132. t.rast.colors input=leafhopper_cycle_3_1990_2000_yearly_clean rules=color.table
  133. t.rast.colors input=leafhopper_all_cycles_1990_2000_yearly_clean rules=color.table
  134. #############################################################################
  135. ################ DURATION COMPUTATION #######################################
  136. #############################################################################
  137. # Extract the duration in days of the first cycle
  138. t.rast.aggregate input=leafhopper_occurrence_c1_1990_2000 gran="1 year" \
  139. output=leafhopper_min_day_c1_1990_2000 method=minimum basename=occ_min_day_c1
  140. t.rast.aggregate input=leafhopper_occurrence_c1_1990_2000 gran="1 year" \
  141. output=leafhopper_max_day_c1_1990_2000 method=maximum basename=occ_max_day_c1
  142. t.rast.mapcalc input=leafhopper_min_day_c1_1990_2000,leafhopper_max_day_c1_1990_2000 \
  143. basename=occ_duration_c1 \
  144. output=leafhopper_duration_c1_1990_2000 \
  145. expression="leafhopper_max_day_c1_1990_2000 - leafhopper_min_day_c1_1990_2000"
  146. # Extract the duration in days of the second cycle
  147. t.rast.aggregate input=leafhopper_occurrence_c2_1990_2000 gran="1 year" \
  148. output=leafhopper_min_day_c2_1990_2000 method=minimum basename=occ_min_day_c2
  149. t.rast.aggregate input=leafhopper_occurrence_c2_1990_2000 gran="1 year" \
  150. output=leafhopper_max_day_c2_1990_2000 method=maximum basename=occ_max_day_c2
  151. t.rast.mapcalc input=leafhopper_min_day_c2_1990_2000,leafhopper_max_day_c2_1990_2000 \
  152. basename=occ_duration_c2 \
  153. output=leafhopper_duration_c2_1990_2000 \
  154. expression="leafhopper_max_day_c2_1990_2000 - leafhopper_min_day_c2_1990_2000"
  155. # Extract the duration in days of the third cycle
  156. t.rast.aggregate input=leafhopper_occurrence_c3_1990_2000 gran="1 year" \
  157. output=leafhopper_min_day_c3_1990_2000 method=minimum basename=occ_min_day_c3
  158. t.rast.aggregate input=leafhopper_occurrence_c3_1990_2000 gran="1 year" \
  159. output=leafhopper_max_day_c3_1990_2000 method=maximum basename=occ_max_day_c3
  160. t.rast.mapcalc input=leafhopper_min_day_c3_1990_2000,leafhopper_max_day_c3_1990_2000 \
  161. basename=occ_duration_c3 \
  162. output=leafhopper_duration_c3_1990_2000 \
  163. expression="leafhopper_max_day_c3_1990_2000 - leafhopper_min_day_c3_1990_2000"
  164. t.rast.colors input=leafhopper_duration_c1_1990_2000 color=rainbow
  165. t.rast.colors input=leafhopper_duration_c2_1990_2000 color=rainbow
  166. t.rast.colors input=leafhopper_duration_c3_1990_2000 color=rainbow
  167. #############################################################################
  168. ################ MONTHLY CYCLES OCCURRENCE ##################################
  169. #############################################################################
  170. # Extract the monthly indicator that shows the start and end of a cycle
  171. # First cycle
  172. t.rast.aggregate input=leafhopper_indicator_c1_1990_2000 gran="1 month" \
  173. output=leafhopper_indi_min_month_c1_1990_2000 method=minimum basename=occ_indi_min_month_c1
  174. t.rast.aggregate input=leafhopper_indicator_c1_1990_2000 gran="1 month" \
  175. output=leafhopper_indi_max_month_c1_1990_2000 method=maximum basename=occ_indi_max_month_c1
  176. t.rast.mapcalc input=leafhopper_indi_min_month_c1_1990_2000,leafhopper_indi_max_month_c1_1990_2000 \
  177. basename=indicator_monthly_c1 \
  178. output=leafhopper_monthly_indicator_c1_1990_2000 \
  179. expression="if(leafhopper_indi_min_month_c1_1990_2000 == 1, 1, if(leafhopper_indi_max_month_c1_1990_2000 == 3, 3, 2))"
  180. # Second cycle
  181. t.rast.aggregate input=leafhopper_indicator_c2_1990_2000 gran="1 month" \
  182. output=leafhopper_indi_min_month_c2_1990_2000 method=minimum basename=occ_indi_min_month_c2
  183. t.rast.aggregate input=leafhopper_indicator_c2_1990_2000 gran="1 month" \
  184. output=leafhopper_indi_max_month_c2_1990_2000 method=maximum basename=occ_indi_max_month_c2
  185. t.rast.mapcalc input=leafhopper_indi_min_month_c2_1990_2000,leafhopper_indi_max_month_c2_1990_2000 \
  186. basename=indicator_monthly_c2 \
  187. output=leafhopper_monthly_indicator_c2_1990_2000 \
  188. expression="if(leafhopper_indi_min_month_c2_1990_2000 == 1, 1, if(leafhopper_indi_max_month_c2_1990_2000 == 3, 3, 2))"
  189. # Third cycle
  190. t.rast.aggregate input=leafhopper_indicator_c3_1990_2000 gran="1 month" \
  191. output=leafhopper_indi_min_month_c3_1990_2000 method=minimum basename=occ_indi_min_month_c3
  192. t.rast.aggregate input=leafhopper_indicator_c3_1990_2000 gran="1 month" \
  193. output=leafhopper_indi_max_month_c3_1990_2000 method=maximum basename=occ_indi_max_month_c3
  194. t.rast.mapcalc input=leafhopper_indi_min_month_c3_1990_2000,leafhopper_indi_max_month_c3_1990_2000 \
  195. basename=indicator_monthly_c3 \
  196. output=leafhopper_monthly_indicator_c3_1990_2000 \
  197. expression="if(leafhopper_indi_min_month_c3_1990_2000 == 1, 1, if(leafhopper_indi_max_month_c3_1990_2000 == 3, 3, 2))"
  198. cat > color.table << EOF
  199. 3 red
  200. 2 yellow
  201. 1 green
  202. EOF
  203. t.rast.colors input=leafhopper_monthly_indicator_c1_1990_2000 rules=color.table
  204. t.rast.colors input=leafhopper_monthly_indicator_c2_1990_2000 rules=color.table
  205. t.rast.colors input=leafhopper_monthly_indicator_c3_1990_2000 rules=color.table
  206. #############################################################################
  207. ################ VISUALIZATION ##############################################
  208. #############################################################################
  209. # Now we use g.gui.animation to visualize the yearly occurrence, the duration and the monthly occurrence
  210. # Yearly occurrence of all reproduction cycles
  211. g.gui.animation strds=leafhopper_all_cycles_1990_2000_yearly_clean
  212. # Yearly duration of reproduction cycle 1
  213. g.gui.animation strds=leafhopper_duration_c1_1990_2000
  214. # Yearly duration of reproduction cycle 2
  215. g.gui.animation strds=leafhopper_duration_c2_1990_2000
  216. # Yearly duration of reproduction cycle 3
  217. g.gui.animation strds=leafhopper_duration_c3_1990_2000
  218. # Monthly occurrence of reproduction cycle 1
  219. g.gui.animation strds=leafhopper_monthly_indicator_c1_1990_2000
  220. # Monthly occurrence of reproduction cycle 2
  221. g.gui.animation strds=leafhopper_monthly_indicator_c2_1990_2000
  222. # Monthly occurrence of reproduction cycle 3
  223. g.gui.animation strds=leafhopper_monthly_indicator_c3_1990_2000
  224. </pre></div>
  225. <h2>REFERENCES</h2>
  226. <ul>
  227. <li> Jones, G.V., Duff, A.A., Hall, A., Myers, J.W., 2010.
  228. Spatial Analysis of Climate in Winegrape Growing Regions in the
  229. Western United States. Am. J. Enol. Vitic. 61, 313-326.</li>
  230. </ul>
  231. <h2>SEE ALSO</h2>
  232. <em>
  233. <a href="t.rast.accdetect.html">t.rast.accdetect</a>,
  234. <a href="t.rast.aggregate.html">t.rast.aggregate</a>,
  235. <a href="t.rast.mapcalc.html">t.rast.mapcalc</a>,
  236. <a href="t.info.html">t.info</a>,
  237. <a href="g.region.html">g.region</a>,
  238. <a href="r.series.accumulate.html">r.series.accumulate</a>
  239. </em>
  240. <h2>AUTHOR</h2>
  241. S&ouml;ren Gebbert, Th&uuml;nen Institute of Climate-Smart Agriculture