[GRASS-user] r.out.gdal to AAIGrid

Pedro VenĂ¢ncio pedrongvenancio at gmail.com
Fri Aug 4 03:11:55 PDT 2017


Hi Markus,

You are also completely right! Some of data I exported (elevation, slope,
aspect) did not have NULL cells. And in the other data that have NULLs, I
used r.null to ensure that the NULL value was -9999. With that I simply
transformed the NULL cells to the value -9999, wich are exported as a value
and not as a NULL.

I see now that the GRASS behaviour is the correct, because it uses
NODATA_value when the input raster contains cells with NULL value, and
omits that parameter when the input raster does not contain any NULL cell.

I was somehow mistaken because it seems that other software use
NODATA_value as a default parameter, and for instance Farsite and FlamMap,
where I use the data exported from GRASS, did not work well without the
NODATA_value in the ASCII files, even if the input data has no NULL cells.

Thank you very much!

Best regards,
Pedro





2017-08-04 9:52 GMT+01:00 Markus Neteler <neteler at osgeo.org>:

> Hi Pedro,
>
> I created a test case with the North Carolina sample dataset (by
> zooming in the GUI to the elevation map border and setting that as
> computational region):
>
> # GRASS 7.2.2svn (nc_spm_08_grass7):~ >
>
> # set computational region around east elevation map border
> g.region n=216820 s=216770 w=644960 e=645040 res=10 -p
>
> # be sure that no data pixels are involved.
> r.out.ascii input=elevation output=-
> north: 216820
> south: 216770
> east: 645040
> west: 644960
> rows: 5
> cols: 8
> 101.913734 102.054886 102.395638 102.597229 * * * *
> 101.821335 102.044083 102.331108 102.58638 * * * *
> 101.703033 101.955849 102.195648 102.54126 * * * *
> 101.56945 101.840988 102.152328 102.529175 * * * *
> 101.530174 101.792572 102.097748 102.477859 * * * *
>
> # export to AAIGrid format:
> r.out.gdal input=elevation output=elev.grd format=AAIGrid
> Driver <AAIGrid> does not support direct writing. Using MEM driver for
> intermediate dataset.
> Checking GDAL data type and nodata value...
>  100%
> Using GDAL data type <Float32>
> Input raster map contains cells with NULL-value (no-data). The value -nan
> will be used to represent no-data values in the input map. You can specify
> a nodata value with the nodata option.
> Exporting raster data to AAIGrid format...
>  100%
> r.out.gdal complete. File <elev.grd> created.
>
>
> # verification:
> cat elev.grd
> ncols        8
> nrows        5
> xllcorner    644960.000000000000
> yllcorner    216770.000000000000
> cellsize     10.000000000000
> NODATA_value  -nan
>  101.91373443603515625 102.0548858642578125 102.39563751220703125
> 102.59722900390625 -nan -nan -nan -nan
>  101.8213348388671875 102.0440826416015625 102.33110809326171875
> 102.5863800048828125 -nan -nan -nan -nan
>  101.703033447265625 101.95584869384765625 102.195648193359375
> 102.541259765625 -nan -nan -nan -nan
>  101.56945037841796875 101.8409881591796875 102.1523284912109375
> 102.5291748046875 -nan -nan -nan -nan
>  101.53017425537109375 101.792572021484375 102.097747802734375
> 102.4778594970703125 -nan -nan -nan -nan
>
> ... all fine and it works out of the box!
> Are you sure that you had any NULL cells at all? Note that the current
> computational region is respected for export.
>
> Markus
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20170804/5c6224a7/attachment-0001.html>


More information about the grass-user mailing list