Closed YifanLi86 closed 3 years ago
@YifanLi86 can you please provide more details:
>>> from postreise.analyze.generation.curtailment import calculate_curtailment_time_series
>>> from switchwrapper.switch_extract import get_output_scenarios
>>>
>>> # Extract grid and time-series data from outputs
>>> scenarios = get_output_scenarios(path_to_switch_project_folder)
>>> output_scenario = scenarios[2030]
>>> output_grid = output_scenario.get_grid()
>>> output_plant = output_grid.plant
>>>
>>> # Calculate curtailment by zone/type
>>> curtailment = calculate_curtailment_time_series(output_scenario)
>>> zone_id_curtailment = curtailment.sum().groupby([output_plant.zone_id, output_plant.type]).sum().unstack().fillna(0)
>>> zone_id_curtailment
type solar wind wind_offshore
zone_id
201 35.81604 0.00000 0.0
202 2315.51442 0.00000 0.0
203 20546.51868 0.00000 0.0
204 0.00000 0.00000 0.0
205 480.85956 0.00000 0.0
206 3931.54614 11496.16980 0.0
207 8394.61788 4455.54738 0.0
208 1722.01086 0.00000 0.0
209 4602.52710 5357.79054 0.0
210 0.00000 0.00000 0.0
211 0.00000 0.00000 0.0
212 0.00000 0.00000 0.0
213 0.00000 0.00000 0.0
214 0.00000 9980.40132 0.0
215 0.00000 173.53098 0.0
216 0.00000 0.00000 0.0
>>>
>>> # Calculate curtailment by state/type
>>> zone_name_curtailment = zone_id_curtailment.rename(output_grid.id2zone)
>>> zone_states = zone_name_curtailment.index.map(output_grid.model_immutables.zones["loadzone2state"])
>>> state_curtailment = zone_id_curtailment.groupby(zone_states).sum()
>>> state_curtailment
type solar wind wind_offshore
zone_id
Arizona 4602.52710 5357.79054 0.0
California 33353.54226 15951.71718 0.0
Colorado 0.00000 0.00000 0.0
Idaho 0.00000 9980.40132 0.0
Montana 0.00000 173.53098 0.0
Nevada 1722.01086 0.00000 0.0
New Mexico 0.00000 0.00000 0.0
Oregon 2315.51442 0.00000 0.0
Texas 0.00000 0.00000 0.0
Utah 0.00000 0.00000 0.0
Washington 35.81604 0.00000 0.0
Wyoming 0.00000 0.00000 0.0
Post-calculate curtailment data from SWITCH results, summarize by type.
DispatchGen
variable value from the pickle file. In .pickle file, the decision variable to use to get generation output level is DispatchGen. Same pickle file data extraction with: #39 (comment). All solution information stored in the same location.