-
Notifications
You must be signed in to change notification settings - Fork 12
Description
Hello,
I am looping through a set of coastal VPU UnitIDs to access NHDFlowlines and their VAAs such as:
choose a VPU
vpu_i <- coastalVPUs[i,]
get and load that VPU's flowlines
nhd_plus_get(vpu = vpu_i, component = "NHDSnapshot", temporary = FALSE)
flowlines_i <- nhd_plus_load(vpu = vpu_i, component = "NHDSnapshot", dsn = "NHDFlowline")
get and load that VPU's VAAs
nhd_plus_get(vpu = vpu_i, component = "NHDPlusAttributes", temporary = FALSE)
vaa_i <- nhd_plus_load(vpu = vpu_i, "NHDPlusAttributes", "PlusFlowlineVAA")
elevslope_i <- nhd_plus_load(vpu = vpu_i, "NHDPlusAttributes", "elevslope")
join flowlines and VAAs
flowlinesVAA_i <- left_join(flowlines_i, vaa_i, by = c("COMID"))
left_join(., elevslope_i, by = c("COMID"))
However, when I try to load VPU 17's flowlines I receive the following error:
Error in if (nchar(dsn) < 1) stop("dsn must point to a source, not an empty string.", :
the condition has length > 1
It seems that nhd_plus_load() is attempting to load all the NHDFlowline shapefiles that I have so far downloaded into the persistent location instead of only that of VPU 17. For example, nhd_plus_info(17, "NHDSnapshot") returns...
[1] "NHDArea.dbf" "NHDArea.dbf"
[3] "NHDArea.dbf" "NHDArea.dbf"
[5] "NHDArea.dbf" "NHDArea.dbf"
[7] "NHDArea.dbf" "NHDArea.dbf"
[9] "NHDArea.dbf" "NHDArea.dbf"
[11] "NHDArea.dbf" "NHDArea.shp"
[13] "NHDArea.shp" "NHDArea.shp"
[15] "NHDArea.shp" "NHDArea.shp"
[17] "NHDArea.shp" "NHDArea.shp"
[19] "NHDArea.shp" "NHDArea.shp"
[21] "NHDArea.shp" "NHDArea.shp"
(etc.)
...where I count 11 repetitions for the 11 VPUs I have already downloaded. This does not occur for any other VPU loaded with nhd_plus_load(). If the persistent location only contains the snapshot for VPU 17, I am able to load the flowlines just fine.
However, loading VPU 17's VAAs returns those of VPU 18 instead. I noticed this because there were no shared COMIDs between the flowlines and VAAs of VPU 17. The AWS link shown when called appears correct...
nhd_plus_get(vpu = 17, component = "NHDPlusAttributes", temporary = FALSE)
---amazonaws.com/NHDPlusV21/Data/NHDPlusPN/NHDPlusV21_PN_17_NHDPlusAttributes_10.7z
...so this might be on the USGS end of things.
Thanks!
Aaron