[GRASS-SVN] r71373 - grass/trunk/lib/python/temporal
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu Aug 10 08:48:29 PDT 2017
Author: zarch
Date: 2017-08-10 08:48:29 -0700 (Thu, 10 Aug 2017)
New Revision: 71373
Modified:
grass/trunk/lib/python/temporal/stds_export.py
Log:
temporal: Add extra parameters to r.out.gdal
Modified: grass/trunk/lib/python/temporal/stds_export.py
===================================================================
--- grass/trunk/lib/python/temporal/stds_export.py 2017-08-10 13:49:20 UTC (rev 71372)
+++ grass/trunk/lib/python/temporal/stds_export.py 2017-08-10 15:48:29 UTC (rev 71373)
@@ -53,7 +53,8 @@
def _export_raster_maps_as_gdal(rows, tar, list_file, new_cwd, fs, format_,
- type_):
+ type_, **kwargs):
+ kwargs = {key: value for key, value in kwargs.items() if value is not None}
for row in rows:
name = row["name"]
start = row["start_time"]
@@ -83,20 +84,22 @@
gdal_type = "Int32"
gscript.run_command("r.out.gdal", flags="c", input=name,
output=out_name, nodata=nodata,
- type=gdal_type, format="GTiff")
+ type=gdal_type, format="GTiff",
+ **kwargs)
elif type_:
gscript.run_command("r.out.gdal", flags="cf", input=name,
output=out_name,
- type=type_, format="GTiff")
+ type=type_, format="GTiff", **kwargs)
else:
gscript.run_command("r.out.gdal", flags="c",
input=name, output=out_name,
- format="GTiff")
+ format="GTiff", **kwargs)
elif format_ == "AAIGrid":
# Export the raster map with r.out.gdal as Arc/Info ASCII Grid
out_name = name + ".asc"
gscript.run_command("r.out.gdal", flags="c", input=name,
- output=out_name, format="AAIGrid")
+ output=out_name, format="AAIGrid",
+ **kwargs)
except CalledModuleError:
shutil.rmtree(new_cwd)
@@ -232,7 +235,7 @@
def export_stds(input, output, compression, directory, where, format_="pack",
- type_="strds", datatype=None):
+ type_="strds", datatype=None, **kwargs):
"""Export space time datasets as tar archive with optional compression
This method should be used to export space time datasets
@@ -301,7 +304,8 @@
if type_ == "strds":
if format_ == "GTiff" or format_ == "AAIGrid":
_export_raster_maps_as_gdal(
- rows, tar, list_file, new_cwd, fs, format_, datatype)
+ rows, tar, list_file, new_cwd, fs, format_, datatype,
+ **kwargs)
else:
_export_raster_maps(rows, tar, list_file, new_cwd, fs)
elif type_ == "stvds":
More information about the grass-commit
mailing list