standardizing naming conventions in code
This commit is contained in:
parent
4b3481b1a6
commit
04bd067045
@ -31,13 +31,13 @@ class Getis(object):
|
|||||||
# geometries with attributes that are null are ignored
|
# geometries with attributes that are null are ignored
|
||||||
# resulting in a collection of not as near neighbors if kNN is chosen
|
# resulting in a collection of not as near neighbors if kNN is chosen
|
||||||
|
|
||||||
qvals = OrderedDict([("id_col", id_col),
|
params = OrderedDict([("id_col", id_col),
|
||||||
("attr1", attr),
|
("attr1", attr),
|
||||||
("geom_col", geom_col),
|
("geom_col", geom_col),
|
||||||
("subquery", subquery),
|
("subquery", subquery),
|
||||||
("num_ngbrs", num_ngbrs)])
|
("num_ngbrs", num_ngbrs)])
|
||||||
|
|
||||||
result = self.data_provider.get_getis(w_type, qvals)
|
result = self.data_provider.get_getis(w_type, params)
|
||||||
attr_vals = pu.get_attributes(result)
|
attr_vals = pu.get_attributes(result)
|
||||||
|
|
||||||
# build PySAL weight object
|
# build PySAL weight object
|
||||||
|
@ -20,12 +20,12 @@ class Kmeans(object):
|
|||||||
"geom_col": "the_geom",
|
"geom_col": "the_geom",
|
||||||
"id_col": "cartodb_id"}
|
"id_col": "cartodb_id"}
|
||||||
|
|
||||||
data = self.data_provider.get_spatial_kmeans(params)
|
result = self.data_provider.get_spatial_kmeans(params)
|
||||||
|
|
||||||
# Unpack query response
|
# Unpack query response
|
||||||
xs = data[0]['xs']
|
xs = result[0]['xs']
|
||||||
ys = data[0]['ys']
|
ys = result[0]['ys']
|
||||||
ids = data[0]['ids']
|
ids = result[0]['ids']
|
||||||
|
|
||||||
km = KMeans(n_clusters=no_clusters, n_init=no_init)
|
km = KMeans(n_clusters=no_clusters, n_init=no_init)
|
||||||
labels = km.fit_predict(zip(xs, ys))
|
labels = km.fit_predict(zip(xs, ys))
|
||||||
|
@ -61,14 +61,14 @@ class Markov(object):
|
|||||||
"subquery": subquery,
|
"subquery": subquery,
|
||||||
"num_ngbrs": num_ngbrs}
|
"num_ngbrs": num_ngbrs}
|
||||||
|
|
||||||
query_result = self.data_provider.get_markov(w_type, params)
|
result = self.data_provider.get_markov(w_type, params)
|
||||||
|
|
||||||
# build weight
|
# build weight
|
||||||
weights = pu.get_weight(query_result, w_type)
|
weights = pu.get_weight(result, w_type)
|
||||||
weights.transform = 'r'
|
weights.transform = 'r'
|
||||||
|
|
||||||
# prep time data
|
# prep time data
|
||||||
t_data = get_time_data(query_result, time_cols)
|
t_data = get_time_data(result, time_cols)
|
||||||
|
|
||||||
sp_markov_result = ps.Spatial_Markov(t_data,
|
sp_markov_result = ps.Spatial_Markov(t_data,
|
||||||
weights,
|
weights,
|
||||||
|
Loading…
Reference in New Issue
Block a user