Skip to content

Commit

Permalink
t.rast.series: pass n_procs and memory parameters to r.series (OSGeo#…
Browse files Browse the repository at this point in the history
  • Loading branch information
griembauer authored and ninsbl committed Oct 26, 2022
1 parent 369d454 commit c8de65d
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
17 changes: 13 additions & 4 deletions temporal/t.rast.series/t.rast.series.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@ <h2>DESCRIPTION</h2>
<b>r.series</b>. It supports a subset of the aggregation methods of
<b>r.series</b>.

<h2>Performance</h2>
To enable parallel processing, the user can specify the number of threads to be
used with the <b>nprocs</b> parameter (default 1). The <b>memory</b> parameter
(default 300 MB) can also be provided to determine the size of the buffer in MB for
computation. Both parameters are passed to <a href="r.series.html">r.series</a>.
To take advantage of the parallelization, GRASS GIS
needs to be compiled with OpenMP enabled.


<h2>EXAMPLES</h2>

<h3>Estimate the average temperature for the whole time series</h3>
Expand Down Expand Up @@ -43,7 +52,7 @@ <h3>Climatology: single month in a multi-annual time series</h3>
method=average output=tempmean_january \
where="strftime('%m', start_time)='01'"

# equivalently, we can use
# equivalently, we can use
t.rast.series input=tempmean_monthly \
output=tempmean_january method=average \
where="start_time = datetime(start_time, 'start of year', '0 month')"
Expand All @@ -59,12 +68,12 @@ <h3>Climatology: single month in a multi-annual time series</h3>
where="start_time = datetime(start_time, 'start of year', '2 month')"
</pre></div>

Generalizing a bit, we can estimate monthly climatologies for all months
Generalizing a bit, we can estimate monthly climatologies for all months
by means of different methods

<div class="code"><pre>
for i in `seq -w 1 12` ; do
for m in average stddev minimum maximum ; do
for i in `seq -w 1 12` ; do
for m in average stddev minimum maximum ; do
t.rast.series input=tempmean_monthly method=${m} output=tempmean_${m}_${i} \
where="strftime('%m', start_time)='${i}'"
done
Expand Down
10 changes: 10 additions & 0 deletions temporal/t.rast.series/t.rast.series.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@
# % answer: start_time
# %end

# %option G_OPT_M_NPROCS
# %end

# %option G_OPT_MEMORYMB
# %end

# %option G_OPT_T_WHERE
# %end

Expand Down Expand Up @@ -95,6 +101,8 @@ def main():
method = options["method"]
quantile = options["quantile"]
order = options["order"]
memory = options["memory"]
nprocs = options["nprocs"]
where = options["where"]
add_time = flags["t"]
nulls = flags["n"]
Expand Down Expand Up @@ -148,6 +156,8 @@ def main():
overwrite=grass.overwrite(),
method=method,
quantile=quantile,
memory=memory,
nprocs=nprocs,
)
except CalledModuleError:
grass.fatal(_("%s failed. Check above error messages.") % "r.series")
Expand Down

0 comments on commit c8de65d

Please sign in to comment.