From cb07e79b69a38aea6085674faa2e07ce699e990a Mon Sep 17 00:00:00 2001 From: Paulo van Breugel Date: Sun, 12 Jun 2022 10:27:05 +0200 Subject: [PATCH 1/3] Add 'open_files' option to t.rast.series Add the option to set the file_limit (the maximum number of open files allowed for each r.series process), like the same option in t.series.aggregate. --- temporal/t.rast.series/t.rast.series.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/temporal/t.rast.series/t.rast.series.py b/temporal/t.rast.series/t.rast.series.py index 09b3eb95344..3dea63d605a 100755 --- a/temporal/t.rast.series/t.rast.series.py +++ b/temporal/t.rast.series/t.rast.series.py @@ -68,6 +68,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 @@ -78,7 +86,6 @@ # % description: Propagate NULLs # %end - import grass.script as grass from grass.exceptions import CalledModuleError @@ -96,6 +103,7 @@ def main(): quantile = options["quantile"] order = options["order"] where = options["where"] + max_files_open = int(options["file_limit"]) add_time = flags["t"] nulls = flags["n"] @@ -129,10 +137,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" From 1e90107bb11bad9e4fbef267c8e1eaed38a5ce1f Mon Sep 17 00:00:00 2001 From: Paulo van Breugel Date: Sun, 12 Jun 2022 10:29:52 +0200 Subject: [PATCH 2/3] Update t.rast.series.html --- temporal/t.rast.series/t.rast.series.html | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/temporal/t.rast.series/t.rast.series.html b/temporal/t.rast.series/t.rast.series.html index 6be1d56445e..ba1eff6ad00 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 +'open files' option. Note that 'open file' limit should not exceed the +user-specific limit on open files set by your operating system. See the +Wiki +for more information.

EXAMPLES

From ca969245f4e5ce822483ca1ff0babef10d1db141 Mon Sep 17 00:00:00 2001 From: Paulo van Breugel Date: Sun, 12 Jun 2022 14:10:45 +0200 Subject: [PATCH 3/3] Update temporal/t.rast.series/t.rast.series.html Co-authored-by: Markus Neteler --- temporal/t.rast.series/t.rast.series.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/temporal/t.rast.series/t.rast.series.html b/temporal/t.rast.series/t.rast.series.html index ba1eff6ad00..213fa263054 100644 --- a/temporal/t.rast.series/t.rast.series.html +++ b/temporal/t.rast.series/t.rast.series.html @@ -16,9 +16,9 @@

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 +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 -'open files' option. Note that 'open file' limit should not exceed 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