Skip to content
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

Standardize the organization of the main and submodules #12

Closed
aerispaha opened this issue Mar 21, 2017 · 2 comments
Closed

Standardize the organization of the main and submodules #12

aerispaha opened this issue Mar 21, 2017 · 2 comments
Milestone

Comments

@aerispaha
Copy link
Member

Follow the convention used within pyswmm: support cleaner importing of the main classes, straighten out the config and definitions.

support these pattern:

from swmmio import Model, FloodReport, ComparisonReport, INPDiff, BuildInstructions

mymodel = Model('model.inp')
mymodel.draw(param, ...) #is there a better function word?
mymodel.conduits = modified_conduits #setters/getters to make changing a model more straightforward

#access global/config variables in a more obvious way
import swmmio 
swmmio.config.prj = 'epsg:2272'
swmmio.config.shapefile_directory = '/path/containing/shapefiles/for/basemap'
@aerispaha
Copy link
Member Author

Coordinate reference information should be stored at the model object level instead of in a global config setting. For example:

mymodel = swmmio.Model('path/to/model.inp')
mymodel.crs = 'epsg:2272'

@aerispaha aerispaha modified the milestones: v0.3.1, v0.3.2 Nov 20, 2018
@aerispaha
Copy link
Member Author

aerispaha commented Mar 10, 2019

Getting and setting model data should be straightforward. A possible implementation could look like this:

model = swmmio.Model('path/to/model.inp')

# get dataframe of junctions section from inp file
juncs = model.inp.junctions

# change the datum 
juncs['Elevation'] = juncs['Elevation'] + 10
model.inp.junctions = juncs
model.save() #overwrite existing model or optionally set a new filename 

# get a geojson representation object of the conduits
model.inp.conduits.to_json()

# retrieve specific subset of columns of data from rpt and inp files (as available) 
model.conduits(data=['MaxDepth, MaxQ', 'geometry'])

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant