Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ssp-software
data-access-tools
Commits
d9ed72ef
Commit
d9ed72ef
authored
Jun 21, 2022
by
michitaro
Browse files
tarエラー修正
parent
cc9416b2
Changes
1
Hide whitespace changes
Inline
Side-by-side
pdr3/colorPostage/colorPostage.py
View file @
d9ed72ef
...
...
@@ -25,9 +25,9 @@ import os, os.path
import
contextlib
import
logging
;
logging
.
basicConfig
(
level
=
logging
.
INFO
)
try
:
import
pyfits
import
pyfits
# type: ignore
except
:
import
astropy.io.fits
as
pyfits
import
astropy.io.fits
as
pyfits
# type: ignore
import
numpy
import
PIL.Image
...
...
@@ -43,7 +43,7 @@ def main():
parser
.
add_argument
(
'input'
,
type
=
argparse
.
FileType
(
'r'
))
args
=
parser
.
parse_args
()
password
=
getpass
.
getpass
(
'Password for public-release: '
)
password
=
os
.
environ
.
get
(
'HSC_PASSWORD'
)
or
getpass
.
getpass
(
'Password for public-release: '
)
checkPassword
(
args
.
user
,
password
)
coords
,
outs
=
loadCoords
(
args
.
input
)
...
...
@@ -67,7 +67,7 @@ API = 'https://hsc-release.mtk.nao.ac.jp/das_cutout/pdr3/cgi-bin/cutout'
def
loadCoords
(
input
):
import
re
comment
=
re
.
compile
(
'\s*(?:$|#)'
)
comment
=
re
.
compile
(
r
'\s*(?:$|#)'
)
num
=
1
coords
=
[]
outs
=
[]
...
...
@@ -122,7 +122,8 @@ def rgbBundle(files):
dst
=
locals
()[
ch
]
copyFileObj
(
fileObj
,
dst
)
rgb
[
ch
]
=
dst
.
name
yield
objNum
,
rgb
if
len
(
rgb
)
>
0
:
yield
objNum
,
rgb
...
...
@@ -155,7 +156,13 @@ def queryTar(user, password, requestFile):
with
tarfile
.
open
(
fileobj
=
pipe
.
stdout
,
mode
=
'r|*'
)
as
tar
:
while
True
:
info
=
tar
.
next
()
try
:
info
=
tar
.
next
()
except
tarfile
.
StreamError
as
e
:
if
tar
.
offset
==
0
:
break
else
:
raise
if
info
is
None
:
break
logging
.
info
(
'extracting {}...'
.
format
(
info
.
name
))
f
=
tar
.
extractfile
(
info
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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