Update the function validating the year when running the pipeline. Closes CAR-4450
What the code is doing
Raise an exception if year passed to the validate_year function is not within earliest_data_year and latest_validated_year
Testing
2024-07-19 16:10:11 [INFO] oge.data_pipeline:83
Running with the following options:
* year = 2000
* shape_individual_plants = True
* small = False
* flat = False
* skip_outputs = False
2024-07-19 16:10:11 [INFO] oge.data_pipeline:136 Running data pipeline for year 2000
Traceback (most recent call last):
File "/Users/brdo/Singularity/open-grid-emissions/src/oge/data_pipeline.py", line 713, in <module>
main(sys.argv[1:])
File "/Users/brdo/Singularity/open-grid-emissions/src/oge/data_pipeline.py", line 137, in main
validation.validate_year(year)
File "/Users/brdo/Singularity/open-grid-emissions/src/oge/validation.py", line 47, in validate_year
raise UserWarning(year_warning)
UserWarning:
#########################################################################
Invalid year. The data pipeline has only been validated to work for years
2005-2022.
Input data for 2023 should be available from the EIA in Fall 2024 and we
will work to validate that the pipeline works with 2023 data as soon as
possible after the data is released.
#########################################################################
and:
2024-07-19 16:10:42 [INFO] oge.data_pipeline:83
Running with the following options:
* year = 2023
* shape_individual_plants = True
* small = False
* flat = False
* skip_outputs = False
2024-07-19 16:10:42 [INFO] oge.data_pipeline:136 Running data pipeline for year 2023
Traceback (most recent call last):
File "/Users/brdo/Singularity/open-grid-emissions/src/oge/data_pipeline.py", line 713, in <module>
main(sys.argv[1:])
File "/Users/brdo/Singularity/open-grid-emissions/src/oge/data_pipeline.py", line 137, in main
validation.validate_year(year)
File "/Users/brdo/Singularity/open-grid-emissions/src/oge/validation.py", line 47, in validate_year
raise UserWarning(year_warning)
UserWarning:
#########################################################################
Invalid year. The data pipeline has only been validated to work for years
2005-2022.
Input data for 2023 should be available from the EIA in Fall 2024 and we
will work to validate that the pipeline works with 2023 data as soon as
possible after the data is released.
#########################################################################
Where to look
Error message in the validate_year function.
Usage Example/Visuals
N/A
Review estimate
2min
Future work
N/A
Checklist
[x] Update the documentation to reflect changes made in this PR
[x] Format all updated python files using black
[x] Clear outputs from all notebooks modified
[x] Add docstrings and type hints to any new functions created
Purpose
Update the function validating the year when running the pipeline. Closes CAR-4450
What the code is doing
Raise an exception if year passed to the
validate_year
function is not withinearliest_data_year
andlatest_validated_year
Testing
and:
Where to look
Error message in the
validate_year
function.Usage Example/Visuals
N/A
Review estimate
2min
Future work
N/A
Checklist
black