diff --git a/temporal/t.rast.series/t.rast.series.html b/temporal/t.rast.series/t.rast.series.html
index f8dfdce412a..9a2389e81e4 100644
--- a/temporal/t.rast.series/t.rast.series.html
+++ b/temporal/t.rast.series/t.rast.series.html
@@ -11,6 +11,18 @@
DESCRIPTION
t.rast.series is a simple wrapper for the raster module
r.series. It supports a subset of the aggregation methods of
r.series.
+
+NOTES
+
+To avoid problems with too many open files, by default, the maximum
+number of open files is set to 1000. If the number of input raster
+files exceeds this number, the -z flag will be invoked. Because this
+will slow down processing, the user can set a higher limit with the
+file_limit parameter. Note that file_limit limit should not exceed the
+user-specific limit on open files set by your operating system. See the
+Wiki
+for more information.
Performance
To enable parallel processing, the user can specify the number of threads to be
diff --git a/temporal/t.rast.series/t.rast.series.py b/temporal/t.rast.series/t.rast.series.py
index 5651d3b7a58..27982a0c737 100755
--- a/temporal/t.rast.series/t.rast.series.py
+++ b/temporal/t.rast.series/t.rast.series.py
@@ -74,6 +74,14 @@
# %option G_OPT_R_OUTPUTS
# %end
+# %option
+# % key: file_limit
+# % type: integer
+# % description: The maximum number of open files allowed for each r.series process
+# % required: no
+# % answer: 1000
+# %end
+
# %flag
# % key: t
# % description: Do not assign the space time raster dataset start and end time to the output map
@@ -84,7 +92,6 @@
# % description: Propagate NULLs
# %end
-
import grass.script as grass
from grass.exceptions import CalledModuleError
@@ -104,6 +111,7 @@ def main():
memory = options["memory"]
nprocs = options["nprocs"]
where = options["where"]
+ max_files_open = int(options["file_limit"])
add_time = flags["t"]
nulls = flags["n"]
@@ -137,10 +145,12 @@ def main():
file.close()
flag = ""
- if len(rows) > 1000:
+ if len(rows) > max_files_open:
grass.warning(
_(
- "Processing over 1000 maps: activating -z flag of r.series which slows down processing"
+ "Processing over {} maps: activating -z flag of r.series which slows down processing.".format(
+ max_files_open
+ )
)
)
flag += "z"