Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API endpoint that describes FITS to JP2 processing. #246

Open
wafels opened this issue Jan 19, 2023 · 3 comments
Open

API endpoint that describes FITS to JP2 processing. #246

wafels opened this issue Jan 19, 2023 · 3 comments
Assignees

Comments

@wafels
Copy link
Contributor

wafels commented Jan 19, 2023

Over in SunPy, issues sunpy/sunpy#6715 (and sunpy/sunpy#6709) deal with the conversion of JP2 image values - scaled in the range 0 to 255 - back to the original FITS values. Due to the processing done to derive a JP2 image from a prepped FITS file, reversing the process will lead to an approximation of the prepped FITS file at best.

This API endpoint would allow a user to get information about the processing steps used to convert a FITS file to a JP2 file. It would then be up to the user to take the processing information and write a function that inverts the FITS to JP2 processing to produce an approximate prepped FITS file. This API endpoint should also be included in https://github.com/Helioviewer-Project/python-api .

@dgarciabriseno
Copy link
Contributor

dgarciabriseno commented Feb 9, 2023

Can we discuss this further? I'm not sure what you want the API to return.
Information on how to process the FITS file doesn't sound "machine readable" to me.
If we want to describe the process for processing fits files, that sounds like something that can be written up on the blog.

Unless you're talking about returning the specific parameters used during the FITS. Meaning for example based on this quote:

The actual physical unit colour limits of these images are hardcoded in the hv jp2gen files e.g. for hmi has a min of 0=-250 and 255 = +250.

If we want to return 0 => -250 and 255 => +250, then that is machine readable information that we could return.

@dgarciabriseno
Copy link
Contributor

I read the sunpy issue and I understand what this is asking for.

We want a way to get the parameters used to scale down the data values from FITS into jp2. i.e. if the scaling is linear/logarithmic/other, and the parameters passed to the scaling function.

As @wafels mentioned in the other issue, some of this info is in jp2gen, but other info is upstream. I'll try to gather more info.

@wafels
Copy link
Contributor Author

wafels commented Sep 13, 2023

JP2Gen uses the instrument software processing pipeline to do the initial preparation of the data. To recover an approximation of the original FITS file then that pipeline would also have to be reversed. This is not possible in general. However, it should be possible to design an API endpoint that allows you to reverse the prepped data to JPEG2000 step.

In general, the scaling details are kept in JP2Gen HVS files, for example https://github.com/Helioviewer-Project/jp2gen/blob/master/idl/sdo/aia/hvs_version6_aia.pro .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants