fix paths; fix query
This commit is contained in:
@@ -4,8 +4,8 @@ CDB_GWR(subquery text, dep_var text, ind_vars text[],
|
||||
RETURNS table(v1 numeric, v2 numeric, v3 numeric, v4 numeric, v5 numeric, v6 numeric, rowid bigint)
|
||||
AS $$
|
||||
|
||||
from crankshaft.regression import gwr
|
||||
from crankshaft.regression import gwr_cs
|
||||
|
||||
return gwr(subquery, dep_var, ind_vars, fixed, kernel)
|
||||
return gwr_cs.gwr(subquery, dep_var, ind_vars, fixed, kernel)
|
||||
|
||||
$$ LANGUAGE plpythonu;
|
||||
|
||||
@@ -202,7 +202,7 @@ def gwr_query(params):
|
||||
array_agg(ST_X({geom_col})) As x,
|
||||
array_agg(ST_Y({geom_col})) As y,
|
||||
array_agg({dep_var}) As dep_var,
|
||||
%(ind_vars_select)s,
|
||||
%(ind_vars_select)s
|
||||
array_agg({id_col}) As rowid
|
||||
FROM ({subquery}) As q
|
||||
WHERE
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import numpy as np
|
||||
from gwr.base.gwr import GWR
|
||||
from gwr.base.sel_bw import Sel_BW
|
||||
import plpy
|
||||
import crankshaft.pysal_utils as pu
|
||||
|
||||
|
||||
def gwr(subquery, dep_var, ind_vars,
|
||||
@@ -22,8 +24,11 @@ def gwr(subquery, dep_var, ind_vars,
|
||||
'ind_vars': ind_vars}
|
||||
|
||||
try:
|
||||
query_result = plpy.execute(pu.gwr_query(params))
|
||||
query = pu.gwr_query(params)
|
||||
plpy.notice(query)
|
||||
query_result = plpy.execute(query)
|
||||
except plpy.SPIError, err:
|
||||
plpy.notice(query)
|
||||
plpy.error('Analysis failed: %s' % err)
|
||||
|
||||
# TODO: should x, y be centroids? point on surface?
|
||||
Reference in New Issue
Block a user