Giter Site home page Giter Site logo

drb-network-prep's People

Contributors

jpadilla-usgs avatar lkoenig-usgs avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

drb-network-prep's Issues

Omit divergences from crosswalk table for reaches within `drb_segs_spatial`

Even if omit_divergences = TRUE, some reaches in p2_drb_comids_all_tribs represent divergent reaches (where STREAMORDE != STREAMCALC). It appears that these reaches are associated with PRMS/NHM segments included in drb_segs_spatial. Add a step to get_intersecting_nhdplus_catchments() to exclude these reaches when building the crosswalk table if omit_divergences = TRUE.

> tar_load(p1_nhdv2reaches_sf)
> tar_load(p2_drb_comids_all_tribs)
> p2_drb_comids_all_tribs %>% 
+     mutate(COMID = as.integer(COMID)) %>% 
+     left_join(sf::st_drop_geometry(p1_nhdv2reaches_sf[,c("COMID","STREAMORDE","STREAMCALC")]), by = "COMID") %>% 
+     filter(STREAMORDE != STREAMCALC) %>% pull(PRMS_segid) %>% 
+     unique()
 [1] "1256_1" "2137_1" "2138_1" "233_1"  "249_1"  "2757_1" "2758_1" "2765_1" "2766_1" "2767_1" "2797_1" "354_1"  "355_1"  "396_1"  "593_1" 
>

hru's without hru_ids in GFV1_catchments_edited

Jake mentioned the need for universal ids in hru processing tasks (USGS-R/drb_gridmet_tools#11 (comment)). I was looking into this for the gridmet data. In the GFv1_catchments_edited.gpkg file, there is an hru_id column which seems like would serve the purpose of more "universal" identifier. A couple questions I have about this:

  1. Is this hru_id_nat?

  2. I noticed that for 6 of the 867 hru's, there is no hru_id. These are for the three segments that have been split (3_1/3_2, 51_1/51_2, 8_1/8_2). I'm wondering if we should still assign the original hru_id to the *_1 segments and maybe to the *_2 segments too.

Look into using nhdplusTools helpers instead of traverse_nhd()

I'm wondering if the code to build the NHM - NHDPlusv2 crosswalk table could be made simpler and thus more readable by replacing traverse_nhd() with some helpers from nhdplusTools. Due to idiosyncrasies in the NHM v1.0 network this may not necessarily be a better solution to what we've got, but probably worth considering.

460 nhd flowlines do not have catchments in DRB

I was looking at the nhd catchments/flowlines in the DRB. Since these will likely be added to this repo, I wanted to make a note of something I found.

Of the 12970 nhd flowlines in the DRB, 460 do not have an associated catchment.

These 460 are all very small. Some cross over catchment boundaries.

Here are a couple samples (the red ones do not have catchments)

Here'e an overview of the lengths of the segs w/ and w/o catchments:

image

See here for code: https://gist.github.com/jsadler2/504067b814c2d2601e1241ddf3ad7a16

Omit special handling steps when identifying contributing catchments

Omit special handling steps when identifying comid_cat for the subset of segments defined in drb_segs_spatial. See #15 for further details.

This means omitting:

  • drb_segs_spatial from _targets.R
  • get_intersecting_nhdplus_catchments() in 2_process/pair_nhd_catchments.R
  • pair_nhd_catchments in 2_process/pair_nhd_catchments.R

Check crosswalk table for zero-area COMIDs

There are PRMS segments where comid_down, comid_seg, or comid_cat are zero-area COMIDs (i.e., with AREASQKM = 0). From the drb-inland-salinity-ml, it would be ideal if all COMIDs had attributes. Check these instances of zero-area COMIDs and if possible, omit these from the crosswalk table.

Missing NHD catchments as a result of omitting divergences

When I started working on #17, I noticed that using p2_drb_comids_all_tribs results in some notable "holes" in the network, i.e. places where we don't identify that COMID as one for which to grab the catchment polygon. Some of these result because of the way we use special handling to identify comid_cat's for reaches within drb_segs_spatial. But it also seems that divergent reaches have associated catchments. I don't think I appreciated that by omitting divergent reaches in the crosswalk table we'd also be impacting the catchments over which we may want to calculate HRU-scale attributes (e.g. as in the inland salinity project).

Here's an example, where the white "holes" are catchments associated with divergences.

clip

Not all fixed HRU geometries are valid

Not all the geometries within p2_GFv1_catchments_edited_sf are valid (e.g. all(st_is_valid(p1_catchments_edited_sf)) returns FALSE). See this PR in the inland salinity repo for further details.

Some unexpected COMIDs being returned in comid_cat for segments within `drb_segs_spatial`

I noticed some unexpected COMIDs are included in comid_cat for at least one of the segments within drb_segs_spatial. We currently identify these COMIDs using the NHD catchments that overlap the original PRMS HRU, so these extraneous COMIDs are being returned from the lines below in get_intersecting_nhdplus_catchments:

    # Download flowlines and VAA for COMIDs in nhd_cats_intrsct
    nhd_flines_intrsct <- nhdplusTools::get_nhdplus(comid = c(nhd_cats_intrsct$featureid),
                                                    realization = 'flowline') %>%
      # reformat variable names to uppercase
      rename_with(.,toupper,id:enabled)

Here's an example for PRMS subsegid 396_1:
comid_cat

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.