Selection of small cities EF
@ctena , we need to modify the traffic_area_sector.py
script to make sure that HERMES always selects de emission factors for the row default
.
Right now it selects the first row (which is the default, but could change at some point):
def small_cities_emissions_by_population(self, pop_by_cell):
spent_time = timeit.default_timer()
ef_df = pd.read_csv(self.small_cities_ef_file, sep=',')
ef_df.drop(['Code', 'Copert_V_name'], axis=1, inplace=True)
for pollutant in ef_df.columns.values:
pop_by_cell[pollutant] = pop_by_cell['population'] * ef_df[pollutant].iloc[0]
pop_by_cell.drop(columns=['population'], inplace=True)
self.logger.write_time_log('TrafficAreaSector', 'small_cities_emissions_by_population',
timeit.default_timer() - spent_time)
return pop_by_cell
The code should be updated as follows:
def small_cities_emissions_by_population(self, pop_by_cell):
spent_time = timeit.default_timer()
ef_df = pd.read_csv(self.small_cities_ef_file, sep=',', index_col_name='Code)
ef_df.drop(['Copert_V_name'], axis=1, inplace=True)
for pollutant in ef_df.columns.values:
pop_by_cell[pollutant] = pop_by_cell['population'] * ef_df.loc['default', pollutant]
pop_by_cell.drop(columns=['population'], inplace=True)
self.logger.write_time_log('TrafficAreaSector', 'small_cities_emissions_by_population',
timeit.default_timer() - spent_time)
return pop_by_cell