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

Error in `add_electricity` #184

Closed trevorb1 closed 4 months ago

trevorb1 commented 4 months ago

Checklist

The Issue

Running the workflow on master branch throws an error for add_electricity

I am running the default config file, excetp changing snapshots to

snapshots:
  start: "2019-01-01"
  end: "2019-01-07"
  inclusive: "left"

Steps To Reproduce

  1. clone the repo
  2. change snapshots to shown above
  3. run workflow

Expected Behavior

The workflow should run

Error Message

[Sat Feb 24 14:18:53 2024]
rule add_electricity:
    input: resources/western/profile_onwind.nc, resources/western/profile_offwind.nc, resources/western/profile_offwind_floating.nc, resources/western/profile_solar.nc, repo_data/locational_multipliers/biomass-retrofit-300mw.csv, repo_data/locational_multipliers/natural-gas-100mw.csv, repo_data/locational_multipliers/spv-tracking-150mw.csv, repo_data/locational_multipliers/fuel-cell-10mw.csv, repo_data/locational_multipliers/geothermal-50mw.csv, repo_data/locational_multipliers/biomass-50mw.csv, repo_data/locational_multipliers/natural-gas-1100mw.csv, repo_data/locational_multipliers/nuclear-1117mw.csv, repo_data/locational_multipliers/coal-ultra-supercritical.csv, repo_data/locational_multipliers/offshore-wind-40x10mw.csv, repo_data/locational_multipliers/csp-100mw.csv, repo_data/locational_multipliers/natural-gas-430mw-90ccs.csv, repo_data/locational_multipliers/battery-storage-4hr-50mw.csv, repo_data/locational_multipliers/natural-gas-retrofit-1100mw.csv, repo_data/locational_multipliers/battery-storage-2hr-50mw.csv, repo_data/locational_multipliers/spv-150mw.csv, repo_data/locational_multipliers/natural-gas-240mw.csv, repo_data/locational_multipliers/hydro-100mw.csv, repo_data/locational_multipliers/smr-600mw.csv, repo_data/locational_multipliers/onshore-wind-50mw.csv, repo_data/locational_multipliers/natural-gas-430mw.csv, repo_data/locational_multipliers/coal-ultra-supercritical-30ccs.csv, repo_data/locational_multipliers/onshore-wind-200mw.csv, repo_data/locational_multipliers/coal-ultra-supercritical-90ccs.csv, repo_data/locational_multipliers/natural-gas-20mw.csv, resources/western/elec_base_network.nc, resources/costs_2030.csv, resources/western/regions_onshore.geojson, repo_data/eia_plants_wecc.csv, repo_data/ads_plants_locs.csv, repo_data/eia_mappings/fuelCost22.csv, data/breakthrough_network/base_grid/plant.csv, data/breakthrough_network/base_grid/hydro.csv, data/breakthrough_network/base_grid/wind.csv, data/breakthrough_network/base_grid/solar.csv, data/breakthrough_network/base_grid/western/bus2sub.csv, data/GridEmissions/EIA_DMD_2018_2024.csv, data/nrel_efs/EFSLoadProfile_Reference_Moderate.csv, data/costs/ng_electric_power_price.csv
    output: resources/western/elec_base_network_l_pp.nc
    log: logs/western/add_electricity.log
    jobid: 11
    benchmark: benchmarks/western/add_electricity
    reason: Missing output files: resources/western/elec_base_network_l_pp.nc; Input files updated by another job: resources/western/profile_offwind_floating.nc, resources/western/regions_onshore.geojson, data/breakthrough_network/base_grid/western/bus2sub.csv, resources/western/elec_base_network.nc, resources/western/profile_onwind.nc, resources/western/profile_offwind.nc, resources/western/profile_solar.nc, resources/costs_2030.csv
    wildcards: interconnect=western
    resources: tmpdir=/tmp, mem_mb=18000, mem_mib=17167

INFO:pypsa.io:Imported network elec_base_network.nc has buses, lines, line_types, links, transformers
/home/trevor/repos/pypsa-usa/workflow/.snakemake/scripts/tmpb9u85az1.add_electricity.py:1203: DtypeWarning:

Columns (21,22,23,48,51,52,54,55,56,57) have mixed types. Specify dtype option on import or set low_memory=False.

INFO:__main__:Building Load Data using EFS demand
Traceback (most recent call last):
  File "/home/trevor/repos/pypsa-usa/workflow/.snakemake/scripts/tmpb9u85az1.add_electricity.py", line 1659, in <module>
    main(snakemake)
  File "/home/trevor/repos/pypsa-usa/workflow/.snakemake/scripts/tmpb9u85az1.add_electricity.py", line 1538, in main
    attach_demand(n, configuration)
  File "/home/trevor/repos/pypsa-usa/workflow/.snakemake/scripts/tmpb9u85az1.add_electricity.py", line 935, in attach_demand
    demand_per_bus = prepare_efs_demand(
                     ^^^^^^^^^^^^^^^^^^^
  File "/home/trevor/repos/pypsa-usa/workflow/.snakemake/scripts/tmpb9u85az1.add_electricity.py", line 883, in prepare_efs_demand
    demand.index = n.snapshots
    ^^^^^^^^^^^^
  File "/home/trevor/miniconda3/envs/pypsa-usa/lib/python3.11/site-packages/pandas/core/generic.py", line 6002, in __setattr__
    return object.__setattr__(self, name, value)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "pandas/_libs/properties.pyx", line 69, in pandas._libs.properties.AxisProperty.__set__
  File "/home/trevor/miniconda3/envs/pypsa-usa/lib/python3.11/site-packages/pandas/core/generic.py", line 730, in _set_axis
    self._mgr.set_axis(axis, labels)
  File "/home/trevor/miniconda3/envs/pypsa-usa/lib/python3.11/site-packages/pandas/core/internals/managers.py", line 225, in set_axis
    self._validate_set_axis(axis, new_labels)
  File "/home/trevor/miniconda3/envs/pypsa-usa/lib/python3.11/site-packages/pandas/core/internals/base.py", line 70, in _validate_set_axis
    raise ValueError(
ValueError: Length mismatch: Expected axis has 8758 elements, new values have 142 elements

Anything else?

No response

trevorb1 commented 4 months ago

I guess its an issue with the efs demand?