Small-Bodies-Node / pds4_tools

Python package to read and display NASA PDS4 data.
16 stars 12 forks source link

Feature request: Support image coordinates from EBT dictionary #89

Open mkelley opened 8 months ago

mkelley commented 8 months ago

The Earth Based Telescope dictionary, e.g., https://pds.nasa.gov/datastandards/dictionaries/index-1.20.0.0.shtml#ebt , contains classes to convert pixels to sky coordinates. Can pds4_tools support <ebt:World_Coordinate_System>? Especially useful for data reviews would be the ability to mouse over an image and see the sky coordinate values in real-time (much like the DS9 tool does with FITS files). We can discuss ways to address this, e.g., with a new external library or by adding something to this package specifically. Regardless, we definitely want a solution that this package can use.

jordanpadams commented 8 months ago

@mkelley pds4_tools is definitely an ideal spot for this to use the PDS4 IM, but would this also possibly be a use case for the pyWWT? You could try submitting a new feature request here: https://github.com/WorldWideTelescope/pywwt

mkelley commented 8 months ago

Getting data into WWT should be easy. Adding an image layer can be done with an array and an astropy WCS object. What we need is to develop a way to read PDS4 labels into astropy WCS objects. That's a pretty general problem, and one I'd also like to use outside of pywwt. This leads me to one of my main questions. The requirements for pds4_tools are very minimal, and we've kept it that way on purpose. I'm sure we can write all the WCS code that we need using just numpy, but the WCS transformations we need are already developed and well tested in astropy. Would an optional dependency be appropriate here?

jordanpadams commented 8 months ago

@mkelley roger that. It may even be the other way around where we can call pds4_tools from within a more specific app.

As a note, we have a Jupyter Notebook that does use pds4_tools to read in table data and then adds magnetometer data as a layer onto the Solar System 3D view. This obviously has a lot of steps that would not be needed for the task you are requesting, but it does contain an example of finding data products, and then reading the tables using pds4_tools. @tloubrieu-jpl may also have some more insight into how we could accomplish what you are talking about.

LevN0 commented 1 month ago

@mkelley

This might be feasible, but given my complete lack of familiarity with either that dictionary or WCS, and very part time nature, would need to see a complete but minimal example of reading a label, extracting necessary meta data from that dictionary, reading the data file, and then using the meta data to transform at least one point in the label into the sky coordinates you desire. Data and label used for this should be included.

The example can use any package for the transformation, but if you know of a light weight package (e.g. not astropy) that would be more ideal. In the perfect scenario we'd write or vendor the coordinate transform library as a single file, if that were feasible. Failing that, if the transformations we need to accommodate require a heavy weight library, that might still be possible as an optional dependency and we could see about baking it into the binary release.

mkelley commented 1 month ago

We will get someone to prototype or code this up. The transformations can be complex and coding them up from scratch is a major undertaking, so I prefer to address this through optional dependencies.