Skip to content

Commit

Permalink
refactor: Rename vector_features_from_network -> `create_vector_fea…
Browse files Browse the repository at this point in the history
…tures_from_network`
  • Loading branch information
annehaley committed Aug 21, 2024
1 parent 296dc78 commit a287c78
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions sample_data/use_cases/new_york_energy/import_networks.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from django.contrib.gis.db.models.functions import Distance
from django.contrib.gis.geos import Point, LineString
from uvdat.core.models import Network, NetworkEdge, NetworkNode, VectorMapLayer
from uvdat.core.tasks.networks import vector_features_from_network
from uvdat.core.tasks.networks import create_vector_features_from_network


TOLERANCE_METERS = 15
Expand Down Expand Up @@ -74,7 +74,7 @@ def create_network(dataset, network_name, geodata):
not_connected.delete()

NetworkEdge.objects.bulk_create(edges, batch_size=1000)
vector_features_from_network(network)
create_vector_features_from_network(network)
print(f'\t\tCreated {network.nodes.count()} nodes and {network.edges.count()} edges.')


Expand Down
4 changes: 2 additions & 2 deletions sample_data/use_cases/new_york_energy/nysdp.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

from django.contrib.gis.geos import GEOSGeometry, Point, LineString
from uvdat.core.models import Dataset, Network, NetworkNode, NetworkEdge, VectorMapLayer, VectorFeature, SourceRegion
from uvdat.core.tasks.networks import vector_features_from_network
from uvdat.core.tasks.networks import create_vector_features_from_network

from .interpret_network import interpret_group

Expand Down Expand Up @@ -173,7 +173,7 @@ def create_consolidated_network(dataset, **kwargs):
], batch_size=1000)

print(f'\t\t{network.nodes.count()} nodes created, {network.edges.count()} edges created.')
vector_features_from_network(network)
create_vector_features_from_network(network)

print(f'\t\t{dataset.networks.count()} separate networks created.')
print(f'\tCompleted in {(datetime.now() - start).total_seconds()} seconds.')
4 changes: 2 additions & 2 deletions uvdat/core/tasks/networks.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,8 @@ def geojson_from_network(dataset):
return new_geodata.to_json()


def vector_features_from_network(network):
map_layer, created = VectorMapLayer.objects.get_or_create(dataset=network.dataset, index=0)
def create_vector_features_from_network(network):
map_layer, _ = VectorMapLayer.objects.get_or_create(dataset=network.dataset, index=0)
VectorFeature.objects.bulk_create(
[
VectorFeature(
Expand Down

0 comments on commit a287c78

Please sign in to comment.