瀏覽代碼

temporal: Add extra parameters to r.out.gdal

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@71373 15284696-431f-4ddb-bdfa-cd5b030d7da7
Pietro Zambelli 7 年之前
父節點
當前提交
b0c8aace70
共有 1 個文件被更改,包括 11 次插入7 次删除
  1. 11 7
      lib/python/temporal/stds_export.py

+ 11 - 7
lib/python/temporal/stds_export.py

@@ -53,7 +53,8 @@ exported_maps = {}
 
 
 
 
 def _export_raster_maps_as_gdal(rows, tar, list_file, new_cwd, fs, format_,
 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:
     for row in rows:
         name = row["name"]
         name = row["name"]
         start = row["start_time"]
         start = row["start_time"]
@@ -83,20 +84,22 @@ def _export_raster_maps_as_gdal(rows, tar, list_file, new_cwd, fs, format_,
                         gdal_type = "Int32"
                         gdal_type = "Int32"
                     gscript.run_command("r.out.gdal", flags="c", input=name,
                     gscript.run_command("r.out.gdal", flags="c", input=name,
                                         output=out_name, nodata=nodata,
                                         output=out_name, nodata=nodata,
-                                        type=gdal_type, format="GTiff")
+                                        type=gdal_type, format="GTiff",
+                                        **kwargs)
                 elif type_:
                 elif type_:
                     gscript.run_command("r.out.gdal", flags="cf", input=name,
                     gscript.run_command("r.out.gdal", flags="cf", input=name,
                                         output=out_name,
                                         output=out_name,
-                                        type=type_, format="GTiff")
+                                        type=type_, format="GTiff", **kwargs)
                 else:
                 else:
                     gscript.run_command("r.out.gdal", flags="c",
                     gscript.run_command("r.out.gdal", flags="c",
                                         input=name, output=out_name,
                                         input=name, output=out_name,
-                                        format="GTiff")
+                                        format="GTiff", **kwargs)
             elif format_ == "AAIGrid":
             elif format_ == "AAIGrid":
                 # Export the raster map with r.out.gdal as Arc/Info ASCII Grid
                 # Export the raster map with r.out.gdal as Arc/Info ASCII Grid
                 out_name = name + ".asc"
                 out_name = name + ".asc"
                 gscript.run_command("r.out.gdal", flags="c", input=name,
                 gscript.run_command("r.out.gdal", flags="c", input=name,
-                                    output=out_name, format="AAIGrid")
+                                    output=out_name, format="AAIGrid",
+                                    **kwargs)
 
 
         except CalledModuleError:
         except CalledModuleError:
             shutil.rmtree(new_cwd)
             shutil.rmtree(new_cwd)
@@ -232,7 +235,7 @@ def _export_raster3d_maps(rows, tar, list_file, new_cwd, fs):
 
 
 
 
 def export_stds(input, output, compression, directory, where, format_="pack",
 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
     """Export space time datasets as tar archive with optional compression
 
 
         This method should be used to export space time datasets
         This method should be used to export space time datasets
@@ -301,7 +304,8 @@ def export_stds(input, output, compression, directory, where, format_="pack",
         if type_ == "strds":
         if type_ == "strds":
             if format_ == "GTiff" or format_ == "AAIGrid":
             if format_ == "GTiff" or format_ == "AAIGrid":
                 _export_raster_maps_as_gdal(
                 _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:
             else:
                 _export_raster_maps(rows, tar, list_file, new_cwd, fs)
                 _export_raster_maps(rows, tar, list_file, new_cwd, fs)
         elif type_ == "stvds":
         elif type_ == "stvds":