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

Maz scale microdata devprojects #95

Merged
merged 5 commits into from
May 3, 2018

Conversation

conorhenley
Copy link
Contributor

Update datasources to handle updated develpment projects data format by pulling parcel_id from x, y rather than geom_id.

baus/models.py Outdated
@@ -345,7 +345,7 @@ def scheduled_development_events(buildings, development_projects,
new_buildings.building_type.fillna("OF").map(building_sqft_per_job)
new_buildings["job_spaces"] = new_buildings.job_spaces.\
fillna(0).astype('int')
new_buildings["geom_id"] = parcel_id_to_geom_id(new_buildings.parcel_id)
#new_buildings["geom_id"] = parcel_id_to_geom_id(new_buildings.parcel_id)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can remove this line now?

df = pd.read_csv(os.path.join(misc.data_dir(), "development_projects.csv"))
# find nearest parcel centroid to dev project x, y and assign parcel_id
df = df[(df.x.notnull()) & (df.y.notnull())]
df['parcel_id'] = nearest_neighbor(parcels.to_frame(['x','y']),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you pep8 this (I mean all of it for good measure)?


cnts = df.geom_id.isin(parcels.geom_id).value_counts()
cnts = df.parcel_id.isin(parcels.index).value_counts()
if False in cnts.index:
print "%d MISSING GEOMIDS!" % cnts.loc[False]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably need to change this comment to take out GEOMIDS. Does is print anything? Do all the projects get mapped to reasonable parcel ids? I mean, have you checked to see if it works?

@fscottfoti
Copy link
Contributor

Hmm, I think we should just have development_projects.csv and not development_projects_w_apn.csv in github. Will keep us from file proliferation. Just copy it over once you've got it...

"development_projects_w_apn.csv"))
# find nearest parcel centroid to dev project x, y and assign parcel_id
df = pd.merge(df, parcels.apn.reset_index(), how='left', left_on='apn',
right_on='apn')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this merge. Clever way to merge to a series - I hadn't seen that before.

@fscottfoti fscottfoti merged commit ef3c740 into maz-scale-microdata May 3, 2018
@fscottfoti fscottfoti deleted the maz_scale_microdata_devprojects branch May 3, 2018 00:37
mxndrwgrdnr pushed a commit to ual/bayarea_urbansim that referenced this pull request Mar 26, 2020
Strategies (futures round 2) prep work
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants