Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

t.rast.series: pass n_procs and memory parameters to r.series #2470

Merged
merged 4 commits into from
Jul 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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