[GRASS-dev] t.rast.out.xyz not exporting all cells in the computational region

Markus Neteler neteler at osgeo.org
Mon Dec 5 14:08:12 PST 2016


Hi Vero,

On Wed, Nov 30, 2016 at 2:10 PM, Veronica Andreo <veroandreo at gmail.com> wrote:
> Hello devs,
>
> AFAIU, to activate the NULL export in r.out.xyz is then a trivial change,
> but we do not know which letter to use as flag because -n is already used to
> indicate the opposite behaviour (?). Is it too difficult to change default
> behaviour to export NULL values and keep then, the -n flag as in r.stats to
> not export/report NULL values?

attached a trivial (untested) patch make make r.out.xyz behave as the rest.
Please check:

patch -p0 < r.out.xyz.diff

cheers
Markus
-------------- next part --------------
Index: scripts/r.out.xyz/r.out.xyz.py
===================================================================
--- scripts/r.out.xyz/r.out.xyz.py	(revision 69968)
+++ scripts/r.out.xyz/r.out.xyz.py	(working copy)
@@ -32,6 +32,10 @@
 #%end
 #%option G_OPT_F_SEP
 #%end
+#%flag
+#% key: n
+#% description: Do not report no data value
+#%end
 
 import sys
 from grass.script import core as grass
@@ -41,8 +45,13 @@
 def main():
     # if no output filename, output to stdout
     output = options['output']
+    skipnodata = flags['n']
 
-    parameters = dict(flags="1gn",
+    if skipnodata:
+	statsflags="1gn"
+    else:
+	statsflags="1g"
+    parameters = dict(flags=statsflags,
                       input=options['input'],
                       separator=options['separator'])
     if output:


More information about the grass-dev mailing list