Description Usage Arguments Details Value See Also Examples
View source: R/visualize_channtwk.R
VisualizeChanNtwk
shows the channel network indices and provides interactive selection to retrieve link
coordinates.
1 2 |
file |
A path/name to an output YYYMMDDHHmm.CHRTOUT_DOMAIN* file or a hydroDART Posterior_Diag.nc file. |
gaugePts |
Optional list of gauge points. Nearest stream links are found. See examples. |
excludeInds |
Optional index of channel network to exclude. See examples. |
gaugeAccuracy |
The number of digits printed for the gauge information. |
plot |
Logical to plot or not. |
Read a CHANRTOUT file and display the link indicies. Returns a function which allows interactive querying of individual links for lat and lon.
The arguments of the returned function are:
location
Most generically, the center of the google (or other) map. More specifically,
this is the argument passed to the ggmap for its argument of the same name.
(Default=c(lon=mean(range(linkDf$lon)),lat=mean(range(linkDf$lat)))
)
zoom=11
The zoom level for the google (or other) map. See ggmap for more details.
source='google'
The source for the underlying map. See ggmap package for details.
maptype='terrain'
The map type for ggmap.
padPlot=.1
The fraction of the range (in both lon and lat) of the channel network to expand the plot by.
gaugeZoom=NULL
The name of the gauge you'd like to zoom in on. This will likely require finessing zoom and padPlot to make it look nice.
clickSelect=FALSE
Do you want to click on the plot to query a specfic point? You only get one click per function call.
linkShape=5
The shape code (ggplot2) for the gridded link elements.
gaugeShape=4
The shape code (ggplot2) for the gauges.
A function which allows the plot to be interactively queried once each time it is run and returns the coordinates of the selected location. Details provided in details above.
Other domain: GetDomainCoordsProj
,
VisualizeDomain
,
VisualizeSpatial
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | ## See the vignette "WRF Hydro Domain and Channel Visualization", for details.
## Not run:
tcPath <- '~/wrfHydroTestCases/'
fcPath <- paste0(tcPath,'Fourmile_Creek/')
chrtFile <- paste0(fcPath,'/RUN.RTTESTS/OUTPUT_CHRT_DAILY/201308010000.CHRTOUT_DOMAIN1')
## The basic function call returns a function which you will use.
LocLinkFun<- VisualizeChanNtwk(chrtFile)
## You can look at the function arguments with
args(LocLinkFun)
## Next, click at the outlet point to see that it has (q=) 0 flow.
LocLinkFun(click=TRUE)
## Any set of valid indices can be excluded.
LocLinkFun<-VisualizeChanNtwk(chrtFile, exclude=350)
## Now clicking at the lowest point reveals that that index is 1.
LocLinkFun(click=TRUE)
## Add gauges and find their nearest links' coords
gaugePts <-
list(orodell =data.frame(lon=254.67374999999998408,
lat=40.018666670000001773),
loganMill =data.frame(lon=254.63508330000001934,
lat=40.042027779999997961),
sunshine =data.frame(lon=254.65122220000000652,
lat=40.05761110000000258) )
## You can just get the location information.
VisualizeChanNtwk(chrtFile, gaugePts=gaugePts, plot=FALSE)
## But you'll still want to exclude the lowest point.
LocLinkFun <- VisualizeChanNtwk(chrtFile, gaugePts=gaugePts, exc=350, plot=FALSE)
## Increase the accuracy of the lon/lat ouput
LocLinkFun <- VisualizeChanNtwk(chrtFile, gaugePts=gaugePts, exc=350, plot=FALSE, gaugeAccuracy=17)
## Now make the plot that was suppressed in the previous call.
LocLinkFun()
## Change the amount of padding around the domain and the shape of the gauge symbols.
LocLinkFun(pad=.3, gaugeShape=16)
## Zoom to the orodell gauge.
LocLinkFun(zoom=14, gaugeShape=16, gaugeZoom='orodell', pad=15)
## Zoom to logan mill gauge
LocLinkFun(zoom=15, gaugeShape=16, gaugeZoom='loganMill', pad=15)
LocLinkFun(zoom=15, gaugeShape=16, gaugeZoom='loganMill', pad=15, click=TRUE)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.