-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Docs enhancements #235
Docs enhancements #235
Conversation
Adding @karosc for some responses too. @aerispaha can you drop the link in for the draft built docs? |
upgrade pyshp dependency
Also going to add @wraseman here for some thoughts too. He's a fresh SWMMIO user and it would be good to get his reaction. |
@bemcdonnell and team, you can see the draft built documentation on readthedocs, here).
|
@aerispaha, for starters, you've done such a nice job on the documentation overhaul! I like the focus and the new feel - lighter and cleaner. The only suggestions I have are for the User Guide. I think it would be useful to make a sub header section (BOLD) how to "Edit model Parameters." Get the attention of those who are quickly scrolling through that you can use this to Edit/modify models. Also, for running models, you might cite PySWMM as the vehicle that is used. Lastly, maybe consider a separate page for notebooks and add it to the TOC. We can also provide documentation links from www.pyswmm.org if you'd like! Keep up the great work on this! I think it is an asset to the community and so are YOU! |
Working through the docs, providing feedback on README.md and the first two sections of Getting Started. README.md
Getting Started
Getting Started: Edit Model Parameters
Getting Started: Building Variations of Model
|
Picking up from where I left off on the Getting Started section. Potential revisions to section navigation:
Getting Started > Nodes and Links
Working with PySWMM
Original # Run Simulation PySWMM
with pyswmm.Simulation(model.inp.path) as sim:
for i, step in enumerate(sim):
# store each link's flow in a dictionary
link_flows[sim.current_time] = {
link_id: pyswmm.Links(sim)[link_id].flow
for link_id in model.inp.conduits.index
} Proposed # Run simulation PySWMM
def get_flow(link_id):
return pyswmm.Links(sim)[link_id].flow
with pyswmm.Simulation(model.inp.path) as sim:
link_ids = model.inp.conduits.index
for step in sim:
# store each link's flow in a dictionary
link_flows[sim.current_time] = {
link_id: get_flow(link_id) for link_id in link_ids
} Visualizing SWMM Models
Proposed # draw the model links and outfalls
ax = model.links.geodataframe.plot(linewidth=model.links.dataframe['Geom1'], figsize=(10,10))
ax.set_xlabel('X Coordinate')
ax.set_ylabel('Y Coordinate')
outfall_plot = model.nodes.geodataframe.loc[outfalls.index].plot('InvertElev', ax=ax, legend=True,
legend_kwds={"label": "Invert Elevation", "orientation": "horizontal"})
Proposed # get a count of nodes upstream of each outfall
outfalls['CountUpstreamNodes'] = outfalls.apply(lambda x: len(nx.ancestors(G, x.name)), axis=1)
outfalls.sort_values(by='CountUpstreamNodes', ascending=False).head(n=10) |
The Art section should be longer, IMO - After a hard day of H&H modeling, some of us may need to express ourselve with the other side of our brain. _Why is it "Cool"?
In essence, using |
@wraseman @dickinsonre @bemcdonnell, thanks so much for all this great feedback! I'm thrilled to have your input :) |
@wraseman, again, thanks for the thorough review. Below I will address your comments:
I agree. this came from the making art with swmmio section and it's just something I liked aesthetically, but it doesn't make a ton of sense to be the opening image for swmmio. I've changed this to be a figure that shows flood levels in a model, generated with swmmio.
The development version is currently
Done. thanks for catching this.
This is because of Pandas default display option truncating the visible columns. To address this, I've modified the example code to focus on the columns that have changed: # see the changes in the higher-level nodes DataFrame
new_model.nodes.dataframe[['InvertElev','OutfallType', 'StageOrTimeseries']]
Great catch. There was a little bug in the logic and it has been corrected. Now the last sea level rise scenario shows stages of 581.
Good point. I think "baseline" in this context isn't is the best variable name. I've renamed the model that gets modified to simply Second Batch of Comments
I'm on the fence about this suggestion. I want to emphasize how these two tools can work well together, so I'd like to keep "PySWMM" in the title. I think this will make more sense as we add more use-cases for pyswmm/swmmio. I propose we add more such examples in a separate PR since this one has gotten pretty large.
Done, except I've slightly revised your suggestion to "Spatial Visualization of SWMM Models"
I'll address this in a separate comment.
Geopandas is currently an "optional" dependency (in quotes because it isn't packaged as such properly). In a separate PR, we intend to overhaul/modernize the packaging of swmmio at which time I'd like to properly make geopandas an optional dependency.
I've modified the code as you've suggested, with a couple small adjustments. And I've added a few sentences describing the scope of pyswmm/swmmio. |
@wraseman regarding the Making Art with EPA SWMM: remove or trim suggestion. I hear you that this section is not really necessary. But I do really appreciate @dickinsonre's feedback and point of view on this. In fact, these lovely words from @dickinsonre articulate my feelings on the matter probably better than I could myself:
Yes, we probably should have more documentation on the primary use of swmmio (the hard engineering stuff). But, for whatever reason, I was inspired to explore some unconventional uses of swmmio a few weeks ago, and that's why that section is fairly long. In the future, maybe we can delineate a "Gallery" section or something, in which we can house some less conventional examples. But for now, I'd like to keep the art section as is. Is that cool with everyone? |
@aerispaha, all your responses look good to me! Thanks for thoughtfully considering my feedback. @dickinsonre, I appreciate your perspective on the art section--makes sense! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@aerispaha excellent work!
Thanks to all the reviewers too!
Major overhaul of the swmmio documentation that better organizes the API reference documentation, adds a User Guide with examples (including some silly examples), and provides a more concise introduction. I've also fixed most of the docstrings that were incorrectly formatted (although not all of the docstrings have been standardized).
Draft Docs
You can review the unreleased docs here
swmmio.Model from URL
Also included is a small new feature that allows us to instantiate a
swmmio.Model
object with a url to a INP file somewhere on the network. This was handy for quickly testing things and made some of the docs more concise. For example, we can work with a big model hosted in the NCIMM-Black-White-Box repo like thisThis will download the remote INP file to a temp location, then instantiate the
Model
object as usual.Closes #233
Closes #171
Closes #236
Closes #234