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

Support reading CF8 CPHDs with an AmpSF PVP #474

Open
pressler-vsc opened this issue Oct 27, 2023 · 1 comment
Open

Support reading CF8 CPHDs with an AmpSF PVP #474

pressler-vsc opened this issue Oct 27, 2023 · 1 comment
Labels
in integration merged into integration branch

Comments

@pressler-vsc
Copy link
Collaborator

SarPy's CPHD reader currently errors out when attempting to open a CF8-valued CPHD that contains an AmpSF PVP:

>>> import sarpy.io.phase_history.converter
>>> sarpy.io.phase_history.converter.open_phase_history('/data/cf8_with_ampsf.cphd')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/vscuser/git/glweb/software/third-party/sarpy/sarpy/io/phase_history/converter.py", line 79, in open_phase_history
    reader = opener(file_name)
             ^^^^^^^^^^^^^^^^^
  File "/home/vscuser/git/glweb/software/third-party/sarpy/sarpy/io/phase_history/cphd.py", line 1011, in is_a
    return CPHDReader(cphd_details)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vscuser/git/glweb/software/third-party/sarpy/sarpy/io/phase_history/cphd.py", line 519, in __init__
    data_segments = self._create_data_segments()
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vscuser/git/glweb/software/third-party/sarpy/sarpy/io/phase_history/cphd.py", line 564, in _create_data_segments
    format_function = AmpScalingFunction(raw_dtype, amplitude_scaling=amp_sf)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vscuser/git/glweb/software/third-party/sarpy/sarpy/io/phase_history/cphd.py", line 78, in __init__
    self.set_amplitude_scaling(amplitude_scaling)
  File "/home/vscuser/git/glweb/software/third-party/sarpy/sarpy/io/phase_history/cphd.py", line 126, in set_amplitude_scaling
    raise ValueError(
ValueError: A scaling multiplier has been supplied,
        but the raw datatype is not `int8` or `int16`.

This documented limitation is not a limitation of the CPHD spec (e.g. from NGA.STND.0068-1_1.1.0_CPHD, pg. 25):

image

SarPy should support reading these CPHDs.

@eleehiga
Copy link

I as well would please want SarPy to support this

@pressler-vsc pressler-vsc added the in integration merged into integration branch label Nov 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in integration merged into integration branch
Projects
None yet
Development

No branches or pull requests

2 participants