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
Is there a way to get the reach type, which is named 'Weir' or 'Pump' in the above list, and probably 'Link' for the other lines?
I've created a function, but I don't know which values are possible beside 'Weir' and 'Pump'.
def get_reach_type(reach):
try:
# get the full identifier string:
fullstring = str(reach)
# get the second part after the ':'
structureReach = fullstring.split(':')[1].lstrip()
# if the second part is Pump or Weir, use Pump or Weir:
if structureReach in ['Pump','Weir']:
reach_type = structureReach
# in any other case this must be a normal Link (Pipe or Canal or River)
else:
reach_type = 'Link'
except:
reach_type = None
return reach_type
I'm thinking of something simpler, similar to ''Reach.Name'', wich extracts the MUID. This is a property important for any further processing.
Thank you,
Thomas
The text was updated successfully, but these errors were encountered:
@ThomasTHT I know it's been a while since your post.
I just thought there was some issues in your code, so I decided to polish your code a little. Because I agree with you that it should be a little more simple to determine the reach type.
def get_reach_type(reach):
reach_type = 'Link' # Predefine the reach as a link.
reach_lst = reach.split(':') # Create a list with strings, separated by : (colon)
if reach_lst[0] in ('Weir','Pump','Orifice'): # If the first value of the list occurs in the tuple, we know that the reach_type is one of them.
reach_type = reach_lst[0]
return reach_type
The input of a reach type string is [Reach type]:[Reach ID].
If there is no [Reach type] and a colon, then the reach type is 'Link' in every case. That's why I predefine the reach_type in the beginning of the function. It will only change if the if statement is true.
may give something like
Is there a way to get the reach type, which is named 'Weir' or 'Pump' in the above list, and probably 'Link' for the other lines?
I've created a function, but I don't know which values are possible beside 'Weir' and 'Pump'.
I'm thinking of something simpler, similar to ''Reach.Name'', wich extracts the MUID. This is a property important for any further processing.
Thank you,
Thomas
The text was updated successfully, but these errors were encountered: