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

Handle urban area with missing daily VMT per capita #342

Merged
merged 1 commit into from
Feb 3, 2023

Conversation

rouille
Copy link
Collaborator

@rouille rouille commented Feb 2, 2023

Pull Request doc

Purpose

Use annual VMT per capita in state to calculate the total annual VMT in urban areas that have missing daily VMT per capita

What the code is doing

  • Remove rows where indices are set to [no data] in place of a urban area (single row)
  • Use a if/else statement when calculating the total annual VMT in urban areas

Testing

Manual testing to check that some urban areas with missing data have reasonable values compared to other urban areas in the state.

Where to look

  • It's helpful to clarify where your new code lives if you moved files around or there could be confusion/

  • What files are most important?

Usage Example/Visuals

>>> from prereise.gather.demanddata.transportation_electrification.generate_scaling_factors import (
...     census_ua_url,
...     census_state_url,
...     tht_data_url,
...     load_census_ua,
...     load_census_state,
...     load_dot_vmt_per_capita,
...     calculate_vmt_for_ua,
...     calculate_vmt_for_state,
...     calculate_urban_rural_fraction,
...     get_efs_vmt_projection_for_state,
...     generate_scaling_factor,
... )
>>> from prereise.gather.demanddata.nrel_efs.get_efs_annual_data import (
...     get_efs_annual_data,
...     nrel_annual_efs_url,
... )
>>> 
>>> census_ua = load_census_ua(census_ua_url)
>>> census_state = load_census_state(census_state_url)
NST01
>>> tht_ua, tht_state = load_dot_vmt_per_capita(tht_data_url)
>>> vmt_ua = calculate_vmt_for_ua(census_ua, tht_ua, tht_state)
>>> vmt_ua["OR"]
                      Annual VMT
Portland, OR-WA     1.024164e+10
Salem, OR           1.485755e+09
Albany, OR          4.917825e+08
Corvallis, OR       2.872120e+08
Medford, OR         1.002208e+09
Eugene, OR          1.583623e+09
Grants Pass, OR     4.358975e+08
Bend, OR            4.988977e+08
Walla Walla, WA-OR  7.614401e+07
Longview, WA-OR     1.876433e+07

Time estimate

5min

@rouille rouille self-assigned this Feb 2, 2023
Copy link
Collaborator

@BainanXia BainanXia left a comment

Choose a reason for hiding this comment

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

Looks good. Thanks

Copy link

@danlivengood danlivengood left a comment

Choose a reason for hiding this comment

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

Looks good to me. Thanks!

@rouille rouille merged commit a47722b into transportation_electrification Feb 3, 2023
@rouille rouille deleted the ben/input branch February 3, 2023 19:07
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.

3 participants