Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions dbt/models/eia191/core_eia191__monthly_gas_storage/schema.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
version: 2
sources:
- name: pudl
tables:
- name: core_eia191__monthly_gas_storage

data_tests:
- expect_columns_not_all_null
- check_row_counts_per_partition:
arguments:
table_name: core_eia191__monthly_gas_storage
partition_expr: "report_date"
- expect_sum_close_to_total_column:
arguments:
sum_columns:
- working_gas_capacity_mcf
- base_gas_mcf
total_column: total_field_capacity_mcf
discrepancy_threshold: 0.01
max_discrepancy_rate: 0.25
description: >
total_field_capacity_mcf is reported as design capacity (base + working gas)
but is not reliably additive: approximately 23% of records have
total_field_capacity_mcf != working_gas_capacity_mcf + base_gas_mcf. This
reflects loose EIA definitions and operator self-reporting practices. The
threshold is set just above the observed ~23% failure rate so regressions
are flagged but existing failures do not hard-fail.

columns:
- name: storage_field_id_eia
- name: report_date
- name: state
- name: gas_field_id_eia
- name: reservoir_id_eia
- name: company_name
- name: field_name
- name: reservoir_name
- name: field_type
- name: county
- name: operational_status
- name: base_gas_mcf
data_tests:
- dbt_expectations.expect_column_min_to_be_between:
arguments:
min_value: 0
- name: working_gas_capacity_mcf
data_tests:
- dbt_expectations.expect_column_min_to_be_between:
arguments:
min_value: 0
- name: total_field_capacity_mcf
data_tests:
- dbt_expectations.expect_column_min_to_be_between:
arguments:
min_value: 0
- name: maximum_daily_delivery_mcf
data_tests:
- dbt_expectations.expect_column_min_to_be_between:
arguments:
min_value: 0
- name: region
46 changes: 46 additions & 0 deletions migrations/versions/8ea3f44edf13_eia191_monthly_gas_storage.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
"""eia191 monthly gas storage

Revision ID: 8ea3f44edf13
Revises: 649d707df89a
Create Date: 2026-03-24 15:01:02.919488

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '8ea3f44edf13'
down_revision = '649d707df89a'
branch_labels = None
depends_on = None


def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('core_eia191__monthly_gas_storage',
sa.Column('storage_field_id_eia', sa.Text(), nullable=False, comment='EIA-assigned identifier for an underground natural gas storage reservoir. IDs are assigned per company and state, so the same physical reservoir may have different IDs if ownership changes.'),
sa.Column('report_date', sa.Date(), nullable=False, comment='Date reported.'),
sa.Column('state', sa.Text(), nullable=True, comment='Two letter US state abbreviation.'),
sa.Column('gas_field_id_eia', sa.Integer(), nullable=True, comment='EIA-assigned numeric identifier for a natural gas storage field.'),
sa.Column('reservoir_id_eia', sa.Integer(), nullable=True, comment='EIA-assigned numeric identifier for the individual storage reservoir within a natural gas storage field.'),
sa.Column('company_name', sa.Text(), nullable=True, comment='Name of the reporting company.'),
sa.Column('field_name', sa.Text(), nullable=True, comment='Name of the natural gas storage field.'),
sa.Column('reservoir_name', sa.Text(), nullable=True, comment='Name of the individual underground natural gas storage reservoir.'),
sa.Column('field_type', sa.Enum('aquifer', 'depleted field', 'salt dome'), nullable=True, comment='Type of underground natural gas storage facility. One of: depleted field (a reservoir previously used for natural gas production), aquifer (a porous rock structure used to store gas), or salt dome (a cavern created within a salt formation).'),
sa.Column('county', sa.Text(), nullable=True, comment='County name.'),
sa.Column('operational_status', sa.Enum('active', 'inactive'), nullable=True, comment='Operational status of the underground natural gas storage reservoir.'),
sa.Column('base_gas_mcf', sa.Float(), nullable=True, comment='Volume of base gas (cushion gas) in the underground storage reservoir. Base gas is the volume of gas intended as permanent inventory in a reservoir to maintain adequate pressure and deliverability rates.'),
sa.Column('working_gas_capacity_mcf', sa.Float(), nullable=True, comment='Volume of working gas (the portion of stored gas available for withdrawal) in the underground storage reservoir.'),
sa.Column('total_field_capacity_mcf', sa.Float(), nullable=True, comment='Total design capacity of the underground natural gas storage field (base gas plus working gas).'),
sa.Column('maximum_daily_delivery_mcf', sa.Float(), nullable=True, comment='Maximum daily quantity of gas that can be withdrawn from the underground storage reservoir under normal operating conditions.'),
sa.Column('region', sa.Enum('alaska', 'east region', 'midwest region', 'mountain region', 'pacific region', 'south central region'), nullable=True, comment='EIA storage region in which the underground natural gas storage field is located.'),
sa.PrimaryKeyConstraint('storage_field_id_eia', 'report_date', name=op.f('pk_core_eia191__monthly_gas_storage'))
)
# ### end Alembic commands ###


def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table('core_eia191__monthly_gas_storage')
# ### end Alembic commands ###
Loading
Loading