VisualizeRouteLink: Visualize RouteLink.nc files.

Description Usage Arguments See Also Examples

View source: R/visualize_routelink.R

Description

Visualize RouteLink.nc files.

Usage

1
2
VisualizeRouteLink(file = "Route_Link.nc", downstreamReExp = "",
  parallel = FALSE)

Arguments

file

Character path/file to the desired Route_Link.nc netcdf file.

downstreamReExp

Character, eliminate searching by providing the re-expressed network file

parallel

Logical, use a registerred parallel backend for plyr?

See Also

Other networkExpression nudging: GatherStreamInds, NtwKReExToNcdf, ReExpNetwork, ReExpressRouteLink, ReIndexRouteLink, VisualizeSubsetStream

Examples

 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
## Not run: 
library(rwrfhydro)
file <- '~/WRF_Hydro/DOMAIN_library/FRNG_1km_100m_1sqkm_routing_NHD_2015_08_10/Route_Link.nc'
doMC::registerDoMC(3)
PlotRouteLink <- VisualizeRouteLink(file, parallel=TRUE)
thePlot <- PlotRouteLink()
gagePoints <- data.frame(
   lat=c(40.04202778000000, 40.05761110000000, 40.01866667000000, 40.05165184000000),
   lon=c(-105.36491669999999,-105.34877779999999,-105.32625000000000,-105.17887540000000), 
   name=c('FOURMILE CREEK AT LOGAN MILL ROAD NEAR CRISMAN',
          'FOURMILE CANYON CREEK NEAR SUNSHINE',
          'FOURMILE CREEK AT ORODELL', 
          'BOULDER CREEK AT NORTH 75TH ST. NEAR BOULDER'),
   gageId=c(''))
thePlot <- PlotRouteLink(gageZoom=gagePoints)
thePlot <- PlotRouteLink(gageZoom=gagePoints[4,], pad=.03, zoom=11)

Second example, get all the gages in the domain:
library(rwrfhydro)
doMC::registerDoMC(3)
file <- '~/WRF_Hydro/DOMAIN_library/FRNG_1km_100m_1sqkm_routing_NHD_2015_08_10/Route_Link.nc'
# Find the proper radius in which to search for gages
rl <- GetNcdfFile(file)
lonRange <- range(rl$lon)
latRange <- range(rl$lat)
# These are identical by virtue of the mean
# (lonRange[2]-mean(lonRange))^2 + (latRange[2]-mean(latRange))^2
rad <- sqrt((lonRange[1]-mean(lonRange))^2 + (latRange[1]-mean(latRange))^2)*1.1
stnsInRad <- FindUsgsStns(stnLon=mean(lonRange), stnLat=mean(latRange), within=rad)
stnsInDom <- subset(stnsInRad, dec_lat_va >= latRange[1] &
                               dec_lat_va <= latRange[2] &
                               dec_long_va >= lonRange[1] &
                               dec_long_va <= lonRange[2] )
gagePoints2 <- stnsInDom[,c(7,8,10,11)]
renamer <- c("gageId",'name','lat','lon')
names(renamer) <- names(stnsInDom)[c(7,8,10,11)]
gagePoints2 <- plyr::rename(gagePoints2, renamer)
PlotRouteLink <- VisualizeRouteLink(file, parallel=TRUE)
thePlot <- PlotRouteLink(gageZoom=gagePoints2[17,], pad=.02, zoom=12)
thePlot <- PlotRouteLink(gageZoom=gagePoints2, pad=.02, zoom=12, 
plotPath='~/WRF_Hydro/DOMAIN_library/FRNG_1km_100m_1sqkm_routing_NHD_2015_08_10/gageIdPlots/')
thePlot <- PlotRouteLink(gageZoom=gagePoints2, pad=.02, zoom=12)

# just show the boulder creek domain
file <- '~/WRF_Hydro/DOMAIN_library/BoCr_100m_1km_NHDPlus_2015_08_11/Route_Link.nc'
PlotRouteLink <- VisualizeRouteLink(file, parallel=TRUE)
foo <- PlotRouteLink()
load('~/WRF_Hydro/DOMAIN_library/BoCr_100m_1km_NHDPlus_2015_08_11/Route_Link.reInd.Rdb')
foo$rl$link <- 1:nrow(reInd)
foo$ggObj + ggplot2::geom_text(data=foo$rl, 
                               ggplot2::aes(x=lon/2+to_lon/2, 
                                            y=lat/2+to_lat/2, 
                               label=as.character(link)), 
                               color='darkred')

## End(Not run)

mccreigh/rwrfhydro documentation built on Feb. 28, 2021, 1:53 p.m.