KevinSee / PITcleanr

Compress PIT tag capture histories for use in various analyses
https://kevinsee.github.io/PITcleanr/
Creative Commons Attribution 4.0 International
8 stars 6 forks source link

`downstream_sites = T` in `queryFlowlines()` #44

Closed mackerman44 closed 11 months ago

mackerman44 commented 11 months ago

For reasons unknown, when I run queryFlowlines() with dwn_flw = T, I'm receiving the error Error in FUN(X[[i]], ...) : !anyNA(x) is not TRUE which was running in recent weeks just fine. When I set dwn_flw = F I do not get that error. I have verified that every site in sites_sf has a lat/lon and verified that I'm using the same downstream sites as previously.

It's fine for now, because I'm building my parent-child table for downstream sites manually at the moment, but I am unable to download the downstream flowlines currently, which just creates less than ideal maps :)

KevinSee commented 11 months ago

@mackerman44 , do you have an example of which sites your using, or a snippet of code to share that would help me try to replicate that error?

-Kevin

KevinSee commented 11 months ago

@mackerman44 , can you also confirm what version of the nhdplusTools package you're running?

KevinSee commented 11 months ago

I also just made one fix to queryFlowlines() that was throwing an error when querying downstream flowlines when the buffer_dist was set to 0, which is the default. So that might be what was causing your error @mackerman44 . Could you doublecheck if the new function in the develop branch has fixed your issue?

mackerman44 commented 11 months ago

@KevinSee I am using the sites_sf object within "data/configuration/sites_config_LGR_20231026.rda" in the mackerman44/SnakeRiverPopStatus repo.

load(here("data/configuration_files/site_config_LGR_20231026.rda"))

and running the following...

dwn_flw = T # do you want flowlines downstream of root site? Set to TRUE if you have downstream sites nhd_list = queryFlowlines(sites_sf = sites_sf, root_site_code = "LGR", min_strm_order = 2, dwnstrm_sites = dwn_flw, dwn_min_stream_order_diff = 4)

And I am using version 1.0.0 of nhdPlusTools. I will update PITcleanr shortly and re-test.

mackerman44 commented 11 months ago

@KevinSee Not sure what you did, but queryFlowlines() was able to download the flowlines downstream of LGR this morning, just fine. I'll leave this issue open for now in case you want to explore the issue a bit further using the sites_sf object in SnakeRiverPopStatus.

KevinSee commented 11 months ago

I don't think I have access to the SnakeRiverPopStatus repo, but I did use load this Rdata file from the SRB_OncorPopStatus repo: data/configuration_files/site_config_LGR_20231012.rda, and I was able to download flowlines using the sites_sf object in there, including downstream ones. Based on that, I'm going to go ahead and close this issue.