Commit 603c8b34 authored by Wei Shoulin's avatar Wei Shoulin
Browse files

dfs_heapix_sql_condition

parent bf6b5596
Pipeline #6458 passed with stage
......@@ -92,7 +92,7 @@ def catalog_heapix_sql_condition(ra, dec, radius, ra_col = 'ra', dec_col = 'dec'
return whereSql
def level2_heapix_sql_condition(ra, dec, radius, ra_col = 'ra', dec_col = 'dec', nside = DEFAULT_NSIDE):
def dfs_heapix_sql_condition(ra, dec, radius, ra_col = 'ra', dec_col = 'dec', brick_col = "brick_id", nside = DEFAULT_NSIDE):
x2 = f"cos(pi()*{dec_col}/180.0)*cos(pi()*{ra_col}/180.0)"
y2 = f"cos(pi()*{dec_col}/180.0)*sin(pi()*{ra_col}/180.0)"
z2 = f"sin(pi()*{dec_col}/180.0)"
......@@ -104,10 +104,9 @@ def level2_heapix_sql_condition(ra, dec, radius, ra_col = 'ra', dec_col = 'dec',
distance = f"pow(({x2}-{x1}),2)+pow(({y2}-{y1}),2)+pow(({z2}-{z1}),2)"
heapix_ids = get_healpix_ids(ra, dec, radius, nside)
nside_column = "brick_id"
whereZoneSql = "%s in (%s)" % \
(nside_column, ','.join([str(i) for i in heapix_ids]))
(brick_col, ','.join([str(i) for i in heapix_ids]))
whereSql = f"{distance} <= 4*pow(pi()*{radius}/180.0/2, 2) and {whereZoneSql}"
return whereSql
\ No newline at end of file
return whereSql
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment