rename some variables

This commit is contained in:
Andy Eschbacher 2016-06-01 15:07:16 -04:00
parent ae1bb703a7
commit c04e15ef81

View File

@ -2,7 +2,7 @@
CREATE OR REPLACE FUNCTION CREATE OR REPLACE FUNCTION
CDB_AreasOfInterestGlobal( CDB_AreasOfInterestGlobal(
subquery TEXT, subquery TEXT,
attr_name TEXT, column_name TEXT,
w_type TEXT DEFAULT 'knn', w_type TEXT DEFAULT 'knn',
num_ngbrs INT DEFAULT 5, num_ngbrs INT DEFAULT 5,
permutations INT DEFAULT 99, permutations INT DEFAULT 99,
@ -13,14 +13,14 @@ AS $$
plpy.execute('SELECT cdb_crankshaft._cdb_crankshaft_activate_py()') plpy.execute('SELECT cdb_crankshaft._cdb_crankshaft_activate_py()')
from crankshaft.clustering import moran_local from crankshaft.clustering import moran_local
# TODO: use named parameters or a dictionary # TODO: use named parameters or a dictionary
return moran(subquery, attr, w_type, num_ngbrs, permutations, geom_col, id_col) return moran(subquery, column_name, w_type, num_ngbrs, permutations, geom_col, id_col)
$$ LANGUAGE plpythonu; $$ LANGUAGE plpythonu;
-- Moran's I Local (internal function) -- Moran's I Local (internal function)
CREATE OR REPLACE FUNCTION CREATE OR REPLACE FUNCTION
_CDB_AreasOfInterestLocal( _CDB_AreasOfInterestLocal(
subquery TEXT, subquery TEXT,
attr TEXT, column_name TEXT,
w_type TEXT, w_type TEXT,
num_ngbrs INT, num_ngbrs INT,
permutations INT, permutations INT,
@ -31,14 +31,14 @@ AS $$
plpy.execute('SELECT cdb_crankshaft._cdb_crankshaft_activate_py()') plpy.execute('SELECT cdb_crankshaft._cdb_crankshaft_activate_py()')
from crankshaft.clustering import moran_local from crankshaft.clustering import moran_local
# TODO: use named parameters or a dictionary # TODO: use named parameters or a dictionary
return moran_local(subquery, attr, w_type, num_ngbrs, permutations, geom_col, id_col) return moran_local(subquery, column_name, w_type, num_ngbrs, permutations, geom_col, id_col)
$$ LANGUAGE plpythonu; $$ LANGUAGE plpythonu;
-- Moran's I Local (public-facing function) -- Moran's I Local (public-facing function)
CREATE OR REPLACE FUNCTION CREATE OR REPLACE FUNCTION
CDB_AreasOfInterestLocal( CDB_AreasOfInterestLocal(
subquery TEXT, subquery TEXT,
attr TEXT, column_name TEXT,
w_type TEXT DEFAULT 'knn', w_type TEXT DEFAULT 'knn',
num_ngbrs INT DEFAULT 5, num_ngbrs INT DEFAULT 5,
permutations INT DEFAULT 99, permutations INT DEFAULT 99,
@ -48,7 +48,7 @@ RETURNS TABLE (moran NUMERIC, quads TEXT, significance NUMERIC, rowid INT, vals
AS $$ AS $$
SELECT moran, quads, significance, rowid, vals SELECT moran, quads, significance, rowid, vals
FROM cdb_crankshaft._CDB_AreasOfInterestLocal(subquery, attr, w_type, num_ngbrs, permutations, geom_col, id_col); FROM cdb_crankshaft._CDB_AreasOfInterestLocal(subquery, column_name, w_type, num_ngbrs, permutations, geom_col, id_col);
$$ LANGUAGE SQL; $$ LANGUAGE SQL;
@ -56,7 +56,7 @@ $$ LANGUAGE SQL;
CREATE OR REPLACE FUNCTION CREATE OR REPLACE FUNCTION
CDB_GetSpatialHotspots( CDB_GetSpatialHotspots(
subquery TEXT, subquery TEXT,
attr TEXT, column_name TEXT,
w_type TEXT DEFAULT 'knn', w_type TEXT DEFAULT 'knn',
num_ngbrs INT DEFAULT 5, num_ngbrs INT DEFAULT 5,
permutations INT DEFAULT 99, permutations INT DEFAULT 99,
@ -66,7 +66,7 @@ CREATE OR REPLACE FUNCTION
AS $$ AS $$
SELECT moran, quads, significance, rowid, vals SELECT moran, quads, significance, rowid, vals
FROM cdb_crankshaft._CDB_AreasOfInterestLocal(subquery, attr, w_type, num_ngbrs, permutations, geom_col, id_col) FROM cdb_crankshaft._CDB_AreasOfInterestLocal(subquery, column_name, w_type, num_ngbrs, permutations, geom_col, id_col)
WHERE quads IN ('HH', 'HL'); WHERE quads IN ('HH', 'HL');
$$ LANGUAGE SQL; $$ LANGUAGE SQL;