iucm.energy_consumption module

Energy consumption module of the iucm package

This module, together with the dist_numerator package contains the necessary functions for computing the energy consumption of a city. The main API function is the energy_consumption() function. Note that the OWN value is set to the value for Stuttgart, Germany. You should change it if you want to model another city. The parameters of this module come from [LeNechet2012].

References

[LeNechet2012](1, 2, 3, 4, 5, 6, 7, 8) Le Néchet, Florent. “Urban spatial structure, daily mobility and energy consumption: a study of 34 european cities.” Cybergeo: European Journal of Geography (2012).

Classes

EnVariables(k, dist, entrop, rss, own) A tuple containing the values that setup the energy consumption

Data

K Intercept of energy consumption
OWN number of cars per 100 people. The default is 0, i.e. the value is ignored.
std_err_LeNechet The standard errors of the weights used in [LeNechet2012] (obtained through private communication via R.
wDIST weight for average distance of two individuals on energy consumption
wENTROP weight for entropy on energy consumption
wOWN weight for car owner ship on energy consumption
wRSS weight for rank-size rule slope on energy consumption
weights_LeNechet The weights for the variables to calculate the energy_consumption from

Functions

energy_consumption(population, x, y[, …]) Compute the energy consumption of a city
entrop(population, size) Compute the entropy of a city
random_weights(weights) Draw random weights
rss(population) Compute the Rank-Size slope coefficient
class iucm.energy_consumption.EnVariables(k, dist, entrop, rss, own)

Bases: tuple

A tuple containing the values that setup the energy consumption

Parameters:
  • k (float) – Intercept of energy consumption
  • dist (float) – Average distance between two individuals
  • entrop (float) – Entropy
  • rss (float) – Rank-Size Slope
  • own (float) – weight for car owner ship on energy consumption

Attributes

dist Alias for field number 1
entrop Alias for field number 2
k Alias for field number 0
own Alias for field number 4
rss Alias for field number 3

Create new instance of EnVariables(k, dist, entrop, rss, own)

dist

Alias for field number 1

entrop

Alias for field number 2

k

Alias for field number 0

own

Alias for field number 4

rss

Alias for field number 3

iucm.energy_consumption.K = -346.5

Intercept of energy consumption

iucm.energy_consumption.OWN = 0

number of cars per 100 people. The default is 0, i.e. the value is ignored. Another possible value that has been previously used might be 37.7, the value for Stuttgart

iucm.energy_consumption.energy_consumption(population, x, y, dist0=-1, slicer=None, indices=None, increase=None, weights=EnVariables(k=-346.5, dist=279.0, entrop=21700.0, rss=-9343.0, own=17.36))[source]

Compute the energy consumption of a city

Compute the energy consumption according to [LeNechet2012] via

\[E = -346 + 17.4 \cdot OWN + 279\cdot DIST - 9340\cdot RSS + 21700\cdot ENTROP\]
Parameters:
  • population (1D np.ndarray) – The 1D population data
  • x (1D np.ndarray) – The x coordinates information for each cell in population in kilometers
  • y (1D np.ndarray) – The y coordinates information for each cell in population in kilometers
  • dist0 (float, optional) – The previous average distance between two individuals (see iucm.dist.dist() function). Speeds up the computation significantly
  • slicer (slice or boolean array, optional) – The slicer that can be use to access the changed cells specified by increase
  • indices (1D np.ndarray of dtype int, optional) – The indices corresponding to the increase in increase
  • increase (1D np.ndarray, optional) – The changed population which will be added on population. Specifying this and dist0 speeds up the computation significantly instead of using the population alone. Note that you must then also specify slicer and indices
  • weights (EnVariables) – The multiple regression coefficients (weights) for the calculating the energy consumption. If not given, the (0-dimensional) weights after [LeNechet2012] (weights_LeNechet, see above equation) are used.
Returns:

  • np.ndarray of dtype float – The energy consumption. The shape of the array depends on the given weights
  • float – The average distance between two individuals (DIST)
  • float – The entropy ENTROP
  • float – The rank-size-slope RSS

See also

OWN(), entrop(), rss(), dist_numerator()

iucm.energy_consumption.entrop(population, size)[source]

Compute the entropy of a city

Compute the entropy of a city after [LeNechet2012] via

\[ENTROP = \frac{ \sum_{i=1}^{size}\frac{p_i}{P_{sum}} \log\frac{p_i}{P_{sum}}}{ \log size}\]
Parameters:
  • population (1D np.ndarray) – The population data (must not contain 0!)
  • size (int) – The original size of the population data (including 0)
Returns:

The entropy value

Return type:

float

iucm.energy_consumption.random_weights(weights)[source]

Draw random weights

This functions draws random weights and fills the arrays in the given weights with them. Weights are drawn using normal distributions defined through the weights_LeNechet and std_err_LeNechet.

Parameters:weights (EnVariables) – The arrays to fill

Notes

weights are modified inplace!

iucm.energy_consumption.rss(population)[source]

Compute the Rank-Size slope coefficient

The rank-size coefficient \(a > 0\) is calculated through a linear fit after [LeNechet2012] with

\[\log\frac{p_k}{p_1} = -a \log{k}\]

where \(p_k\) is the :population of the math:k-th ranking cell.

Parameters:population (1D np.ndarray) – The population data (must not contain 0!)
Returns:The rank-size coefficient
Return type:float
iucm.energy_consumption.std_err_LeNechet = EnVariables(k=10500.0, dist=74.88, entrop=9172.0, rss=2776.0, own=4.696)

The standard errors of the weights used in [LeNechet2012] (obtained through private communication via R. Cremades)

iucm.energy_consumption.wDIST = 279.0

weight for average distance of two individuals on energy consumption

iucm.energy_consumption.wENTROP = 21700.0

weight for entropy on energy consumption

iucm.energy_consumption.wOWN = 17.36

weight for car owner ship on energy consumption

iucm.energy_consumption.wRSS = -9343.0

weight for rank-size rule slope on energy consumption

iucm.energy_consumption.weights_LeNechet = EnVariables(k=-346.5, dist=279.0, entrop=21700.0, rss=-9343.0, own=17.36)

The weights for the variables to calculate the energy_consumption from the multiple regression after [LeNechet2012]