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
81293ea9
Commit
81293ea9
authored
Oct 23, 2025
by
BO ZHANG
🏀
Browse files
add support for fits: open, getheader, getval, getdata
parent
7a967334
Pipeline
#10805
failed with stage
in 0 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
csst_common/fits.py
0 → 100644
View file @
81293ea9
from
astropy.io
import
fits
from
csst_fs.s3_config
import
load_s3_options
s3_options
=
load_s3_options
()
def
open
(
name
,
**
kwargs
)
->
fits
.
HDUList
:
if
name
.
startswith
(
"s3://"
):
# read FITS file from s3
return
fits
.
open
(
name
,
use_fsspec
=
True
,
fsspec_kwargs
=
s3_options
,
**
kwargs
)
else
:
# read FITS file from local
return
fits
.
open
(
name
,
**
kwargs
)
def
getheader
(
name
,
**
kwargs
)
->
fits
.
HDUList
:
if
name
.
startswith
(
"s3://"
):
# read FITS file from s3
return
fits
.
getheader
(
name
,
use_fsspec
=
True
,
fsspec_kwargs
=
s3_options
,
**
kwargs
)
else
:
# read FITS file from local
return
fits
.
getheader
(
name
,
**
kwargs
)
def
getval
(
name
,
**
kwargs
)
->
fits
.
HDUList
:
if
name
.
startswith
(
"s3://"
):
# read FITS file from s3
return
fits
.
getval
(
name
,
use_fsspec
=
True
,
fsspec_kwargs
=
s3_options
,
**
kwargs
)
else
:
# read FITS file from local
return
fits
.
getval
(
name
,
**
kwargs
)
def
getdata
(
name
,
**
kwargs
)
->
fits
.
HDUList
:
if
name
.
startswith
(
"s3://"
):
# read FITS file from s3
return
fits
.
getdata
(
name
,
use_fsspec
=
True
,
fsspec_kwargs
=
s3_options
,
**
kwargs
)
else
:
# read FITS file from local
return
fits
.
getdata
(
name
,
**
kwargs
)
csst_common/io.py
View file @
81293ea9
...
...
@@ -21,21 +21,9 @@ from copy import deepcopy
from
typing
import
Optional
from
astropy.io
import
fits
from
csst_fs.s3_config
import
load_s3_options
from
.time
import
now
s3_options
=
load_s3_options
()
def
fits_open
(
name
,
**
kwargs
)
->
fits
.
HDUList
:
if
name
.
startswith
(
"s3://"
):
# read fits file from s3
return
fits
.
open
(
name
,
use_fsspec
=
True
,
fsspec_kwargs
=
s3_options
,
**
kwargs
)
else
:
# read fits file from local
return
fits
.
open
(
name
,
**
kwargs
)
# meta字段和默认值
REQUIRED_KEYS_IN_META
=
dict
(
...
...
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