Skip to content

Create mapping between load zone IDs and time zones#339

Merged
lanesmith merged 2 commits intodevelopfrom
lane/timezones
Nov 19, 2020
Merged

Create mapping between load zone IDs and time zones#339
lanesmith merged 2 commits intodevelopfrom
lane/timezones

Conversation

@lanesmith
Copy link
Copy Markdown
Collaborator

Purpose

Create a means to map load zone IDs to time zones.

What the code is doing

Two dictionaries are created: one that maps time zones to load zone IDs and another that maps load zone IDs to time zones. The mappings were created manually. Most of the time zone to load zone ID mappings were simple (i.e., the load zone resided entirely in one time zone). Other mappings were less straightforward, especially for load zones that were in multiple time zones. The most notable of these were NE, SD, TN, and KY. Since each of these states were single load zones, I could only assign them to one time zone. In this case, I assigned the load zones to the time zone in which the majority of their load centers reside. This meant that NE (Omaha and Lincoln), SD (Sioux Falls), and TN (Nashville and Memphis) were placed in the Central time zone and KY (Louisville and Lexington) was placed in the Eastern time zone. States that had more load zones, such as TX and FL, benefitted from the mapping because load zones like El Paso, TX and the Florida Panhandle were able to be correctly attributed to their proper time zones (Mountain Time and Central Time, respectively) rather than the time zones used for the majority of their states.

Testing

I don't believe any rigorous testing is necessary. I tested the mappings to make sure the code worked as intended.

Where to look

This new code is in: PowerSimData/powersimdata/network/usa_tamu/constants/zones.py

Usage Example/Visuals

These mappings will be used in the NREL Electrification Futures Study modules I'm working on in PreREISE. The state-level data is labeled with local hour IDs (i.e., integers from 1 through 8760), so I need to be able to shift the data according to UTC time.

Time estimate

I imagine this should be quick. Probably only a couple minutes.

@danielolsen
Copy link
Copy Markdown
Contributor

Can this data live in powersimdata/network/usa_tamu/data/zones.csv and be loaded from there?

@lanesmith
Copy link
Copy Markdown
Collaborator Author

Can this data live in powersimdata/network/usa_tamu/data/zones.csv and be loaded from there?

Yeah, if that would be preferred, I can definitely do that. Are you thinking that the data would live in powersimdata/network/usa_tamu/data/zones.csv, but the mapping variables (i.e., id2loadzone) would still be called in powersimdata/network/usa_tamu/constants/zones.py?

Comment thread powersimdata/network/usa_tamu/constants/zones.py Outdated
@danielolsen
Copy link
Copy Markdown
Contributor

Can this data live in powersimdata/network/usa_tamu/data/zones.csv and be loaded from there?

Yeah, if that would be preferred, I can definitely do that. Are you thinking that the data would live in powersimdata/network/usa_tamu/data/zones.csv, but the mapping variables (i.e., id2loadzone) would still be called in powersimdata/network/usa_tamu/constants/zones.py?

Exactly. Within zones.py we will read the CSV and then create timezone2id and id2timezone variables so that they can be imported by other modules.

Comment thread powersimdata/network/usa_tamu/constants/zones.py Outdated
Comment thread powersimdata/network/usa_tamu/constants/zones.py Outdated
Copy link
Copy Markdown
Contributor

@danielolsen danielolsen left a comment

Choose a reason for hiding this comment

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

Thanks for humoring the code-golf!

Copy link
Copy Markdown
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.

Thanks for addressing the comments!

@lanesmith
Copy link
Copy Markdown
Collaborator Author

Thank you both for the feedback!

@lanesmith lanesmith merged commit 10170c6 into develop Nov 19, 2020
@lanesmith lanesmith deleted the lane/timezones branch November 19, 2020 05:05
@ahurli ahurli mentioned this pull request Mar 11, 2021
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