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-pipeline
csst_common
Commits
631ae616
Commit
631ae616
authored
Nov 20, 2022
by
BO ZHANG
🏀
Browse files
added dm.dfs_l0_query()
parent
986d0a45
Changes
1
Hide whitespace changes
Inline
Side-by-side
csst_common/data_manager.py
View file @
631ae616
...
...
@@ -18,6 +18,7 @@ import os
import
re
from
typing
import
Union
import
numpy
as
np
from
astropy.io
import
fits
from
astropy.table
import
Table
from
csst_dfs_api.msc.calmerge
import
CalMergeApi
...
...
@@ -570,9 +571,20 @@ class CsstMsDataManager:
""" Push SLS spectra to DFS. """
pass
def
dfs_l0_query
(
self
,
obs_id
):
def
dfs_l0_query
(
self
,
obs_id
:
str
=
"100000100"
):
""" Query L0 data from DFS. """
pass
result
=
self
.
dfs_L0DataApi
.
find
(
obs_id
=
str
(
obs_id
))
print
(
f
"
{
result
.
totalCount
}
entries returned from DFS."
)
if
not
result
.
code
==
0
:
raise
ValueError
(
f
"DFS returns non-zero code! (
{
result
.
code
}
)"
)
tbl
=
Table
([
_
.
__dict__
for
_
in
result
.
data
])
tbl
.
sort
([
"detector_no"
,
"obs_type"
])
# Check if all 30 detectors are available
for
detector
in
CP
[
"all"
][
"detectors"
]:
for
obs_type
in
[
"sci"
,
"cosmic_ray"
]:
if
np
.
sum
((
tbl
[
"detector_no"
]
==
f
"
{
detector
:
02
d
}
"
)
&
(
tbl
[
"obs_type"
]
==
obs_type
))
==
0
:
self
.
logger_ppl
.
warning
(
f
"Record not found for detector
{
detector
:
02
d
}
and obs_type
{
obs_type
}
"
)
return
tbl
def
dfs_l1_query
(
self
,
obs_id
,
detector
):
""" Query L1 data from DFS. """
...
...
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