You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The function evaluation.plotting.find_all_upstream in bmorph was recently found to not gather the correct upstream river segments and had some issue with reassigning some global variable (e.g. it appeared to work on first call but not subsequent calls). While I am not certain why this function is not currently working, following is some code from @arbennett that does work, but has yet to be cleaned up and generalized:
def find_all(crbtopo, seg_id):
# Network topology file
#crbtopo = xr.open_dataset('columbia_huc12_topology_fixed.nc')
#seg_id = $YOUR_SEG_ID # Select the segment you want to search from
search_seg_id = [seg_id] # Start a list of seg id's to search through
all_seg_id = [seg_id] # Start a list of seg id's to select
while len(search_seg_id):
cur_seg_id = search_seg_id.pop() # Get the last value out of our search queue
all_seg_id.append(cur_seg_id) # Put the id we are searching from onto the list to select
sel_seg = crbtopo['Tosegment'] == cur_seg_id # Figure out which upstream segments lead to the current segment
up_seg_ids = crbtopo['seg'].where(sel_seg, drop=True).values # Select the seg id's which are upstream
[search_seg_id.append(i) for i in up_seg_ids] # For each of those, put them in the queue to be searched
sel_hru = crbtopo['seg_hru_id'].isin(all_seg_id)
all_hru_id = crbtopo['hru'].where(sel_hru, drop=True).values
return all_seg_id, all_hru_id
The text was updated successfully, but these errors were encountered:
Update: both that aggregation script and the previously found inaccurate aggregation script can result in duplicate segs being returned. I am not certain the cause of this error, however calling set() on the outputted data will resolve this.
The function
evaluation.plotting.find_all_upstream
inbmorph
was recently found to not gather the correct upstream river segments and had some issue with reassigning some global variable (e.g. it appeared to work on first call but not subsequent calls). While I am not certain why this function is not currently working, following is some code from @arbennett that does work, but has yet to be cleaned up and generalized:The text was updated successfully, but these errors were encountered: