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
b6e173f9
Commit
b6e173f9
authored
Oct 23, 2025
by
BO ZHANG
🏀
Browse files
add support for fits: support s3a://
parent
04092ce1
Pipeline
#10827
passed with stage
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
csst_common/fits.py
View file @
b6e173f9
...
...
@@ -14,9 +14,11 @@ from csst_fs.s3_config import load_s3_options
s3_options
=
load_s3_options
()
s3_prefix
=
(
"s3://"
,
"s3a://"
)
def
open
(
filename
,
**
kwargs
)
->
fits
.
HDUList
:
if
filename
.
startswith
(
"
s3
://"
):
if
filename
.
startswith
(
s3
_prefix
):
# read FITS file from s3
return
fits
.
open
(
filename
,
use_fsspec
=
True
,
fsspec_kwargs
=
s3_options
,
**
kwargs
)
else
:
...
...
@@ -25,7 +27,7 @@ def open(filename, **kwargs) -> fits.HDUList:
def
getheader
(
filename
,
**
kwargs
)
->
fits
.
HDUList
:
if
filename
.
startswith
(
"
s3
://"
):
if
filename
.
startswith
(
s3
_prefix
):
# read FITS file from s3
return
fits
.
getheader
(
filename
,
use_fsspec
=
True
,
fsspec_kwargs
=
s3_options
,
**
kwargs
...
...
@@ -36,7 +38,7 @@ def getheader(filename, **kwargs) -> fits.HDUList:
def
getval
(
filename
,
**
kwargs
)
->
fits
.
HDUList
:
if
filename
.
startswith
(
"
s3
://"
):
if
filename
.
startswith
(
s3
_prefix
):
# read FITS file from s3
return
fits
.
getval
(
filename
,
use_fsspec
=
True
,
fsspec_kwargs
=
s3_options
,
**
kwargs
...
...
@@ -47,7 +49,7 @@ def getval(filename, **kwargs) -> fits.HDUList:
def
getdata
(
filename
,
**
kwargs
)
->
fits
.
HDUList
:
if
filename
.
startswith
(
"
s3
://"
):
if
filename
.
startswith
(
s3
_prefix
):
# read FITS file from s3
return
fits
.
getdata
(
filename
,
use_fsspec
=
True
,
fsspec_kwargs
=
s3_options
,
**
kwargs
...
...
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