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
Hide whitespace changes
Inline
Side-by-side
csst_dfs_api/facility/level2.py
View file @
2cd5e8a0
...
@@ -55,6 +55,17 @@ class Level2DataApi(object):
...
@@ -55,6 +55,17 @@ class Level2DataApi(object):
'''
'''
return
self
.
stub
.
coord_cond_sql
(
**
kwargs
)
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
):
def
find_existed_brick_ids
(
self
,
**
kwargs
):
''' retrieve existed brick_ids in the catalog with data_type
''' retrieve existed brick_ids in the catalog with data_type
:param kwargs:
:param kwargs:
...
...
tests/facility/test_facility_level2.py
View file @
2cd5e8a0
...
@@ -15,42 +15,50 @@ class Level2DataTestCase(unittest.TestCase):
...
@@ -15,42 +15,50 @@ class Level2DataTestCase(unittest.TestCase):
print
(
'find:'
,
recs
)
print
(
'find:'
,
recs
)
def
test_find_existed_brick_ids
(
self
):
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
)
print
(
'find_existed_brick_ids:'
,
recs
)
def
test_catalog_query
(
self
):
def
test_catalog_query
(
self
):
result
=
self
.
api
.
catalog_query
(
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
)
limit
=
2
)
print
(
result
)
print
(
result
)
if
result
.
success
and
result
[
'totalCount'
]
>
0
:
if
result
.
success
and
result
[
'totalCount'
]
>
0
:
dt
=
to_fits_table
(
result
)
dt
=
to_fits_table
(
result
)
dt
.
pprint
()
dt
.
pprint
()
# def test_get(self):
def
test_coord_cond_sql
(
self
):
# rec = self.api.get(id = 1)
result
=
self
.
api
.
coord_cond_sql
(
data_type
=
"csst-msc-l1-mbi-cat"
,
ra
=
120
,
dec
=
40
,
radius
=
0.5
)
# print('get:', rec)
print
(
result
)
def
test_catalog_column
(
self
):
result
=
self
.
api
.
catalog_columns
(
data_type
=
"csst-msc-l1-mbi-cat"
,
columns
=
[
'RA'
,
'DEC'
])
print
(
result
)
def
test_get
(
self
):
rec
=
self
.
api
.
get
(
id
=
1
)
print
(
'get:'
,
rec
)
#
def test_update_proc_status(self):
def
test_update_proc_status
(
self
):
#
rec = self.api.update_proc_status(id = 1, status = 4)
rec
=
self
.
api
.
update_proc_status
(
id
=
1
,
status
=
4
)
#
print('update_proc_status:', rec)
print
(
'update_proc_status:'
,
rec
)
#
def test_update_qc2_status(self):
def
test_update_qc2_status
(
self
):
#
rec = self.api.update_qc2_status(id = 1, status = 7)
rec
=
self
.
api
.
update_qc2_status
(
id
=
1
,
status
=
7
)
#
print('update_qc2_status:', rec)
print
(
'update_qc2_status:'
,
rec
)
#
def test_write(self):
def
test_write
(
self
):
#
rec = self.api.write(
rec
=
self
.
api
.
write
(
#
level
1
_id=
1
,
level
0
_id
=
'1016000000412'
,
#
module_id = 'MSC',
module_id
=
'MSC'
,
#
data_type = "csst-msc-l1-
pho
t",
data_type
=
"csst-msc-l1-
mbi-ca
t"
,
#
prc_status = 3,
prc_status
=
3
,
#
prc_time = '2021-10-22 11:12:13',
prc_time
=
'2021-10-22 11:12:13'
,
#
filename = "CSST_MSC_MS_SCIE_202408210
05429
_202408210
05659
_101600000
04
_1
2
_L1_V01_CAT.fits",
filename
=
"CSST_MSC_MS_SCIE_202408210
23334
_202408210
23604
_101600000
11
_1
9
_L1_V01_CAT.fits"
,
#
file_path = "/opt/temp/csst/msc/L2/CSST_MSC_MS_SCIE_202408210
05429
_202408210
05659
_101600000
04
_1
2
_L1_V01_CAT.fits",
file_path
=
"/opt/temp/csst/msc/L2/CSST_MSC_MS_SCIE_202408210
23334
_202408210
23604
_101600000
11
_1
9
_L1_V01_CAT.fits"
,
#
pipeline_id = "
P1
"
pipeline_id
=
"
csst-msc-l1-mbi-cat
"
#
)
)
#
print('write:', rec)
print
(
'write:'
,
rec
)
# rec = self.api.write(
# rec = self.api.write(
# level1_id= 1,
# level1_id= 1,
# module_id = 'MSC',
# module_id = 'MSC',
...
...
tests/facility/test_facility_level2type.py
View file @
2cd5e8a0
...
@@ -11,35 +11,37 @@ class Level2TypeTestCase(unittest.TestCase):
...
@@ -11,35 +11,37 @@ class Level2TypeTestCase(unittest.TestCase):
def
test_find
(
self
):
def
test_find
(
self
):
recs
=
self
.
api
.
find
(
recs
=
self
.
api
.
find
(
module_id
=
'MSC'
,
module_id
=
'MSC'
,
data_type
=
'csst-msc-l1-
pho
t'
data_type
=
'csst-msc-l1-
mbi-ca
t'
)
)
print
(
'find:'
,
recs
)
print
(
'find:'
,
recs
)
def
test_get
(
self
):
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
)
print
(
'get:'
,
rec
)
def
test_update_import_status
(
self
):
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
)
print
(
'update_import_status:'
,
rec
)
def
test_write
(
self
):
def
test_write
(
self
):
rec
=
self
.
api
.
write
(
rec
=
self
.
api
.
write
(
data_type
=
"csst-msc-l1-
pho
t"
,
data_type
=
"csst-msc-l1-
mbi-ca
t"
,
module_id
=
"MSC"
,
module_id
=
"MSC"
,
key_column
=
"ID"
,
key_column
=
"ID"
,
hdu_index
=
1
,
hdu_index
=
1
,
demo_filename
=
"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
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
23334
_202408210
23604
_101600000
11
_1
9
_L1_V01_CAT.fits"
,
ra_column
=
"RA"
,
ra_column
=
"RA"
,
dec_column
=
"DEC"
)
dec_column
=
"DEC"
)
rec
=
self
.
api
.
write
(
print
(
"write :"
,
rec
)
data_type
=
"csst-msc-xcat"
,
module_id
=
"MSC"
,
# rec = self.api.write(
key_column
=
"PhotoObjID"
,
# data_type = "csst-msc-xcat",
hdu_index
=
1
,
# module_id = "MSC",
demo_filename
=
"MSC_MS_XCAT_BRICK_156958.fits"
,
# key_column = "PhotoObjID",
demo_file_path
=
"/Users/wsl/temp/csst/msc/L2/MSC_MS_XCAT_BRICK_156958.fits"
,
# hdu_index = 1,
ra_column
=
"RA_r"
,
# demo_filename = "MSC_MS_XCAT_BRICK_156958.fits",
dec_column
=
"DEC_r"
)
# demo_file_path = "/Users/wsl/temp/csst/msc/L2/MSC_MS_XCAT_BRICK_156958.fits",
print
(
'write:'
,
rec
)
# ra_column = "RA_r",
\ No newline at end of file
# 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