Breakthrough-Energy / PreREISE

Generate input data for scenario framework
https://breakthrough-energy.github.io/docs/
MIT License
20 stars 28 forks source link

Improve user experience #357

Closed rouille closed 1 year ago

rouille commented 1 year ago

Pull Request doc

Purpose

Use Grid object instead of sub.csv and bus2sub.csv files to get position of buses in network

What the code is doing

The get_bus_pos function is refactored. It takes a Grid object instead of a path to a directory enclosing the CSV files. The same data frame enclosing the coordinates of the buses in the network is returned.

Testing

>>> from prereise.gather.flexibilitydata.doe.bus_data import get_bus_pos
>>> from powersimdata import Grid
>>> grid = Grid("Texas")
Reading bus.csv
Reading plant.csv
Reading gencost.csv
Reading branch.csv
Reading dcline.csv
Reading sub.csv
Reading bus2sub.csv
Reading zone.csv
>>> bus_pos = get_bus_pos(grid)
>>> bus_pos
       bus_id      lat       lon
0     3001001  31.9067 -102.2620
1     3001002  29.8880 -104.5190
2     3001003  32.9264 -101.6480
3     3001004  32.9264 -101.6480
4     3001005  32.2075 -101.3880
...       ...      ...       ...
1995  3008156  31.0919  -96.6950
1996  3008157  31.0919  -96.6950
1997  3008158  30.7217  -96.4608
1998  3008159  30.7217  -96.4608
1999  3008160  30.7217  -96.4608

[2000 rows x 3 columns]

Where to look

The prereise.gather.flexibilitydata.doe.bus_data module where the get_bus_pos function is defined and the prereise.gather.flexibilitydata.doe.examples.bus_example module where the function is called

Usage Example/Visuals

N/A

Time estimate

How long will it take for reviewers and observers to understand this code change?