I'm trying to create a dem from digitized contour lines with r.surf.nnbathy. I've started with vector contour lines, converted them to a raster with v.to.rast, then interpolate these using r.surf.nnbathy. The output looks good, except that it is speckled with random-looking null cells, as in the enclosed screen shot (white are nulls)
Nick Cahill wrote:
I'm trying to create a dem from digitized contour lines with
r.surf.nnbathy. I've started with vector contour lines, converted them
to a raster with v.to.rast, then interpolate these using r.surf.nnbathy.
The output looks good, except that it is speckled with random-looking
null cells, as in the enclosed screen shot (white are nulls)I can't figure out what is causing these: some are on a contour line,
some are between contours; I don't see an obvious pattern. Is this a
known issue with r.surf.nnbathy, and if so, is there a workaround?
Hi Nick,
Glad to see somebody using it!
I haven't had such an issue on my Linux box. Any chances you have a
mask set?
On a related note, when I've tried to fill the nulls with r.fillnulls,
the program crashes gis.m with a segmentation fault, leaving a couple
temporary rasters and a mask.
Try reproducing this in spearfish and please report a bug if confirmed.
I'm running GRASS 6.3, on Mac OS X 10.4.8, using William Kyngesburye's
excellent binaries (dated 9/29/06, maybe not the most recent build). I
built the binary for nnbathy myself; perhaps this is the problem. How
would I test that?
Dunno. What nnbathy version? Last I tried was 1.66 and it works as good
as few previous versions. Can you reproduce the error on Linux?
Can you reproduce the error with plain nnbathy on your Mac? (look for
supiciously located 'NaN's in it's output; there shouldn't be any
within the convex hull) If so, please contact Pavel Sakov, the author,
and let us now the status.
Maciek
Nick Cahill wrote:
On a related note, when I've tried to fill the nulls with
r.fillnulls, the program crashes gis.m with a segmentation fault,
leaving a couple temporary rasters and a mask.
does r.fillnulls work from the command line?
Hamish
Nick Cahill wrote:
> I'm trying to create a dem from digitized contour lines with
> r.surf.nnbathy. I've started with vector contour lines, converted them
> to a raster with v.to.rast, then interpolate these using r.surf.nnbathy.
> The output looks good, except that it is speckled with random-looking
> null cells, as in the enclosed screen shot (white are nulls)
>
> I can't figure out what is causing these: some are on a contour line,
> some are between contours; I don't see an obvious pattern. Is this a
> known issue with r.surf.nnbathy, and if so, is there a workaround?Hi Nick,
Glad to see somebody using it!
I haven't had such an issue on my Linux box.
I had the same problem as Nick and couldn't figure what is causing these
speckles. While collecting cases for a report i decided not to interpolate the
data at all.
cheers,
robert
Robert Nuske wrote:
Nick Cahill wrote:
I'm trying to create a dem from digitized contour lines with
r.surf.nnbathy.
The output looks good, except that it is speckled with random-looking
null cells, as in the enclosed screen shot (white are nulls)
I had the same problem as Nick and couldn't figure what is causing these
speckles. While collecting cases for a report i decided not to interpolate the
data at all.
Robert and Nick,
Are you both using Mac?
Please reproduce the error with small datasets, and send them over to
me along with your exact region settings, r.surf.nnbathy syntax and the
nnbathy version you used (if you built it yourself, specify if "serial
processing" enabled).
Like I said, r.surf.nnbathy has been working well for me. If you want
me to help you I need details.
Cheers,
Maciek
Dear Maciej,
I was hoping that you would reply and offer to help with this. It's interesting that someone else is having the same problem, and that you're not; at least I'm not crazy.
I am using a Mac; I built nnbathy myself, following the directions on the r.surf.nnbathy help page --
1. Download nn.tar.gz from http://www.marine.csiro.au/~sakov/
2. tar xzvf nn.tar.gz
3. cd nn
4. ./configure
5. make
6. gcc -o nnbathy nnbathy.c -g -O2 -Wall -pedantic -I. -DNN_SERIAL libnn.a -lm
7. chmod u+x ./nnbathy
So I'm pretty sure I specified serial processing enabled.
I ran r.surf.nnbathy input=contours output=nnbathytest
My region was
projection: 1 (UTM)
zone: 35
datum: wgs84
ellipsoid: wgs84
north: 4260094.61044678
south: 4259866.85324284
west: 591019.57338036
east: 591322.93463532
nsres: 1.99787021
ewres: 1.99579773
rows: 114
cols: 152
cells: 17328
I used a rasterized contour map as a source:
+----------------------------------------------------------------------------+
| Layer: contours Date: Wed Nov 8 21:26:32 2006 |
| Mapset: nick Login of Creator: nick |
| Location: sardis |
| DataBase: /Volumes/Artemisia/Grass |
| Title: contours ( contours ) |
| timestamp: none |
|----------------------------------------------------------------------------|
| |
| Type of Map: raster Number of Categories: 0 |
| Data Type: DCELL |
| Rows: 4500 |
| Columns: 3002 |
| Total Cells: 13509000 |
| Projection: UTM (zone 35) |
| N: 4263814.6288481 S: 4254813.86981583 Res: 2.00016867 |
| E: 591978.16296956 W: 585973.39371108 Res: 2.00025625 |
| Range of data: min = 74.000000 max = 914.000000 |
| |
| Data Source: |
| Vector Map: contours in mapset nick |
| Original Scale from Vector Map: 1:1 |
| |
| Data Description: |
| generated by v.to.rast |
| |
| Comments: |
| v.to.rast input="contours" output="contours" use="z" layer=1 value=1\ |
| rows=4096 |
| |
+----------------------------------------------------------------------------+
The region was set to 2 meter resolution, same as the contour map. I had zoomed in with gis.m, then set the region to the current window.
The output again had these annoying nulls.
I won't put the files in as an attachment, but am putting relevant files in a directory at
http://mywebspace.wisc.edu/ndcahill/web/nnbathy_stuff/
These are:
http://mywebspace.wisc.edu/ndcahill/web/nnbathy_stuff/nnbathytest.jpg
http://mywebspace.wisc.edu/ndcahill/web/nnbathy_stuff/contour.ascii - r.out.ascii of the relevant section of the contour map
http://mywebspace.wisc.edu/ndcahill/web/nnbathy_stuff/nnbathytest.ascii - r.out.ascii of the nnbathy results
http://mywebspace.wisc.edu/ndcahill/web/nnbathy_stuff/currentregion - region settings
http://mywebspace.wisc.edu/ndcahill/web/nnbathy_stuff/mapinfo - r.info of contour map
and for what it's worth, the binary nnbathy, if that's any use (built for ppc macintosh using latest Apple developer tools)
Many many thanks for your help with this. I deeply appreciate it.
Yours,
Nick Cahill
Yes, it does work from the command line -- thank you!
Nick Cahill
On Nov 12, 2006, at 9:40 PM, Hamish wrote:
Nick Cahill wrote:
On a related note, when I've tried to fill the nulls with
r.fillnulls, the program crashes gis.m with a segmentation fault,
leaving a couple temporary rasters and a mask.does r.fillnulls work from the command line?
Hamish
Nick Cahill wrote:
and for what it's worth, the binary nnbathy, if that's any use (built
for ppc macintosh using latest Apple developer tools)
I can't run it, I have only x86 Linux. What version is it (nnbathy -v)?
Maciek
Dear Maciek,
nnbathy -v
nnbathy/nn version 1.67
On Nov 14, 2006, at 1:01 AM, Maciej Sieczka wrote:
Nick Cahill wrote:
and for what it's worth, the binary nnbathy, if that's any use (built
for ppc macintosh using latest Apple developer tools)I can't run it, I have only x86 Linux. What version is it (nnbathy -v)?
Maciek
Guys,
I could reproduce Nick's null speckless bug with his data. I don't know
why it is happening, but it has to do with Nick's resolution, which as
he says, was set to:
nsres: 1.99787021
ewres: 1.99579773
When I change the resolution to nice round '2', by:
$ g.region rast=nick.contours res=2 -ag
the r.surf.nnbathy produces a good result - no speckles.
I'll look into this. For know stick to round resolution, sorry.
Cheers,
Maciek
> I can't run it, I have only x86 Linux. What version is it (nnbathy -v)?
nnbathy -v
nnbathy/nn version 1.67
fwiw, I see version 1.68 is now available.
http://www.marine.csiro.au/~sakov/
Hamish
Robert Nuske wrote:
When I change the resolution to nice round '2', by:
$ g.region rast=nick.contours res=2 -ag
the r.surf.nnbathy produces a good result - no speckles.
I'll look into this. For know stick to round resolution, sorry.
you mean whole numbers / integers?
As far as I can tell - multiples of 0.25. I've emailed the author
yesterday about the issue. I'll keep you updated via the grass-list.
all my rasters have resolutions in the centimeter realm. does that mean no
nnbathy for me?
In my script I use nnbathy to generate the grid coordinates to
interpolate at, but it showed nnbathy fails to generate them properly
under some circumstances. However, you can tell nnbathy to interpolate
at coordinates which *you* specify in an ASCII file (read nnabthy -h
about the -i switch) eg.:
nnbathy -i input_xyz -o canvas_xyz > output_xyz
You can create such a "canvas" grid with r.stats -1g, which prints the
coordinates of cell's centers:
# spit out the "canvas" coords for nnbathy to interpolate in
r.stats -1g input=contours | awk '{print $1" "$2}' > canvas_xyz
Try using the attached earlier version of r.surf.nnbathy (1.2). It
implements this method. I was using it at first, but I switched to
letting nnbathy control the output grid coordinates, as this doesn't
require additional big temporary file. Unfortuantelly this method fails
when it comes to resolution different than a multiple of 0.25. I
couldn't find an error in my awk maths (which doesn't mean it's not
there for sure ) and emailed the nnbathy author. I'll let you know
once the problem is sorted out.
Best,
Maciek
Maciej Sieczka wrote:
Try using the attached earlier version of r.surf.nnbathy (1.2).
Now attaching it. Really.
Maciek
(attachments)
r.surf.nnbathy_12 (4.38 KB)
Hi All,
The defect is in nnbathy. Pavel has confirmed that, and he is working
on it.
I'll let you know when the fixed version is available.
Maciek
Dear All,
Pavel Sakov has just released a fixed nn 1.69 version [1]. I don't have
the time to test right now, so I'm just letting you know the status
according to Pavel. I will update you further when I check it myself.
Nick and Robert,
Please try the new nnbathy version and let us now if the speckles are
still there.
Maciek
Hi,
this works with DBF but fails with SQLite:
where="str_2 ~ 'Wed'"
DBMI-SQLite driver error:
Error in sqlite3_prepare():SELECT cat FROM icebergs WHERE str_2 ~ 'Wed'
near "~": syntax error
with SQLite it has to be:
where="str_2 LIKE '%Wed%'"
is "~" non-standard SQL? is there other syntax which can't be trusted
to work the same? (not including DBF limitations)
see
http://grass.ibiblio.org/grass63/manuals/html63_user/grass-dbf.html
?
thanks,
Hamish
Hamish wrote on 11/23/2006 03:38 AM:
Hi,
this works with DBF but fails with SQLite:
where="str_2 ~ 'Wed'"DBMI-SQLite driver error:
Error in sqlite3_prepare():SELECT cat FROM icebergs WHERE str_2 ~ 'Wed'
near "~": syntax errorwith SQLite it has to be:
where="str_2 LIKE '%Wed%'"is "~" non-standard SQL? is there other syntax which can't be trusted
to work the same? (not including DBF limitations)see
http://grass.ibiblio.org/grass63/manuals/html63_user/grass-dbf.html?
Hi Hamish,
please take a look at
http://grass.itc.it/pipermail/grass5/2006-February/021301.html
Markus
Maciej Sieczka wrote:
Pavel Sakov has just released a fixed nn 1.69 version [1]. I don't have
the time to test right now, so I'm just letting you know the status
according to Pavel. I will update you further when I check it myself.
Nick and Robert,
Please try the new nnbathy version and let us now if the speckles are
still there.
Just tried myself, and I report that I'm not able reproduce Nick's
problem with his data anymore, using nn 1.69. Great job Pavel! I'd
consider the problem fixed.
Cheers,
Maciek