merging data with a dataframe based on a common identifier
On Fri, 17 Jul 2009, stephen sefick wrote:
Do you have advice on how to order streams?
My comments were with regard to the specific dataset. The documentation for v.strahler does say that it needs a topologically complete and correct stream network, so I guess you could see how it does on artificial, simple cases with a known outcome, where you also have a suitable DEM. Increasing the complexity would show where the problems start. In spearfish streams, there are water bodies like ponds, which (I think) break the network. The example on the v.strahler page: https://svn.osgeo.org/grass/grass-addons/vector/v.strahler/description.html looks OK, but no dataset is provided. It would probably be helpful to ask for advice on using v.strahler on the grass-users list Roger
regards Stephen Sefick On Sun, Jul 12, 2009 at 5:32 PM, Roger Bivand<Roger.Bivand at nhh.no> wrote:
On Sun, 12 Jul 2009, stephen sefick wrote:
I have used v.strahler in GRASS to calculate the stream order. ?This
module writes its results to a text file. ?The line column of the
output data is the common name between the two data sets. ?I would
like to attach the stream order to the streams vector. ?I have looked
at the data once in R with
pseudocode:
streams <- readVECT6("streams")
str(streams)
Well, v.strahler is a very fresh GRASS addon, not a regular part of GRASS,
and does require a clean topology. Running it on streams in spearfish, with
the elevation.dem DEM, gives an output vector map, say st_o0:
v.strahler --verbose --overwrite input=streams output=st_o0 \
?dem=elevation.dem txout=st_o0.txt sloppy=0 layer=1
st_o0 <- readVECT6("st_o0", type="line,boundary", with_c=TRUE,
?remove.duplicates=FALSE, plugin=FALSE)
gets 116 lines. They agree with the first 116 of 119 lines in st_o0.txt:
tbl <- read.table("st_o0.txt", skip=1, header=TRUE)
by plotting. For example:
plot(st_o0, col=rainbow(27)[tbl[1:116,]$Basin.])
looks plausible. However, where the streams are not fully connected, basins
get split, with obvious consequences for the order. The cat in the vector
layer seems to be the order too, as stated on the help page - I think that
this is where the graphics on the help page are coming from. I think that
this agrees with advice that your got on the grass-users list. It may be
that you need to check the cleanness of the topology of the stream lines
carefully - this is repeated on the help page. You may also need to read the
v.strahler code to check what it is assigning, as:
plot(st_o0, col=tbl[1:116,]$Order.)
or equivalently:
plot(st_o0, col=st_o0$cat)
don't match my view of drainage in spearfish.
Hope this helps
Roger
and it is a huge list. ?I am not sure the best way to tackle this problem. thanks for any help,
-- Roger Bivand Economic Geography Section, Department of Economics, Norwegian School of Economics and Business Administration, Helleveien 30, N-5045 Bergen, Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43 e-mail: Roger.Bivand at nhh.no
Roger Bivand Economic Geography Section, Department of Economics, Norwegian School of Economics and Business Administration, Helleveien 30, N-5045 Bergen, Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43 e-mail: Roger.Bivand at nhh.no