From 5c73b401dd9ca82fd0de80a7938716e6d272739b Mon Sep 17 00:00:00 2001 From: shoulinwei Date: Wed, 27 Dec 2023 22:15:20 +0800 Subject: [PATCH] generate coordinate search condition sql --- csst_dfs_api_cluster/facility/level2.py | 27 +++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/csst_dfs_api_cluster/facility/level2.py b/csst_dfs_api_cluster/facility/level2.py index 50a454f..47d499f 100644 --- a/csst_dfs_api_cluster/facility/level2.py +++ b/csst_dfs_api_cluster/facility/level2.py @@ -96,6 +96,33 @@ class Level2DataApi(object): except grpc.RpcError as e: return Result.error(message="%s:%s" % (e.code().value, e.details())) + def coord_cond_sql(self, **kwargs): + ''' generate coordinate search condition sql + + :param kwargs: Parameter dictionary, key items support: + data_type: [str] + ra: [float] + dec: [float] + radius: [float] + + :returns: csst_dfs_common.models.Result + ''' + try: + resp = self.stub.CoordCond(level2_pb2.CoordCondReq( + data_type = get_parameter(kwargs, "data_type"), + ra = get_parameter(kwargs, "ra"), + dec = get_parameter(kwargs, "dec"), + radius = get_parameter(kwargs, "radius") + ),metadata = get_auth_headers()) + + if resp.success: + return Result.ok_data(data = resp.condition) + else: + return Result.error(message = str(resp.error.detail)) + + except grpc.RpcError as e: + return Result.error(message="%s:%s" % (e.code().value, e.details())) + def find_existed_brick_ids(self, **kwargs): ''' retrieve existed brick_ids in a single exposure catalog -- GitLab