PyPSA / pypsa-usa

PyPSA-USA: An Open-Source Energy System Optimization Model for the United States
https://pypsa-usa.readthedocs.io
MIT License
35 stars 15 forks source link

Fixes bug in reading efs data #187

Closed trevorb1 closed 4 months ago

trevorb1 commented 4 months ago

Closes #184

Changes proposed in this Pull Request

In this PR I have updated the snapshot filtering for reading in efs data

Checklist

trevorb1 commented 4 months ago

Still need to address the following warnings when writing capacity factors

WARNING:pypsa.io:Snapshots DatetimeIndex(['2019-01-07 00:00:00', '2019-01-07 01:00:00',
               '2019-01-07 02:00:00', '2019-01-07 03:00:00',
               '2019-01-07 04:00:00', '2019-01-07 05:00:00'],
              dtype='datetime64[ns]', name='snapshot', freq=None) are missing from p_max_pu of Generator. Filling with default value '1.0'
INFO:__main__:Added connection cost of 55-113 USD/MW/a to offwind
INFO:__main__:Adding offwind capacity-factor profiles to the network.
WARNING:pypsa.io:Snapshots DatetimeIndex(['2019-01-07 00:00:00', '2019-01-07 01:00:00',
               '2019-01-07 02:00:00', '2019-01-07 03:00:00',
               '2019-01-07 04:00:00', '2019-01-07 05:00:00'],
              dtype='datetime64[ns]', name='snapshot', freq=None) are missing from p_max_pu of Generator. Filling with default value '1.0'
INFO:__main__:Adding onwind capacity-factor profiles to the network.
WARNING:pypsa.io:Snapshots DatetimeIndex(['2019-01-07 00:00:00', '2019-01-07 01:00:00',
               '2019-01-07 02:00:00', '2019-01-07 03:00:00',
               '2019-01-07 04:00:00', '2019-01-07 05:00:00'],
              dtype='datetime64[ns]', name='snapshot', freq=None) are missing from p_max_pu of Generator. Filling with default value '1.0'
INFO:__main__:Adding solar capacity-factor profiles to the network.
WARNING:pypsa.io:Snapshots DatetimeIndex(['2019-01-07 00:00:00', '2019-01-07 01:00:00',
               '2019-01-07 02:00:00', '2019-01-07 03:00:00',
               '2019-01-07 04:00:00', '2019-01-07 05:00:00'],
              dtype='datetime64[ns]', name='snapshot', freq=None) are missing from p_max_pu of Generator. Filling with default value '1.0'
trevorb1 commented 4 months ago

@ktehranchi I believe this takes care of the add_electricity issue and warnings described above, but can you please confirm? :)

Also, not sure why suddenly the the datetimes in build_renewable_profiles were failing. But if the solution I propose works, we should wrap this into a utility function, as add_electricity is implemented in the same way

ktehranchi commented 4 months ago

This caused an issue where build_renewable_profiles now cannot build capacity factor profiles for the portion of the year not in 2019. I'm going to push a change to revert that file back to how it was until a proper solution is put together.

trevorb1 commented 4 months ago

To clarify, the workflow still runs based on whatever time intervals you give, but these warnings are just printed out now? If true, we should put this in a new issue ticket and move discussion there?

WARNING:pypsa.io:Snapshots DatetimeIndex(['2019-01-07 00:00:00', '2019-01-07 01:00:00',
               '2019-01-07 02:00:00', '2019-01-07 03:00:00',
               '2019-01-07 04:00:00', '2019-01-07 05:00:00'],
              dtype='datetime64[ns]', name='snapshot', freq=None) are missing from p_max_pu of Generator. Filling with default value '1.0'
INFO:__main__:Added connection cost of 55-113 USD/MW/a to offwind
INFO:__main__:Adding offwind capacity-factor profiles to the network.
WARNING:pypsa.io:Snapshots DatetimeIndex(['2019-01-07 00:00:00', '2019-01-07 01:00:00',
               '2019-01-07 02:00:00', '2019-01-07 03:00:00',
               '2019-01-07 04:00:00', '2019-01-07 05:00:00'],
              dtype='datetime64[ns]', name='snapshot', freq=None) are missing from p_max_pu of Generator. Filling with default value '1.0'
INFO:__main__:Adding onwind capacity-factor profiles to the network.
WARNING:pypsa.io:Snapshots DatetimeIndex(['2019-01-07 00:00:00', '2019-01-07 01:00:00',
               '2019-01-07 02:00:00', '2019-01-07 03:00:00',
               '2019-01-07 04:00:00', '2019-01-07 05:00:00'],
              dtype='datetime64[ns]', name='snapshot', freq=None) are missing from p_max_pu of Generator. Filling with default value '1.0'
INFO:__main__:Adding solar capacity-factor profiles to the network.
WARNING:pypsa.io:Snapshots DatetimeIndex(['2019-01-07 00:00:00', '2019-01-07 01:00:00',
               '2019-01-07 02:00:00', '2019-01-07 03:00:00',
               '2019-01-07 04:00:00', '2019-01-07 05:00:00'],
              dtype='datetime64[ns]', name='snapshot', freq=None) are missing from p_max_pu of Generator. Filling with default value '1.0'