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

Bug fixes and continuous integration updates #62

Merged
merged 6 commits into from
Jan 1, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ install:
- pip install https://github.com/udst/urbansim/archive/master.zip
- pip install osmnet pandana
- pip install .
- cd .. && git clone [email protected]:urbansim/urbansim_parcels.git
- pip install ./urbansim_parcels
#- cd .. && git clone [email protected]:urbansim/urbansim_parcels.git
#- pip install ./urbansim_parcels
- cd "$TRAVIS_BUILD_DIR"

script:
- pycodestyle developer
- py.test
- cd ../urbansim_parcels/sf_example && python simulate.py
- cd ../sd_example && python simulate.py
#- cd ../urbansim_parcels/sf_example && python simulate.py
#- cd ../sd_example && python simulate.py
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# UrbanSim Developer Model

[![Build Status](https://travis-ci.com/urbansim/developer.svg?token=GSDNqBio5uUExRqdD5zJ&branch=master)](https://travis-ci.com/urbansim/developer)
[![Build Status](https://travis-ci.org/udst/developer.svg?token=GSDNqBio5uUExRqdD5zJ&branch=master)](https://travis-ci.org/udst/developer)

This package is a new-and-improved version of the developer model
included in UrbanSim. Documentation available [here](https://urbansim.github.io/developer/).
14 changes: 7 additions & 7 deletions developer/develop.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,9 +220,7 @@ def _get_dataframe_of_buildings(self):
df : DataFrame
"""

if self.forms is None:
df = self.feasibility
elif isinstance(self.forms, list):
if self.forms is None or isinstance(self.forms, list):
df = self.keep_form_with_max_profit(self.forms)
else:
df = self.feasibility[self.forms]
Expand Down Expand Up @@ -261,13 +259,15 @@ def keep_form_with_max_profit(self, forms=None):

Parameters
----------
forms: list of strings
List of forms which compete which other. Can leave some out.
forms : list of strings
List of forms to evaluate. If empty or None, all forms are
evaluated.

Returns
-------
Nothing. Goes from a multi-index to a single index with only the
most profitable form.
DataFrame consisting of a subset of self.feasibility, where only
the most profitable form for each parcel is included.

"""
f = self.feasibility

Expand Down
17 changes: 13 additions & 4 deletions developer/sqftproforma.py
Original file line number Diff line number Diff line change
Expand Up @@ -702,9 +702,14 @@ def _lookup_parking_cfg(self, form, parking_config, df,
# turn fars and heights into nans which are not allowed by zoning
# (so we can fillna with one of the other zoning constraints)
fars = np.repeat(cost_sqft_index_col, len(df.index), axis=1)
fars[fars > df.min_max_fars.values + .01] = np.nan
mask = ~np.isnan(fars) # mask out existing nans for safer comparison
mask *= np.nan_to_num(fars) > df.min_max_fars.values + .01
fars[mask] = np.nan

heights = np.repeat(heights, len(df.index), axis=1)
fars[heights > df.max_height.values + .01] = np.nan
mask = ~np.isnan(heights)
mask *= np.nan_to_num(heights) > df.max_height.values + .01
fars[mask] = np.nan

# PROFIT CALCULATION
# parcel sizes * possible fars
Expand Down Expand Up @@ -1193,10 +1198,14 @@ def _stories(self, parking_config, building_bulk, parking_stalls):
- parking_stalls
* self.parking_sqft_d[parking_config]))
# not all fars support surface parking
stories[stories < 0.0] = np.nan
mask = ~np.isnan(stories) # mask out existing nans
mask[mask] *= stories[mask] < 0.0
stories[mask] = np.nan
# I think we can assume that stories over 3
# do not work with surface parking
stories[stories > 5.0] = np.nan
mask = ~np.isnan(stories)
mask[mask] *= stories[mask] > 5.0
stories[mask] = np.nan

stories /= self.parcel_coverage

Expand Down