Skip to content

Commit 4f2050c

Browse files
committed
fix: ship eia.data catalog files in package
The bare `data` rule in .gitignore matched src/eia/data/, so routes.yaml and recipes.yaml were never committed or published. catalog.py loads them at import time via importlib.resources, so the installed package raised ModuleNotFoundError: No module named 'eia.data' on `from eia import EIAClient`. Anchor the ignore rule to /data (root only) and commit the catalog files and their package __init__. Fixes #2
1 parent f7b2194 commit 4f2050c

4 files changed

Lines changed: 3731 additions & 1 deletion

File tree

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ docs
33
.DS_Store
44
__pycache__
55
.ipynb_checkpoints
6-
data
6+
/data
77
sketch
88
dist/

src/eia/data/__init__.py

Whitespace-only changes.

src/eia/data/recipes.yaml

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
version: 1
2+
recipes:
3+
- id: "lng-exports-europe"
4+
name: "US LNG Exports to Europe"
5+
description: "Monthly LNG export volumes by vessel to European countries"
6+
route: "natural-gas/move/expc"
7+
facets:
8+
process: "EVE"
9+
frequency: "monthly"
10+
notes: >-
11+
Returns ALL countries. Filter df for European duoarea codes (NUS-NUK, NUS-NFR, NUS-NSP, NUS-NNL, NUS-NIT, NUS-NGM,
12+
etc.) and series containing 'MMCF' for volumes.
13+
cli_example: >-
14+
eia get natural-gas/move/expc --facet process=EVE --start 2024-01 --end 2025-12
15+
# Then filter output for European countries and MMCF series
16+
python_example: |
17+
data = client.get_data_endpoint('natural-gas/move/expc')
18+
df = data.get(facets={'process': 'EVE'}, frequency='monthly', start='2024-01', end='2025-12')
19+
europe = ['NUS-NFR','NUS-NGM','NUS-NUK','NUS-NNL','NUS-NSP','NUS-NIT']
20+
vol = df[df['series'].str.contains('MMCF') & df['duoarea'].isin(europe)]
21+
22+
- id: "lng-exports-asia"
23+
name: "US LNG Exports to Asia"
24+
description: "Monthly LNG export volumes by vessel to Asian countries"
25+
route: "natural-gas/move/expc"
26+
facets:
27+
process: "EVE"
28+
frequency: "monthly"
29+
notes: >-
30+
Filter for: NUS-NJA (Japan), NUS-NKS (South Korea), NUS-NCH (China), NUS-NIN (India), NUS-NTW (Taiwan)
31+
cli_example: ""
32+
python_example: |
33+
data = client.get_data_endpoint('natural-gas/move/expc')
34+
df = data.get(facets={'process': 'EVE'}, frequency='monthly', start='2024-01', end='2025-12')
35+
asia = ['NUS-NJA','NUS-NKS','NUS-NCH','NUS-NIN','NUS-NTW']
36+
vol = df[df['series'].str.contains('MMCF') & df['duoarea'].isin(asia)]
37+
38+
- id: "us-grid-solar-wind"
39+
name: "US Grid Solar & Wind Generation"
40+
description: "Hourly solar and wind generation for the Lower 48"
41+
route: "electricity/rto/fuel-type-data"
42+
facets:
43+
respondent: "US48"
44+
fueltype:
45+
- "SUN"
46+
- "WND"
47+
frequency: "hourly"
48+
notes: ""
49+
cli_example: >-
50+
eia get electricity/rto/fuel-type-data --facet respondent=US48 --facet fueltype=SUN --facet fueltype=WND --start
51+
2024-06-01 --end 2024-06-08 --frequency hourly --data value
52+
python_example: |
53+
data = client.get_data_endpoint('electricity/rto/fuel-type-data')
54+
df = data.get(
55+
facets={'respondent': 'US48', 'fueltype': ['SUN', 'WND']},
56+
frequency='hourly', start='2024-06-01', end='2024-06-08',
57+
data_columns=['value'],
58+
)
59+
60+
- id: "crude-oil-prices"
61+
name: "WTI & Brent Crude Oil Prices"
62+
description: "Daily spot prices for WTI and Brent crude oil"
63+
route: "petroleum/pri/spt"
64+
facets:
65+
series:
66+
- "RWTC"
67+
- "RBRTE"
68+
frequency: "daily"
69+
notes: ""
70+
cli_example: >-
71+
eia get petroleum/pri/spt --facet series=RWTC --facet series=RBRTE --start 2024-01-01 --end 2024-12-31
72+
python_example: |
73+
data = client.get_data_endpoint('petroleum/pri/spt')
74+
df = data.get(
75+
facets={'series': ['RWTC', 'RBRTE']},
76+
frequency='daily', start='2024-01-01', end='2024-12-31',
77+
)
78+
79+
- id: "retail-electricity-prices"
80+
name: "Retail Electricity Prices by State"
81+
description: "Monthly average retail electricity prices by state and sector"
82+
route: "electricity/retail-sales"
83+
facets:
84+
sectorid: "ALL"
85+
frequency: "monthly"
86+
notes: ""
87+
cli_example: >-
88+
eia get electricity/retail-sales --facet stateid=CA --facet sectorid=ALL --start 2024-01 --end 2024-12 --data
89+
price
90+
python_example: |
91+
data = client.get_data_endpoint('electricity/retail-sales')
92+
df = data.get(
93+
facets={'stateid': 'CA', 'sectorid': 'ALL'},
94+
data_columns=['price'], frequency='monthly',
95+
start='2024-01', end='2024-12',
96+
)

0 commit comments

Comments
 (0)