Skip to content

Commit

Permalink
Merge pull request #56 from aerispaha/dev
Browse files Browse the repository at this point in the history
Refactoring graphics, build instructions tests and bug fix
  • Loading branch information
aerispaha authored Jun 19, 2019
2 parents cc68035 + 9889ec1 commit 61b2547
Show file tree
Hide file tree
Showing 19 changed files with 529 additions and 650 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# SWMMIO
v0.3.5
*v0.3.5.dev1*

[![Build status](https://ci.appveyor.com/api/projects/status/qywujm5w2wm0y2tv/branch/master?svg=true)](https://ci.appveyor.com/project/aerispaha/swmmio/branch/master)
[![Build Status](https://travis-ci.com/aerispaha/swmmio.svg?branch=master)](https://travis-ci.com/aerispaha/swmmio)
Expand Down
209 changes: 0 additions & 209 deletions README.rst

This file was deleted.

2 changes: 1 addition & 1 deletion swmmio/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
'''Python SWMM Input/Output Tools'''


VERSION_INFO = (0, 3, 5)
VERSION_INFO = (0, 3, 5, 'dev1')
__version__ = '.'.join(map(str, VERSION_INFO))
__author__ = 'Adam Erispaha'
__copyright__ = 'Copyright (c) 2016'
Expand Down
2 changes: 1 addition & 1 deletion swmmio/damage/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from swmmio.graphics.constants import *
from swmmio.defs.constants import *

FLOOD_IMPACT_CATEGORIES = {
'increased_flooding':{
Expand Down
25 changes: 13 additions & 12 deletions swmmio/defs/config.py
Original file line number Diff line number Diff line change
@@ -1,26 +1,27 @@
import os

# This is the swmmio project root
ROOT_DIR = os.path.dirname(os.path.abspath(__file__))
ROOT_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))

#path to the SWMM5 executable used within the run_models module
# path to the SWMM5 executable used within the run_models module
if os.name == 'posix':
SWMM_ENGINE_PATH = os.path.join(ROOT_DIR, 'lib', 'linux', 'swmm5')
else:
SWMM_ENGINE_PATH = os.path.join(ROOT_DIR, 'lib', 'windows', 'swmm5_22.exe')

#path to the default geodatabase. used for some arcpy functions and parcel calcs
GEODATABASE = r'C:\Data\ArcGIS\GDBs\LocalData.gdb'

#feature class name of parcels in geodatabase
# feature class name of parcels in geodatabase
PARCEL_FEATURES = r'PWD_PARCELS_SHEDS_PPORT'

#name of the directories in which to store post processing data
# name of the directories in which to store post processing data
REPORT_DIR_NAME = r'Report'

#path to the basemap file used to create custom basemaps
BASEMAP_PATH = os.path.join(ROOT_DIR,'swmmio','reporting','basemaps','index.html')
BETTER_BASEMAP_PATH = os.path.join(ROOT_DIR,'swmmio','reporting','basemaps','mapbox_base.html')
# path to the basemap file used to create custom basemaps
FONT_PATH = os.path.join(ROOT_DIR, 'swmmio', 'graphics', 'fonts', 'Verdana.ttf')

# path to the default geodatabase. used for some arcpy functions and parcel calcs
GEODATABASE = r'C:\Data\ArcGIS\GDBs\LocalData.gdb'

# path to the basemap file used to create custom basemaps
BASEMAP_PATH = os.path.join(ROOT_DIR, 'swmmio', 'reporting', 'basemaps', 'index.html')
BETTER_BASEMAP_PATH = os.path.join(ROOT_DIR, 'swmmio', 'reporting', 'basemaps', 'mapbox_base.html')

#path to the basemap file used to create custom basemaps
FONT_PATH = os.path.join(ROOT_DIR,'swmmio','graphics','fonts','Verdana.ttf')
File renamed without changes.
49 changes: 37 additions & 12 deletions swmmio/graphics/__init__.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
from swmmio.defs.config import FONT_PATH
from swmmio.defs.constants import *


class _dotdict(dict):
"""dot.notation access to dictionary attributes"""
__getattr__ = dict.get
__setattr__ = dict.__setitem__
__delattr__ = dict.__delitem__


"""
this allows module wide configuration of drawing methods. The dotdict allows for
convenient access.
Expand All @@ -15,24 +18,46 @@ class _dotdict(dict):
from swmmio.graphics import swmm_graphics as sg
#configure
graphics.options.inlcude_parcels = True
graphics.config.inlcude_parcels = True
#draws the model with parcels
sg.drawModel(swmmio.Model(/path/to/model), bbox=su.d68d70)
"""
_o = {
'include_basemap':False,
'include_parcels':False,
'basemap_shapefile_dir':r'C:\Data\ArcGIS\Shapefiles',

#regular shapefile used for drawing parcels
'parcels_shapefile':r'C:\Data\ArcGIS\Shapefiles\pennsport_parcels.shp',

#table resulting from one-to-many spatial join of parcels to sheds
'parcel_node_join_data':r'P:\02_Projects\SouthPhila\SE_SFR\MasterModels\CommonData\pennsport_sheds_parcels_join.csv',

'font_file':FONT_PATH,#r'C:\Data\Code\Fonts\Raleway-Regular.ttf',
'include_basemap': False,
'include_parcels': False,
'basemap_shapefile_dir': r'C:\Data\ArcGIS\Shapefiles',

# regular shapefile used for drawing parcels
'parcels_shapefile': r'C:\Data\ArcGIS\Shapefiles\pennsport_parcels.shp',

# table resulting from one-to-many spatial join of parcels to sheds
'parcel_node_join_data': r'P:\02_Projects\SouthPhila\SE_SFR\MasterModels\CommonData\pennsport_sheds_parcels_join.csv',

'font_file': FONT_PATH,
'basemap_options': {
'gdb': r'C:\Data\ArcGIS\GDBs\LocalData.gdb',
'features': [
# this is an array so we can control the order of basemap layers
{
'feature': 'PhiladelphiaParks',
'fill': park_green,
'cols': ["OBJECTID"] # , "SHAPE@"]
},
{
'feature': 'HydroPolyTrim',
'fill': water_grey,
'cols': ["OBJECTID"] # , "SHAPE@"]
},
{
'feature': 'Streets_Dissolved5_SPhilly',
'fill': lightgrey,
'fill_anno': grey,
'cols': ["OBJECTID", "ST_NAME"] # "SHAPE@",
}
],
}
}

config = _dotdict(_o)
Loading

0 comments on commit 61b2547

Please sign in to comment.