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
Who's got the time to mAnUaLly download a SWMM file?
It would be cool if we could instantiate a swmmio Model by passing in a URL to a SWMM model somewhere on the internet. This could make our docs a little more concise, and also make it easier to run tests against models that are hosted in other GitHub repos.
For example, instead of having to manually download a SWMM model from a Github repo before working with it in swmmio, we could do something like this:
# url to an awesome inp file in another repourl_to_inp='https://raw.githubusercontent.com/SWMMEnablement/NCIMM-Black-White-Box/25a7dc8fc58f67d15954679f294d09b9061766a4/SWMM5_NCIMM/10070_H_Elements.inp'# instantiate as usual model=swmmio.Model(url_to_inp)
model.links.geodataframe.plot('Geom1', linewidth=model.links.dataframe['Geom1'])
This can be achieved pretty easily by downloading the model file to a temp location, then instantiating the swmmio.Model. Something like this, inside the swmmio.Model.__init__ :
# write some logic to validate that the in_file_path is a valid URLifin_file_pathisurl:
# then download to a temp directory and instantiate from therer=requests.get(in_file_path)
temp_path=f'{tempfile.gettempdir()}/10070_H_Elements.inp'withopen(temp_path, 'wb') asf:
f.write(r.content)
self.inp(temp_path)
...
The text was updated successfully, but these errors were encountered:
Who's got the time to mAnUaLly download a SWMM file?
It would be cool if we could instantiate a swmmio Model by passing in a URL to a SWMM model somewhere on the internet. This could make our docs a little more concise, and also make it easier to run tests against models that are hosted in other GitHub repos.
For example, instead of having to manually download a SWMM model from a Github repo before working with it in swmmio, we could do something like this:
This can be achieved pretty easily by downloading the model file to a temp location, then instantiating the swmmio.Model. Something like this, inside the
swmmio.Model.__init__
:The text was updated successfully, but these errors were encountered: