Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
csst-dfs
csst-dfs-api
Commits
2cd5e8a0
Commit
2cd5e8a0
authored
Dec 29, 2023
by
Wei Shoulin
Browse files
retrieve catalog columns
parent
8d848a98
Changes
3
Show whitespace changes
Inline
Side-by-side
csst_dfs_api/facility/level2.py
View file @
2cd5e8a0
...
...
@@ -55,6 +55,17 @@ class Level2DataApi(object):
'''
return
self
.
stub
.
coord_cond_sql
(
**
kwargs
)
def
catalog_columns
(
self
,
**
kwargs
):
''' retrieve columns data type
:param kwargs: Parameter dictionary, key items support:
data_type: [str]
columns: [list], list of str
:returns: csst_dfs_common.models.Result
'''
return
self
.
stub
.
catalog_columns
(
**
kwargs
)
def
find_existed_brick_ids
(
self
,
**
kwargs
):
''' retrieve existed brick_ids in the catalog with data_type
:param kwargs:
...
...
tests/facility/test_facility_level2.py
View file @
2cd5e8a0
...
...
@@ -15,42 +15,50 @@ class Level2DataTestCase(unittest.TestCase):
print
(
'find:'
,
recs
)
def
test_find_existed_brick_ids
(
self
):
recs
=
self
.
api
.
find_existed_brick_ids
(
data_type
=
"csst-msc-l1-
pho
t"
)
recs
=
self
.
api
.
find_existed_brick_ids
(
data_type
=
"csst-msc-l1-
mbi-ca
t"
)
print
(
'find_existed_brick_ids:'
,
recs
)
def
test_catalog_query
(
self
):
result
=
self
.
api
.
catalog_query
(
sql
=
'select x,y,A,B,PA,AB,E from csst_msc_l1_
pho
t'
,
sql
=
'select x,y,A,B,PA,AB,E from csst_msc_l1_
mbi_ca
t'
,
limit
=
2
)
print
(
result
)
if
result
.
success
and
result
[
'totalCount'
]
>
0
:
dt
=
to_fits_table
(
result
)
dt
.
pprint
()
#
def test_
get
(self):
#
re
c
= self.api.
get(id = 1
)
#
print(
'get:', rec
)
def
test_
coord_cond_sql
(
self
):
re
sult
=
self
.
api
.
coord_cond_sql
(
data_type
=
"csst-msc-l1-mbi-cat"
,
ra
=
120
,
dec
=
40
,
radius
=
0.5
)
print
(
result
)
#
def test_
update_proc_status
(self):
#
re
c
= self.api.
update_proc_status(id = 1, status = 4
)
#
print(
'update_proc_status:', rec
)
def
test_
catalog_column
(
self
):
re
sult
=
self
.
api
.
catalog_columns
(
data_type
=
"csst-msc-l1-mbi-cat"
,
columns
=
[
'RA'
,
'DEC'
]
)
print
(
result
)
#
def test_
update_qc2_status
(self):
#
rec = self.api.
update_qc2_status(id = 1, status = 7
)
#
print('
update_qc2_status
:', rec)
def
test_
get
(
self
):
rec
=
self
.
api
.
get
(
id
=
1
)
print
(
'
get
:'
,
rec
)
# def test_write(self):
# rec = self.api.write(
# level1_id= 1,
# module_id = 'MSC',
# data_type = "csst-msc-l1-phot",
# prc_status = 3,
# prc_time = '2021-10-22 11:12:13',
# filename = "CSST_MSC_MS_SCIE_20240821005429_20240821005659_10160000004_12_L1_V01_CAT.fits",
# file_path = "/opt/temp/csst/msc/L2/CSST_MSC_MS_SCIE_20240821005429_20240821005659_10160000004_12_L1_V01_CAT.fits",
# pipeline_id = "P1"
# )
# print('write:', rec)
def
test_update_proc_status
(
self
):
rec
=
self
.
api
.
update_proc_status
(
id
=
1
,
status
=
4
)
print
(
'update_proc_status:'
,
rec
)
def
test_update_qc2_status
(
self
):
rec
=
self
.
api
.
update_qc2_status
(
id
=
1
,
status
=
7
)
print
(
'update_qc2_status:'
,
rec
)
def
test_write
(
self
):
rec
=
self
.
api
.
write
(
level0_id
=
'1016000000412'
,
module_id
=
'MSC'
,
data_type
=
"csst-msc-l1-mbi-cat"
,
prc_status
=
3
,
prc_time
=
'2021-10-22 11:12:13'
,
filename
=
"CSST_MSC_MS_SCIE_20240821023334_20240821023604_10160000011_19_L1_V01_CAT.fits"
,
file_path
=
"/opt/temp/csst/msc/L2/CSST_MSC_MS_SCIE_20240821023334_20240821023604_10160000011_19_L1_V01_CAT.fits"
,
pipeline_id
=
"csst-msc-l1-mbi-cat"
)
print
(
'write:'
,
rec
)
# rec = self.api.write(
# level1_id= 1,
# module_id = 'MSC',
...
...
tests/facility/test_facility_level2type.py
View file @
2cd5e8a0
...
...
@@ -11,35 +11,37 @@ class Level2TypeTestCase(unittest.TestCase):
def
test_find
(
self
):
recs
=
self
.
api
.
find
(
module_id
=
'MSC'
,
data_type
=
'csst-msc-l1-
pho
t'
data_type
=
'csst-msc-l1-
mbi-ca
t'
)
print
(
'find:'
,
recs
)
def
test_get
(
self
):
rec
=
self
.
api
.
get
(
data_type
=
'csst-msc-l1-
pho
t'
)
rec
=
self
.
api
.
get
(
data_type
=
'csst-msc-l1-
mbi-ca
t'
)
print
(
'get:'
,
rec
)
def
test_update_import_status
(
self
):
rec
=
self
.
api
.
update_import_status
(
data_type
=
'csst-msc-l1-
pho
t'
,
status
=
4
)
rec
=
self
.
api
.
update_import_status
(
data_type
=
'csst-msc-l1-
mbi-ca
t'
,
status
=
4
)
print
(
'update_import_status:'
,
rec
)
def
test_write
(
self
):
rec
=
self
.
api
.
write
(
data_type
=
"csst-msc-l1-
pho
t"
,
data_type
=
"csst-msc-l1-
mbi-ca
t"
,
module_id
=
"MSC"
,
key_column
=
"ID"
,
hdu_index
=
1
,
demo_filename
=
"CSST_MSC_MS_SCIE_202408210
05429
_202408210
05659
_101600000
04
_1
2
_L1_V01_CAT.fits"
,
demo_file_path
=
"/Users/wsl/temp/csst/msc/L2/CSST_MSC_MS_SCIE_202408210
05429
_202408210
05659
_101600000
04
_1
2
_L1_V01_CAT.fits"
,
demo_filename
=
"CSST_MSC_MS_SCIE_202408210
23334
_202408210
23604
_101600000
11
_1
9
_L1_V01_CAT.fits"
,
demo_file_path
=
"/Users/wsl/temp/csst/msc/L2/CSST_MSC_MS_SCIE_202408210
23334
_202408210
23604
_101600000
11
_1
9
_L1_V01_CAT.fits"
,
ra_column
=
"RA"
,
dec_column
=
"DEC"
)
rec
=
self
.
api
.
write
(
data_type
=
"csst-msc-xcat"
,
module_id
=
"MSC"
,
key_column
=
"PhotoObjID"
,
hdu_index
=
1
,
demo_filename
=
"MSC_MS_XCAT_BRICK_156958.fits"
,
demo_file_path
=
"/Users/wsl/temp/csst/msc/L2/MSC_MS_XCAT_BRICK_156958.fits"
,
ra_column
=
"RA_r"
,
dec_column
=
"DEC_r"
)
print
(
'write:'
,
rec
)
\ No newline at end of file
print
(
"write :"
,
rec
)
# rec = self.api.write(
# data_type = "csst-msc-xcat",
# module_id = "MSC",
# key_column = "PhotoObjID",
# hdu_index = 1,
# demo_filename = "MSC_MS_XCAT_BRICK_156958.fits",
# demo_file_path = "/Users/wsl/temp/csst/msc/L2/MSC_MS_XCAT_BRICK_156958.fits",
# ra_column = "RA_r",
# dec_column = "DEC_r")
# print('write:', rec)
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment