Spaces:
Sleeping
Sleeping
nastasiasnk
commited on
Commit
•
552f08c
1
Parent(s):
7e3e04c
Update app.py
Browse files
app.py
CHANGED
@@ -80,7 +80,7 @@ import imports_utils
|
|
80 |
import speckle_utils
|
81 |
import data_utils
|
82 |
|
83 |
-
from config import landuseDatabaseId , streamId,
|
84 |
from imports_utils import speckleToken
|
85 |
from imports_utils import fetchDistanceMatrices
|
86 |
from config import distanceMatrixActivityNodes
|
@@ -90,8 +90,16 @@ CLIENT = SpeckleClient(host="https://speckle.xyz/")
|
|
90 |
account = get_default_account()
|
91 |
CLIENT.authenticate_with_token(token=speckleToken)
|
92 |
|
93 |
-
streamDistanceMatrices = speckle_utils.getSpeckleStream(streamId,
|
94 |
matrices = fetchDistanceMatrices (streamDistanceMatrices)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
95 |
df_dm = matrices[distanceMatrixActivityNodes]
|
96 |
df_dm_transport = matrices[distanceMatrixTransportStops]
|
97 |
|
@@ -99,6 +107,19 @@ dm_dictionary = df_dm.to_dict('index')
|
|
99 |
df_dm_transport_dictionary = df_dm_transport.to_dict('index')
|
100 |
|
101 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
102 |
|
103 |
def test(input_json):
|
104 |
print("Received input")
|
@@ -348,7 +369,7 @@ def test(input_json):
|
|
348 |
"luDomainMapper": landuseMapperDict,
|
349 |
"attributeMapper": attributeMapperDict,
|
350 |
"fetchDm": dm_dictionary,
|
351 |
-
"
|
352 |
}
|
353 |
|
354 |
|
|
|
80 |
import speckle_utils
|
81 |
import data_utils
|
82 |
|
83 |
+
from config import landuseDatabaseId , streamId, dmBranchName, dmCommitId, luBranchName, luCommitId
|
84 |
from imports_utils import speckleToken
|
85 |
from imports_utils import fetchDistanceMatrices
|
86 |
from config import distanceMatrixActivityNodes
|
|
|
90 |
account = get_default_account()
|
91 |
CLIENT.authenticate_with_token(token=speckleToken)
|
92 |
|
93 |
+
streamDistanceMatrices = speckle_utils.getSpeckleStream(streamId,dmBranchName,CLIENT, dmCommitId)
|
94 |
matrices = fetchDistanceMatrices (streamDistanceMatrices)
|
95 |
+
|
96 |
+
streamLanduses = speckle_utils.getSpeckleStream(streamId,luBranchName,CLIENT, luCommitId)
|
97 |
+
streamData = streamLanduses["@Data"]["@{0}"]
|
98 |
+
df_speckle_lu = speckle_utils.get_dataframe(streamData, return_original_df=False)
|
99 |
+
df_lu = df_speckle_lu.copy()
|
100 |
+
# set index column
|
101 |
+
df_lu = df_lu.set_index("ids", drop=False)
|
102 |
+
|
103 |
df_dm = matrices[distanceMatrixActivityNodes]
|
104 |
df_dm_transport = matrices[distanceMatrixTransportStops]
|
105 |
|
|
|
107 |
df_dm_transport_dictionary = df_dm_transport.to_dict('index')
|
108 |
|
109 |
|
110 |
+
# filter activity nodes attributes
|
111 |
+
mask_connected = df_dm.index.tolist()
|
112 |
+
lu_columns = []
|
113 |
+
for name in df_lu.columns:
|
114 |
+
if name.startswith("lu+"):
|
115 |
+
lu_columns.append(name)
|
116 |
+
df_lu_filtered = df_lu[lu_columns].loc[mask_connected]
|
117 |
+
df_lu_filtered
|
118 |
+
|
119 |
+
df_lu_filtered_dict = df_lu_filtered.to_dict('index')
|
120 |
+
|
121 |
+
|
122 |
+
|
123 |
|
124 |
def test(input_json):
|
125 |
print("Received input")
|
|
|
369 |
"luDomainMapper": landuseMapperDict,
|
370 |
"attributeMapper": attributeMapperDict,
|
371 |
"fetchDm": dm_dictionary,
|
372 |
+
"landuses":df_lu_filtered_dict
|
373 |
}
|
374 |
|
375 |
|