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

Update handling of Infinity / NaN values as special constants when they are not represented as the data type of the parent object. #894

Merged
merged 1 commit into from
May 23, 2024

Conversation

al-niessner
Copy link
Contributor

@al-niessner al-niessner commented May 8, 2024

🗒️ Summary

Add the ability to use inf/nan for special constants. Does not in include #893 nor was any test data given.

⚙️ Test Data and/or Report

Automated unit/regression test below

Given test data size, here is validate after patch:

PDS Validate Tool Report

Configuration:
   Version     3.5.0-SNAPSHOT
   Date        2024-05-13T16:53:16Z

Parameters:
   Targets                      [file:/home/niessner/Projects/PDS/validate/src/test/resources/github844/MDIS_RTM_N01_010599_7521824_1.xml]
   Severity Level               WARNING
   Recurse Directories          true
   File Filters Used            [*.xml, *.XML]
   Data Content Validation      on
   Product Level Validation     on
   Max Errors                   100000
   Registered Contexts File     /home/niessner/Projects/PDS/validate/target/classes/util/registered_context_products.json

Product Level Validation Results

  PASS: file:/home/niessner/Projects/PDS/validate/src/test/resources/github844/MDIS_RTM_N01_010599_7521824_1.xml
        1 product validation(s) completed

Summary:

  1 product(s)
  0 error(s)
  0 warning(s)

  Product Validation Summary:
    1          product(s) passed
    0          product(s) failed
    0          product(s) skipped
    1          product(s) total

  Referential Integrity Check Summary:
    0          check(s) passed
    0          check(s) failed
    0          check(s) skipped
    0          check(s) total


End of Report
Completed execution in 18477 ms

♻️ Related Issues

Closes #844

@jordanpadams jordanpadams changed the title 844: handle inf/nan as special constants Update handling of Infinity / NaN values as special constants when they are not represented as the data type of the parent object. May 23, 2024
@jordanpadams jordanpadams merged commit 6584f46 into main May 23, 2024
3 checks passed
@jordanpadams jordanpadams deleted the issue_844 branch May 23, 2024 22:15
@tbarnes4
Copy link

@al-niessner @jordanpadams What does it mean by "updating the handling of NaN/Inf as special constants"? Can we now declare them as special constants or what?

@jordanpadams
Copy link
Member

jordanpadams commented May 28, 2024

@tbarnes4 we did not do anything other what is supported by the standard. For this particular issue, missing_constant value was -Infinity, which according to the standard, should be fine. There was an issue happening because validate was assuming the value for missing_constant should be the same as the parent object's data type IEEE754LSBSingle, but, per the standard, only some of the special constants specifically require matching of the data type.

        <Array_3D_Image>
            <local_identifier>Array_3D_Image</local_identifier>
            <offset unit="byte">0</offset>
            <axes>3</axes>
            <axis_index_order>Last Index Fastest</axis_index_order>
            <Element_Array>
                <data_type>IEEE754LSBSingle</data_type>
            </Element_Array>
            <Axis_Array>
                <axis_name>Band</axis_name>
                <elements>1</elements>
                <sequence_number>3</sequence_number>
            </Axis_Array>
            <Axis_Array>
                <axis_name>Line</axis_name>
                <elements>6348</elements>
                <sequence_number>1</sequence_number>
            </Axis_Array>
            <Axis_Array>
                <axis_name>Sample</axis_name>
                <elements>1685</elements>
                <sequence_number>2</sequence_number>
            </Axis_Array>
            <Special_Constants>
                <missing_constant>-Infinity</missing_constant>
            </Special_Constants>
        </Array_3D_Image> 

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

Successfully merging this pull request may close these issues.

Exception when trying to handle missing_constant == Infinity
3 participants