momepy.Alignment#

class momepy.Alignment(gdf, spatial_weights, unique_id, orientations, verbose=True)[source]#

Calculate the mean deviation of solar orientation of objects on adjacent cells from an object.

\[\frac{1}{n}\sum_{i=1}^n dev_i=\frac{dev_1+dev_2+\cdots+dev_n}{n}\]
Parameters:
gdfGeoDataFrame

A GeoDataFrame containing objects to analyse.

spatial_weightslibpysal.weights, optional

A spatial weights matrix.

orientationsstr, list, np.array, pd.Series

The name of the left dataframe column, np.array, or pd.Series where object orientation values are stored. This can be calculated using momepy.Orientation.

unique_idstr

The name of the unique ID column used as the spatial_weights index.

verbosebool (default True)

If True, shows progress bars in loops and indication of steps.

Examples

>>> buildings_df['alignment'] = momepy.Alignment(buildings_df,
...                                              sw,
...                                              'uID',
...                                              bl_orient).series
100%|██████████| 144/144 [00:01<00:00, 140.84it/s]
>>> buildings_df['alignment'][0]
18.299481296455237
Attributes:
seriesSeries

A Series containing resulting values.

gdfGeoDataFrame

The original GeoDataFrame.

orientationsSeries

A Series containing used orientation values.

swlibpysal.weights

The spatial weights matrix.

idSeries

A Series containing used unique ID.

__init__(gdf, spatial_weights, unique_id, orientations, verbose=True)[source]#

Methods

__init__(gdf, spatial_weights, unique_id, ...)