[R] can we visualize water flows with 3d in R?

David Winsemius dwinsemius at comcast.net
Thu Oct 13 00:12:32 CEST 2016


> On Oct 12, 2016, at 4:28 AM, Duncan Murdoch <murdoch.duncan at gmail.com> wrote:
> 
> On 12/10/2016 4:49 AM, Marna Wagley wrote:
>> Hi R Users,
>> Is it possible to visualize river flow in  3D (latitude, longitude with
>> respect to depth)?
>> The example of my data looks like. Any suggestions?
>> 
>>> dat1
>>    long lat depth flow
>> 1 1015.9 857  1.00 1.50
>> 2 1015.9 857  1.25 1.23
>> 3 1015.9 857  0.50 2.00
>> 4 1015.9 858  0.10 1.95
>> 5 1015.9 858  0.20 1.50
>> 6 1025.0 858  0.30 1.20
>> 7 1025.0 858  0.40 0.50
>> 8 1025.0 858  0.35 0.70
>> 9 1025.0 858  0.24 1.20
>> 
>> Thanks for your help.
> 
> It may be, but it's hard to give a nice looking graphic of that small dataset.  You could try the rgl package and use plot3d to show spheres with radius depending on the flow rate, for example
> 
> plot3d(cbind(long, lat, depth), type="s", col="blue", radius=flow/5)

A complementary option is to install the plot3D package which I see also has a plot3Drgl "co-package". The advantage to this option is the association with beautiful modeling packages that Karline Soetaert, Peter M. J. Herman, and Thomas Petzoldt have been offering to ecologists for the last decade. (Packages: deSolve, marelac, seacarb, AquaEnv) A lot of her work has been on flows within systems. 

I usually think of "flows" in rivers as being vector fields in an incompressible fluid (water) with 6 components per point, but you can also think of them as being scalar state variables. So I suppose you could be modeling something other than mass flows.  (See Package::ReacTran for the R portal to that mathematical world.)

Best;
David Winsemius


> 
> Duncan Murdoch
> 
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

David Winsemius
Alameda, CA, USA



More information about the R-help mailing list