-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
get_characteristics_metadata()
failed to find the file
#365
Comments
Sorry to be slow here -- I've been flustered by this issue for a while as it's been tricky to reproduce. I'm going to try something and see if it fixes it for others. |
I now see: Restarting R session...
> nhdplusTools::nhdplusTools_data_dir()
[1] "C:\\Users\\dblodgett\\AppData\\Roaming/R/data/R/nhdplusTools"
> library(nhdplusTools)
> nhdplusTools_data_dir()
[1] "C:\\Users\\dblodgett\\AppData\\Roaming/R/data/R/nhdplusTools" |
I installed |
Great!! It will be in the next CRAN release then. |
I am once again running up against the filepath issue only this time it is with I am using v1.1.0 The setup: library(nhdplusTools)
library(sf)
example_pt_sf <- structure(list(site_no = "01095220", tz_cd = "EST",
geometry = structure(list(
structure(c(-71.790667835997, 42.410900479658), class = c("XY", "POINT", "sfg"))),
class = c("sfc_POINT", "sfc"), precision = 0,
bbox = structure(c(xmin = -71.790667835997, ymin = 42.410900479658, xmax = -71.790667835997, ymax = 42.410900479658), class = "bbox"),
crs = structure(list(input = "EPSG:4326", wkt = "GEOGCRS[\"WGS 84\",\n ENSEMBLE[\"World Geodetic System 1984 ensemble\",\n MEMBER[\"World Geodetic System 1984 (Transit)\"],\n MEMBER[\"World Geodetic System 1984 (G730)\"],\n MEMBER[\"World Geodetic System 1984 (G873)\"],\n MEMBER[\"World Geodetic System 1984 (G1150)\"],\n MEMBER[\"World Geodetic System 1984 (G1674)\"],\n MEMBER[\"World Geodetic System 1984 (G1762)\"],\n MEMBER[\"World Geodetic System 1984 (G2139)\"],\n ELLIPSOID[\"WGS 84\",6378137,298.257223563,\n LENGTHUNIT[\"metre\",1]],\n ENSEMBLEACCURACY[2.0]],\n PRIMEM[\"Greenwich\",0,\n ANGLEUNIT[\"degree\",0.0174532925199433]],\n CS[ellipsoidal,2],\n AXIS[\"geodetic latitude (Lat)\",north,\n ORDER[1],\n ANGLEUNIT[\"degree\",0.0174532925199433]],\n AXIS[\"geodetic longitude (Lon)\",east,\n ORDER[2],\n ANGLEUNIT[\"degree\",0.0174532925199433]],\n USAGE[\n SCOPE[\"Horizontal component of 3D system.\"],\n AREA[\"World.\"],\n BBOX[-90,-180,90,180]],\n ID[\"EPSG\",4326]]"), class = "crs"),
n_empty = 0L),
tar_group = 1L),
sf_column = "geometry",
agr = structure(c(site_no = NA_integer_, tz_cd = NA_integer_, tar_group = NA_integer_),
levels = c("constant", "aggregate", "identity"), class = "factor"),
row.names = 1L, class = c("sf", "data.frame")) The failing command: # This is failing because it is attempting to look in a folder under a user called "CRAN"
get_flowline_index(points = example_pt_sf,
flines = "download_nhdplusv2")
Spherical geometry (s2) switched off
although coordinates are longitude/latitude, st_intersects assumes that they are planar
Spherical geometry (s2) switched on
Error in file(file, mode) : cannot open the connection
In addition: Warning message:
In file(file, mode) :
cannot open file 'C:\Users\CRAN\AppData\Roaming\R\data\R\nhdplusTools/e983b9af29673b1e': No such file or directory I attempted to use the previous work around where I force the data directory to change, but that did not seem to work. It appears to still be looking for a filepath under "CRAN" nhdplusTools::nhdplusTools_data_dir(tools::R_user_dir("nhdplusTools"))
# But re-running doesn't seem to do the trick
get_flowline_index(points = example_pt_sf,
flines = "download_nhdplusv2")
Spherical geometry (s2) switched off
although coordinates are longitude/latitude, st_intersects assumes that they are planar
Spherical geometry (s2) switched on
Error in file(file, mode) : cannot open the connection
In addition: Warning message:
In file(file, mode) :
cannot open file 'C:\Users\CRAN\AppData\Roaming\R\data\R\nhdplusTools/e983b9af29673b1e': No such file or directory |
Can you try an install from github? I must have missed the fix for this in this case. |
That slightly changed the behavior! Still erroring, though. I think because the path is to a directory, not a file
|
what in the heck... I'm working on nhdplusTools now and will see if I can get this fixed up quick here. Do you have a deeper traceback to where the error is coming from? |
Is this helpful?
|
very. |
OK, this is actually a subtly different bug from before.
See if that does it? |
Hmmm I still seem to be getting the same error.
|
Not sure if these versions matter but I am having trouble updating
I'll keep trying but I don't know if any of them have a feature that is necessary for the updates you made to work. |
hmmm.... I can't reproduce. Working on it here. Does C:\Users\lrtta\AppData\Roaming\R\data\R\nhdplusTools/ exist? Try setting
in .Renviron and see what you get after a restart? |
One other question -- what do you get when you do: |
Yes, it does exist and there is a folder and one file in that directory. Inside the folder is the zip of the NHD+ Geodatabase
I just add a > get_flowline_index(points = example_pt_sf,
+ flines = "download_nhdplusv2")
Spherical geometry (s2) switched off
although coordinates are longitude/latitude, st_intersects assumes that they are planar
Spherical geometry (s2) switched on
id COMID REACHCODE REACH_meas offset
1 1 6078267 01070004000476 50.8154 0.0005745375
|
OK -- one more commit incoming that might fix this? I'm super confused why the file system cache isn't working. When you get a sec, can you install from that github branch again and try it without setting the environment variables? |
Yes, that is working with your latest commit and not setting any environment variables! |
I'll get this on cran soon -- am getting something new wrapped up and will get it released at the same time. |
I believe this is similar to #343 as it has to do with the file paths.
The issue
When I try to list the metadata attributes, I get the following error:
I think the key here is this chunk:
Failed to open file C:\Users\CRAN\AppData\Roaming\R\data\R\nhdplusTools\metadata_table.tsv.
. That filepath does not exist on my computer.I saw that you mentioned the code is using whatever is returned from
tools::R_user_dir("nhdplusTools")
but my nhdplusTools dir and that one are different:Current workaround
For now, I can run this before my command to get around this issue.
Version info
I am using
nhdplusTools v1.0.0
inR version 4.2.1 (2022-06-23)
andRStudio 2023.09.0 Build 463
.The text was updated successfully, but these errors were encountered: