コード例 #1
0
def _areaToPGSphere(node, state):
	# pgsphere returns rad**2, adql wants deg**2
	return "3282.806350011744*%s"%flatten(node)
コード例 #2
0
def _flatAndMorph(node):
# This helper flattens a node after applying standard morphs on it.
# I need this for the arguments of q3c stuff, since there may
# be ADQL specifics in there.
	return nodes.flatten(morphPG(node)[1])
コード例 #3
0
def _morphPolygon(node, state):
	points = ['spoint(RADIANS(%s), RADIANS(%s))'%(flatten(a[0]), flatten(a[1]))
		for a in node.coos]
	return _makePoly(node.cooSys, points, node)
コード例 #4
0
def _distanceToPG(node, state):
	return "DEGREES((%s) <-> (%s))"%tuple(flatten(a) for a in node.args)
コード例 #5
0
def _morphPoint(node, state):
	return PgSphereCode(node.cooSys,
		"spoint(RADIANS(%s), RADIANS(%s))"%tuple(
			flatten(a) for a in (node.x, node.y)),
		original=node)
コード例 #6
0
def _match(args):
    if len(args) != 2:
        raise common.UfuncError("gavo_match takes exactly two arguments")
    return "(CASE WHEN %s ~ %s THEN 1 ELSE 0 END)" % (nodes.flatten(
        args[1]), nodes.flatten(args[0]))
コード例 #7
0
def _ivo_healpix_center(args):
    if len(args) != 2:
        raise common.UfuncError("ivo_healpix_center only takes (index, order)"
                                " arguments")
    return "center_of_healpix_nest(%s, %s)" % (nodes.flatten(
        args[0]), nodes.flatten(args[1]))
コード例 #8
0
def _string_agg(args):
    if len(args) != 2:
        raise common.UfuncError("ivo_string_agg takes exactly two arguments")
    return "string_agg(%s, %s)" % (nodes.flatten(
        args[0]), nodes.flatten(args[1]))
コード例 #9
0
def _to_jd(args):
    if len(args) != 1:
        raise common.UfuncError(
            "gavo_to_jd takes exactly one timestamp argument")
    return "ts_to_jd(%s)" % nodes.flatten(args[0])