Closed cdeil closed 7 years ago
@tboch - Can you comment on this PR (or merge it)?
@adl1995 wants to add support / tests for PNG tiles this week, and it's easiest if this PR (or parts of it) go in first.
@adl1995 - Now that this PR is in, you could do #38 (i.e. fully support JPEG read / write, making raw_data
a HipsTile
data member of type BytesIO
) or implement code and tests for PNG tiles.
Note that the current tile I/O tests combine fetch / read / write. Now that we have @requires_hips_extra
I would suggest to use hips-extra
for read / write and all tile tests, and to only have one small test for the fetching using @remote_data
.
I would like to propose this solution to address #42 : suppress the warnings from invalid FITS tiles.
Since this is a "known issue" (or "known feature" if you like) for the FITS tiles from CDS, and every user will get one of these warnings per tile they fetch or read on the console, and there's nothing they can / should do about it except to ignore it, I think it is appropriate to suppress these warnings.
I'm not an expert on Python warnings, but I think / hope that this will have little other effect than suppressing the warnings we want to suppress, and to keep other warnings / errors intact.
@tboch - Assigning to you for review.
@adl1995 - I've also cleaned up the I/O functions a bit to:
with
statements to read / fetch, to avoid leaving open filehandles aroundBytesIO
and then doing the "decoding" in a_from_raw_data
method.elif file_format in {'jpg', 'png'}
, keeping theelse ValueError
part to give a better error message in case a format we don't support appears.