Skip to main content

connect and parse spd files

Project description

SPD API

Install

Install using:

pip install spd_api

This is a basic interface with the EA web files to extract data

We can choose a year and get a dataframe of the available files:

extract_spd_list(2020)
<style scoped> .dataframe tbody tr th:only-of-type { vertical-align: middle; }
.dataframe tbody tr th {
    vertical-align: top;
}

.dataframe thead th {
    text-align: right;
}
</style>
Name Date modified File size file_size
file_date
2020-01-01 MSS_311112019121100875_0X.ZIP 02 Jan 2020 6,340 KB 6340
2020-01-02 MSS_11112020011100861_0X.ZIP 02 Jan 2020 6,350 KB 6350
2020-01-03 MSS_21112020011100145_0X.ZIP 05 Jan 2020 6,378 KB 6378
2020-01-04 MSS_31112020011100230_0X.ZIP 06 Jan 2020 6,378 KB 6378
2020-01-05 MSS_41112020011100102_0X.ZIP 05 Jan 2020 6,382 KB 6382
... ... ... ... ...
2020-12-27 MSS_261112020121100745_0X.ZIP 28 Dec 2020 6,375 KB 6375
2020-12-28 MSS_271112020121100873_0X.ZIP 29 Dec 2020 6,382 KB 6382
2020-12-29 MSS_281112020121100340_0X.ZIP 29 Dec 2020 6,389 KB 6389
2020-12-30 MSS_291112020121100051_0X.ZIP 30 Dec 2020 6,390 KB 6390
2020-12-31 MSS_301112020121100813_0X.ZIP 31 Dec 2020 6,388 KB 6388

366 rows × 4 columns

More practically is to list a month and a year (due to size issues) and this will return the bus and branch data

month, year = 1 , 2022
spd_df = extract_spd_list(year)
await main_spd(spd_df.loc[f'{year}-{month}'], year)
(                INTERVAL               BRANCHNAME FROM_STATION TO_STATION  \
 0    2022-01-01 00:00:00         ABY     MXT1MXT1          ABY        ABY   
 1    2022-01-01 00:00:00           ABY     T2  T2          ABY        ABY   
 2    2022-01-01 00:00:00  ALB     ALB_HEN3      1          ALB        HEN   
 3    2022-01-01 00:00:00  ALB     ALB_HPI1      1          ALB        HPI   
 4    2022-01-01 00:00:00  ALB     ALB_SVL1      1          ALB        SVL   
 ...                  ...                      ...          ...        ...   
 1077 2022-01-31 23:30:00           WTU     T4  T4          WTU        WTU   
 1078 2022-01-31 23:30:00         WVY     MXT1MXT1          WVY        WVY   
 1079 2022-01-31 23:30:00           WVY     T1  T1          WVY        WVY   
 1080 2022-01-31 23:30:00           WWD     T1  T1          WWD        WWD   
 1081 2022-01-31 23:30:00           WWD     T2  T2          WWD        WWD   
 
         FROM_MW      TO_MW  BRANCHLOSSES  
 0      0.000000   0.000000       0.00000  
 1     -4.597000  -4.606000       0.01446  
 2    -18.837000 -18.860001       0.02267  
 3     13.488000  13.478000       0.00905  
 4     14.881000  14.872000       0.00912  
 ...         ...        ...           ...  
 1077  19.447001  19.407000       0.06421  
 1078   0.000000   0.000000       0.00000  
 1079   2.808000   2.799000       0.01193  
 1080  -0.318000  -0.318000       0.00000  
 1081  -2.753000  -2.753000       0.00000  
 
 [1612512 rows x 7 columns],
                INTERVAL ID_BUS ID_ST       LOAD  GENERATION
 0   2022-01-01 00:00:00    100   MVE   0.000000      0.0000
 1   2022-01-01 00:00:00    101   MVE   0.000000      0.0000
 2   2022-01-01 00:00:00    102   RTO   0.000000      0.0000
 3   2022-01-01 00:00:00    103   CBG  19.943001      0.0000
 4   2022-01-01 00:00:00    104   CBG   0.000000      0.0000
 ..                  ...    ...   ...        ...         ...
 930 2022-01-31 23:30:00     95   ARI   0.000000     15.3333
 931 2022-01-31 23:30:00     96   ARI   0.000000     15.3333
 932 2022-01-31 23:30:00     97   ARI   0.000000     15.3333
 933 2022-01-31 23:30:00     98   ARI   0.000000      0.0000
 934 2022-01-31 23:30:00     99   MVE   0.000000      0.0000
 
 [1392881 rows x 5 columns])

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

spd-api-0.0.9.tar.gz (10.2 kB view details)

Uploaded Source

Built Distribution

spd_api-0.0.9-py3-none-any.whl (12.4 kB view details)

Uploaded Python 3

File details

Details for the file spd-api-0.0.9.tar.gz.

File metadata

  • Download URL: spd-api-0.0.9.tar.gz
  • Upload date:
  • Size: 10.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.4

File hashes

Hashes for spd-api-0.0.9.tar.gz
Algorithm Hash digest
SHA256 c4e12544bf24b8544757bd2462a09e39d4d768d522ebc2c38758ebd7f12d99f0
MD5 43df7b3362e35e546399ffc8a7898eb0
BLAKE2b-256 ea7e60e5d5e1e23d89791085714ff31ada7ca203365dc8412fde46e129e03a50

See more details on using hashes here.

File details

Details for the file spd_api-0.0.9-py3-none-any.whl.

File metadata

  • Download URL: spd_api-0.0.9-py3-none-any.whl
  • Upload date:
  • Size: 12.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.4

File hashes

Hashes for spd_api-0.0.9-py3-none-any.whl
Algorithm Hash digest
SHA256 617b823572b1e7a6bbe717cd00d721ecb40e42f61548669bb7de218af3940835
MD5 f03d6c2142283c62bc873403e572c001
BLAKE2b-256 02d75c907bf5d2c9b02e4ab709c6202943afcdeae683a7c435b0a4708e6c8c8c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page