AddRouteLinkGage: Add a 'gages' column to a RouteLink.nc file

Description Usage Arguments See Also Examples

View source: R/frxst_gage_points_add.R

Description

Add a 'gages' column to a RouteLink.nc file

Usage

1
2
AddRouteLinkGage(rlFile, gageIds, comIds, newCopyId, gageMiss = "",
  overwrite = FALSE)

Arguments

rlFile

Character path+file for the desired Route_Link.nc file

gageIds

Vector of character identifiers for the gages, max length = 15. Must collocate with comIds.

comIds

Vector of integer comIds for identifying the links (existing in rlFile). Must collocate with comIds.

newCopyId

Character identifier for the new copy of the fullDomFile with specified frxst_pts.

gageMiss

Value which indicates no gage at this link.

overwrite

Logical If the output path/file created from fullDomFile and newCopyId already exists, then overwrite it.

See Also

Other nudging: ChanObsToTimeSlice, EditFrxstPts, MkNudgingParams

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
## Not run: 
rlFile <- '~/WRF_Hydro/DOMAIN_library/Boulder_Creek_100m_1km_2sqkm_full_2015_09_03/Route_Link.nc'
gageIds <- c('06730200', #BOULDER_CREEK_AT_NORTH_75TH_ST._NEAR_BOULDER_CO
             '06730160', #FOURMILE_CANYON_CREEK_NEAR_SUNSHINE_CO
             # '06727410', #FOURMILE_CREEK_AT_LOGAN_MILL_ROAD_NEAR_CRISMAN_CO
             '06727500'  #FOURMILE_CREEK_AT_ORODELL_CO
             )
comIds <- c( 42,  #BOULDER_CREEK_AT_NORTH_75TH_ST._NEAR_BOULDER_CO
             38,   #FOURMILE_CANYON_CREEK_NEAR_SUNSHINE_CO
             # 200,  #FOURMILE_CREEK_AT_LOGAN_MILL_ROAD_NEAR_CRISMAN_CO
             82   #FOURMILE_CREEK_AT_ORODELL_CO
              )
newCopyId <- 'threeRealGagesTEST'
AddRouteLinkGage(rlFile, gageIds, comIds, new=identifier)
if(FALSE) {
library(rwrfhydro)
rlFile <- '~/RouteLink_2015_12_15.nc'
p <- ncdump("~/nudgingParams.conusPstActive.nc",'stationId',q=TRUE)
g <- ncdump(rlFile,'gages',q=TRUE)
whGAndP <- which(g %in% p)
whGNotP <- which(!(g %in% p))
(length(whGAndP)+length(whGNotP))==length(g)
g[whGNotP] <- formatC('', width=15)
setdiff(g,p)
setdiff(p,g)
comIds <- ncdump(rlFile,'link', q=TRUE)
newCopyId <- 'conusPstActive'
gageIds <- g

## NO HI and PR
library(rwrfhydro)
#rlFile <- '~/RouteLink_2016_02_19_no_HI_PR.nc'
rlFile <- '~/WRF_Hydro/TESTING/TEST_FILES/CONUS/WORKING/DOMAIN/RouteLink_2016_02_19_no_HI_PR_goodlakes1260.nc'
p <- ncdump("~/nudgingParams.conusPstActive.nc",'stationId',q=TRUE)
g <- ncdump(rlFile,'gages',q=TRUE)
whGAndP <- which(g %in% p)
whGNotP <- which(!(g %in% p))
(length(whGAndP)+length(whGNotP))==length(g)
g[whGNotP] <- formatC('', width=15)
setdiff(g,p)
setdiff(p,g)
comIds <- ncdump(rlFile,'link', q=TRUE)
newCopyId <- 'conusPstActive'
gageIds <- g
}

## End(Not run)

NCAR/rwrfhydro documentation built on Feb. 28, 2021, 12:47 p.m.