Skip to content

Commit

Permalink
refactor: change emission rate type to calendar day (#300) (#301)
Browse files Browse the repository at this point in the history
* refactor: change emission rate type to calendar day

(cherry picked from commit f8e5052)
  • Loading branch information
frodehk authored Nov 24, 2023
1 parent a1a24f1 commit 6465e9d
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 17 deletions.
4 changes: 3 additions & 1 deletion src/libecalc/core/graph_result.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,9 @@ def _parse_emissions(
key: libecalc.dto.result.EmissionResult(
name=key,
timesteps=emissions[key].timesteps,
rate=TimeSeriesRate.from_timeseries_stream_day_rate(emissions[key].rate, regularity=regularity),
rate=TimeSeriesRate.from_timeseries_stream_day_rate(
emissions[key].rate, regularity=regularity
).to_calendar_day(),
cumulative=TimeSeriesRate.from_timeseries_stream_day_rate(emissions[key].rate, regularity=regularity)
.to_volumes()
.cumulative(),
Expand Down
2 changes: 1 addition & 1 deletion src/libecalc/dto/utils/aggregators.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def aggregate_emissions(
emissions_aggregated[emission_name] = PartialEmissionResult(
name=emission_name,
timesteps=emissions[0].timesteps,
rate=reduce(operator.add, [emission.rate for emission in emissions]),
rate=reduce(operator.add, [emission.rate.to_calendar_day() for emission in emissions]),
)

return emissions_aggregated
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
timesteps,model.is_valid[N/A],model.energy_usage[Sm3/cd],model.energy_usage_cumulative[Sm3 (cd)],model.power[MW (sd)],model.power_cumulative[GWh (cd)],model.co2.rate[t/sd],model.co2.cumulative[t (cd)],model.hydrocarbon_export_rate[Sm3/cd],model.co2.intensity_sm3[kg/Sm3],model.co2.intensity_boe[kg/BOE],model.co2.intensity_yearly_sm3[kg/Sm3],model.co2.intensity_yearly_boe[kg/BOE],Installation A.is_valid[N/A],Installation A.energy_usage[Sm3/cd],Installation A.energy_usage_cumulative[Sm3 (cd)],Installation A.power[MW (sd)],Installation A.power_cumulative[GWh (cd)],Installation A.co2.rate[t/sd],Installation A.co2.cumulative[t (cd)],Installation A.hydrocarbon_export_rate[Sm3/cd],Installation A.co2.intensity_sm3[kg/Sm3],Installation A.co2.intensity_boe[kg/BOE],Installation A.co2.intensity_yearly_sm3[kg/Sm3],Installation A.co2.intensity_yearly_boe[kg/BOE],Installation A.regularity[N/A],Generator set A.is_valid[N/A],Generator set A.energy_usage[Sm3/cd],Generator set A.energy_usage_cumulative[Sm3 (cd)],Generator set A.power[MW (sd)],Generator set A.power_cumulative[GWh (cd)],Generator set A.co2.rate[t/sd],Generator set A.co2.cumulative[t (cd)],Generator set A.power_capacity_margin[MW (sd)],Gas export compressor.is_valid[N/A],Gas export compressor.energy_usage[Sm3/cd],Gas export compressor.energy_usage_cumulative[Sm3 (cd)],Gas export compressor.co2.rate[t/sd],Gas export compressor.co2.cumulative[t (cd)],Gas export compressor.recirculation_loss[MW (sd)],Gas export compressor.rate_exceeds_maximum[N/A],Gas export compressor.outlet_pressure_before_choking[bara],Gas injection compressor.is_valid[N/A],Gas injection compressor.energy_usage[MW (sd)],Gas injection compressor.energy_usage_cumulative[MWd (cd)],Gas injection compressor.power[MW (sd)],Gas injection compressor.power_cumulative[GWh (cd)],Gas injection compressor.recirculation_loss[MW (sd)],Gas injection compressor.rate_exceeds_maximum[N/A],Gas injection compressor.outlet_pressure_before_choking[bara],Produced water reinjection pump.is_valid[N/A],Produced water reinjection pump.energy_usage[MW (sd)],Produced water reinjection pump.energy_usage_cumulative[MWd (cd)],Produced water reinjection pump.power[MW (sd)],Produced water reinjection pump.power_cumulative[GWh (cd)],Produced water reinjection pump.inlet_liquid_rate_m3_per_day[Sm3/sd],Produced water reinjection pump.inlet_pressure_bar[bara],Produced water reinjection pump.outlet_pressure_bar[bara],Produced water reinjection pump.operational_head[J/kg],Base production load.is_valid[N/A],Base production load.energy_usage[MW (sd)],Base production load.energy_usage_cumulative[MWd (cd)],Base production load.power[MW (sd)],Base production load.power_cumulative[GWh (cd)],Flare.is_valid[N/A],Flare.energy_usage[Sm3/cd],Flare.energy_usage_cumulative[Sm3 (cd)],Flare.co2.rate[t/sd],Flare.co2.cumulative[t (cd)],Sea water injection pump.is_valid[N/A],Sea water injection pump.energy_usage[MW (sd)],Sea water injection pump.energy_usage_cumulative[MWd (cd)],Sea water injection pump.power[MW (sd)],Sea water injection pump.power_cumulative[GWh (cd)]
timesteps,model.is_valid[N/A],model.energy_usage[Sm3/cd],model.energy_usage_cumulative[Sm3 (cd)],model.power[MW (sd)],model.power_cumulative[GWh (cd)],model.co2.rate[t/cd],model.co2.cumulative[t (cd)],model.hydrocarbon_export_rate[Sm3/cd],model.co2.intensity_sm3[kg/Sm3],model.co2.intensity_boe[kg/BOE],model.co2.intensity_yearly_sm3[kg/Sm3],model.co2.intensity_yearly_boe[kg/BOE],Installation A.is_valid[N/A],Installation A.energy_usage[Sm3/cd],Installation A.energy_usage_cumulative[Sm3 (cd)],Installation A.power[MW (sd)],Installation A.power_cumulative[GWh (cd)],Installation A.co2.rate[t/cd],Installation A.co2.cumulative[t (cd)],Installation A.hydrocarbon_export_rate[Sm3/cd],Installation A.co2.intensity_sm3[kg/Sm3],Installation A.co2.intensity_boe[kg/BOE],Installation A.co2.intensity_yearly_sm3[kg/Sm3],Installation A.co2.intensity_yearly_boe[kg/BOE],Installation A.regularity[N/A],Generator set A.is_valid[N/A],Generator set A.energy_usage[Sm3/cd],Generator set A.energy_usage_cumulative[Sm3 (cd)],Generator set A.power[MW (sd)],Generator set A.power_cumulative[GWh (cd)],Generator set A.co2.rate[t/cd],Generator set A.co2.cumulative[t (cd)],Generator set A.power_capacity_margin[MW (sd)],Gas export compressor.is_valid[N/A],Gas export compressor.energy_usage[Sm3/cd],Gas export compressor.energy_usage_cumulative[Sm3 (cd)],Gas export compressor.co2.rate[t/cd],Gas export compressor.co2.cumulative[t (cd)],Gas export compressor.recirculation_loss[MW (sd)],Gas export compressor.rate_exceeds_maximum[N/A],Gas export compressor.outlet_pressure_before_choking[bara],Gas injection compressor.is_valid[N/A],Gas injection compressor.energy_usage[MW (sd)],Gas injection compressor.energy_usage_cumulative[MWd (cd)],Gas injection compressor.power[MW (sd)],Gas injection compressor.power_cumulative[GWh (cd)],Gas injection compressor.recirculation_loss[MW (sd)],Gas injection compressor.rate_exceeds_maximum[N/A],Gas injection compressor.outlet_pressure_before_choking[bara],Produced water reinjection pump.is_valid[N/A],Produced water reinjection pump.energy_usage[MW (sd)],Produced water reinjection pump.energy_usage_cumulative[MWd (cd)],Produced water reinjection pump.power[MW (sd)],Produced water reinjection pump.power_cumulative[GWh (cd)],Produced water reinjection pump.inlet_liquid_rate_m3_per_day[Sm3/sd],Produced water reinjection pump.inlet_pressure_bar[bara],Produced water reinjection pump.outlet_pressure_bar[bara],Produced water reinjection pump.operational_head[J/kg],Base production load.is_valid[N/A],Base production load.energy_usage[MW (sd)],Base production load.energy_usage_cumulative[MWd (cd)],Base production load.power[MW (sd)],Base production load.power_cumulative[GWh (cd)],Flare.is_valid[N/A],Flare.energy_usage[Sm3/cd],Flare.energy_usage_cumulative[Sm3 (cd)],Flare.co2.rate[t/cd],Flare.co2.cumulative[t (cd)],Sea water injection pump.is_valid[N/A],Sea water injection pump.energy_usage[MW (sd)],Sea water injection pump.energy_usage_cumulative[MWd (cd)],Sea water injection pump.power[MW (sd)],Sea water injection pump.power_cumulative[GWh (cd)]
2020-01-01 00:00:00,0, 279678.00000, 0.00000, 22.69000, 0.00000, 612.49480, 0.00000, 12500.00000,nan,nan,48.99958,7.790077,0, 279678.00000, 0.00000, 22.69000, 0.00000, 612.49480, 0.00000, 12500.00000,nan,nan,48.99958,7.790077, 1.00000,1, 142678.00000, 0.00000, 22.69000, 0.00000, 312.46480, 0.00000, 77.31000,1, 130000.00000, 0.00000, 284.70000, 0.00000, 0.00000,0,nan,1, 4.89000, 0.00000, 4.89000, 0.00000, 0.00000,0,nan,0, 0.00000, 0.00000, 0.00000, 0.00000, 18000.00000, 10.00000, 200.00000, 18811.88000,1, 11.80000, 0.00000, 11.80000, 0.00000,1, 7000.00000, 0.00000, 15.33000, 0.00000,1, 6.00000, 0.00000, 6.00000, 0.00000
2021-01-01 00:00:00,0, 276914.90000, 102362148.00000, 22.06000, 199.30900, 606.44360, 224173.10000, 11600.00000,48.99958,7.790077,52.27962,8.311545,0, 276914.90000, 102362148.00000, 22.06000, 199.30900, 606.44360, 224173.10000, 11600.00000,48.99958,7.790077,52.27962,8.311545, 1.00000,1, 138772.00000, 52220148.00000, 22.06000, 199.30900, 303.91070, 114362.10000, 77.94000,1, 131142.90000, 47580000.00000, 287.20290, 104200.20000, 0.00000,0,nan,1, 5.01000, 1789.74000, 5.01000, 42.95376, 0.00000,0,nan,0, 0.00000, 0.00000, 0.00000, 0.00000, 19000.00000, 10.00000, 200.00000, 18811.88000,1, 11.80000, 4318.80000, 11.80000, 103.65120,1, 7000.00000, 2562000.00000, 15.33000, 5610.78000,1, 5.25000, 2196.00000, 5.25000, 52.70400
2022-01-01 00:00:00,1, 309378.10000, 203436086.00000, 27.11168, 392.55460, 677.53800, 445525.00000, 10700.00000,50.57612,8.040718,63.32131,10.06698,1, 309378.10000, 203436071.00000, 27.11168, 392.55460, 677.53800, 445525.00000, 10700.00000,50.57612,8.040718,63.32131,10.06698, 1.00000,1, 170092.40000, 102871928.00000, 27.11168, 392.55460, 372.50230, 225289.50000, 72.88832,1, 132285.70000, 95447143.00000, 289.70570, 209029.20000, 0.00000,0,nan,1, 5.13000, 3618.39000, 5.13000, 86.84136, 0.00000,0,nan,1, 4.68168, 0.00000, 4.68168, 0.00000, 15000.00000, 10.00000, 200.00000, 18811.88000,1, 11.80000, 8625.80000, 11.80000, 207.01920,1, 7000.00000, 5117000.00000, 15.33000, 11206.23000,1, 5.50000, 4112.25000, 5.50000, 98.69400
Expand Down
Loading

0 comments on commit 6465e9d

Please sign in to comment.