@sh.add_function(dsp, outputs=['extended_phases_co2_emissions'])
def calculate_extended_phases_co2_emissions(
extended_cumulative_co2_emissions, extended_phases_distances):
"""
Calculates the extended CO2 emission of cycle phases [CO2g/km].
:param extended_cumulative_co2_emissions:
Extended cumulative CO2 of cycle phases [CO2g].
:type extended_cumulative_co2_emissions: numpy.array
:param extended_phases_distances:
Extended cycle phases distances [km].
:type extended_phases_distances: numpy.array
:return:
Extended CO2 emission of cycle phases [CO2g/km].
:rtype: numpy.array
"""
with np.errstate(divide='ignore', invalid='ignore'):
x = extended_cumulative_co2_emissions
return np.nan_to_num(x / extended_phases_distances)