[GRASS-SVN] r71409 - grass/trunk/temporal/t.rast.export

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Aug 18 02:27:29 PDT 2017


Author: zarch
Date: 2017-08-18 02:27:29 -0700 (Fri, 18 Aug 2017)
New Revision: 71409

Modified:
   grass/trunk/temporal/t.rast.export/t.rast.export.py
Log:
t.rast.export: Add GDAL options, to support GeoTiff compression

Modified: grass/trunk/temporal/t.rast.export/t.rast.export.py
===================================================================
--- grass/trunk/temporal/t.rast.export/t.rast.export.py	2017-08-16 06:58:58 UTC (rev 71408)
+++ grass/trunk/temporal/t.rast.export/t.rast.export.py	2017-08-18 09:27:29 UTC (rev 71409)
@@ -67,6 +67,32 @@
 #% options: Byte,Int16,UInt16,Int32,UInt32,Float32,Float64,CInt16,CInt32,CFloat32,CFloat64
 #%end
 
+#%option
+#% key: createopt
+#% type: string
+#% label: Creation option(s) to pass to the output format driver
+#% description: In the form of "NAME=VALUE", separate multiple entries with a comma
+#% required: no
+#% multiple: yes
+#%end
+
+#%option
+#% key: metaopt
+#% type: string
+#% label: Metadata key(s) and value(s) to include
+#% description: In the form of "META-TAG=VALUE", separate multiple entries with a comma. Not supported by all output format drivers.
+#% required: no
+#% multiple: yes
+#%end
+
+#%option
+#% key: nodata
+#% type: double
+#% label: Assign a specified nodata value to output bands
+#% description: If given, the nodata value is always written to metadata even if there are no NULL cells in the input band (enhances output compatibility).
+#% required: no
+#%end
+
 #%option G_OPT_T_WHERE
 #%end
 
@@ -86,15 +112,23 @@
     where = options["where"]
     _format = options["format"]
     _type = options["type"]
+    kws = {key: options[key]
+           for key in ('createopt', 'metaopt', 'nodata') if options[key]}
 
     if _type and _format in ["pack", "AAIGrid"]:
-        grass.warning(_("Type options is not working with pack format, it will be skipped"))
+        grass.warning(_("Type options is not working with pack format, "
+                        "it will be skipped"))
+        if kws:
+            grass.warning(_("Createopt, metaopt and nodata options are not "
+                            "working with pack and AAIGrid formats, "
+                            "they will be skipped"))
     # Make sure the temporal database exists
     tgis.init()
     # Export the space time raster dataset
     tgis.export_stds(_input, output, compression, directory, where, _format,
-                     "strds", _type)
+                     "strds", _type, **kws)
 
+
 ############################################################################
 if __name__ == "__main__":
     options, flags = grass.parser()



More information about the grass-commit mailing list