Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

notes on plans with the rest of dimension classes #536

Merged
merged 2 commits into from
Apr 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions momepy/dimension.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ class Area:
"""

def __init__(self, gdf):
# TODO: deprecate and point people to .area
self.gdf = gdf
self.series = self.gdf.geometry.area

Expand Down Expand Up @@ -90,6 +91,7 @@ class Perimeter:
"""

def __init__(self, gdf):
# TODO: deprecate and point people to .length
self.gdf = gdf
self.series = self.gdf.geometry.length

Expand Down Expand Up @@ -138,6 +140,7 @@ class Volume:
"""

def __init__(self, gdf, heights, areas=None):
# TODO: deprecate in favor of volume
self.gdf = gdf

gdf = gdf.copy()
Expand Down Expand Up @@ -210,6 +213,7 @@ class FloorArea:
"""

def __init__(self, gdf, heights, areas=None):
# TODO: deprecate in favor of floor_area
self.gdf = gdf

gdf = gdf.copy()
Expand Down Expand Up @@ -264,6 +268,7 @@ class CourtyardArea:
"""

def __init__(self, gdf, areas=None):
# TODO: deprecate in favor of courtyard_area
self.gdf = gdf

gdf = gdf.copy()
Expand Down Expand Up @@ -311,6 +316,7 @@ class LongestAxisLength:
"""

def __init__(self, gdf):
# TODO: deprecate in favor of longest_axis_length
self.gdf = gdf
hulls = gdf.geometry.convex_hull.exterior
self.series = hulls.apply(lambda g: _circle_radius(list(g.coords))) * 2
Expand Down Expand Up @@ -396,6 +402,7 @@ def __init__(
mode="all",
verbose=True,
):
# TODO: deprecate in favor of momepy.describe
self.gdf = gdf
self.sw = spatial_weights
self.id = gdf[unique_id]
Expand Down Expand Up @@ -534,6 +541,8 @@ def __init__(
distance=10,
tick_length=50,
):
# TODO: turn into a function with a variable return like np.unique. Maybe
# TODO: check if we can avoid some of the loops
self.left = left
self.right = right
self.distance = distance
Expand Down Expand Up @@ -749,6 +758,9 @@ class WeightedCharacter:
def __init__(
self, gdf, values, spatial_weights, unique_id, areas=None, verbose=True
):
# TODO: Refactoring project note: This is a lag using a graph where weight
# TODO: represents row-normalied area. It now includes self but that shall be
# TODO: optional.
self.gdf = gdf
self.sw = spatial_weights
self.id = gdf[unique_id]
Expand Down Expand Up @@ -821,6 +833,9 @@ class CoveredArea:
"""

def __init__(self, gdf, spatial_weights, unique_id, verbose=True):
# TODO: Refactoring project note: This is just a lag with binary weights over
# TODO: the area using the graph with self-weights. Maybe point to that?

self.gdf = gdf
self.sw = spatial_weights
self.id = gdf[unique_id]
Expand Down Expand Up @@ -881,6 +896,7 @@ class PerimeterWall:
"""

def __init__(self, gdf, spatial_weights=None, verbose=True):
# TODO: deprecate in favor of perimeter_wall
self.gdf = gdf

if spatial_weights is None:
Expand Down Expand Up @@ -960,6 +976,10 @@ class SegmentsLength:
"""

def __init__(self, gdf, spatial_weights=None, mean=False, verbose=True):
# TODO: Refactoring project note: This is just a lag with binary (sum) or
# TODO: row-standardized graph that includes self weight over lenghts.
# TODO: Worth wrapping or point to lag? Probably latter?

self.gdf = gdf

if spatial_weights is None:
Expand Down