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

validate incorrectly handles special constant high_instrument_saturation #831

Closed
rchenatjpl opened this issue Feb 20, 2024 · 1 comment · Fixed by #859
Closed

validate incorrectly handles special constant high_instrument_saturation #831

rchenatjpl opened this issue Feb 20, 2024 · 1 comment · Fixed by #859
Assignees
Labels

Comments

@rchenatjpl
Copy link
Contributor

rchenatjpl commented Feb 20, 2024

Checked for duplicates

No - I haven't checked

🐛 Describe the bug

When I validate the attached, validate correctly flags values that match missing_constant, high_representation_saturation, valid_minimum, low_instrument_saturation, low_representation_saturation but misses a value that matches high_instrument_saturation and instead flags that value as being below valid_minimum (which is true, but so are the other values).

🕵️ Expected behavior

I expected the three values for which validate threw WARNINGs about below minimum to be INFOs about matching a special constant

📜 To Reproduce

% ./validate-3.5.0-SNAPSHOT/bin/validate -v1 -t kplo.xml
PDS Validate Tool Report
Configuration:
   Version     3.5.0-SNAPSHOT
   Date        2024-02-20T21:01:33Z
Parameters:
   Targets                      [file:/Users/rchen/Desktop/kplo.xml]
   Severity Level               INFO
   Recurse Directories          true
   File Filters Used            [*.xml, *.XML]
   Data Content Validation      on
   Product Level Validation     on
   Max Errors                   100000
   Registered Contexts File     /Users/rchen/Desktop/validate-3.5.0-SNAPSHOT/resources/registered_context_products.json
Product Level Validation Results
  PASS: file:/Users/rchen/Desktop/kplo.xml
      INFO  [info.label.filesize_matches]   Generated filesize '513' matches the supplied filesize '513' in the product label for 'file:/Users/rchen/Desktop/kplo.cub'
      INFO  [info.label.context_ref_found]   line 50: Context product found: 'urn:kari:kpds:context:investigation:mission.kplo'
      INFO  [info.label.context_ref_found]   line 60: Context product found: 'urn:kari:kpds:context:instrument_host:spacecraft.kplo'
      INFO  [info.label.context_ref_found]   line 68: Context product found: 'urn:kari:kpds:context:instrument:kplo.shc'
      INFO  [info.label.context_ref_found]   line 77: Context product found: 'urn:nasa:pds:context:target:planet.earth'
      INFO  [info.label.context_ref_found]   line 85: Context product found: 'urn:nasa:pds:context:target:satellite.earth.moon'
      INFO  [info.label.local_identifier_found]   line 94: Referenced Local Identifier 'DATA_FILE' found in label on line '119'.
      INFO  [info.label.local_identifier_found]   line 104: Referenced Local Identifier 'Array_2D_Image' found in label on line '126'.
    Begin Content Validation: file:/Users/rchen/Desktop/kplo.cub
      WARNING  [warning.array.value_out_of_special_constant_min_max_range]   array 1, location (7, 1): Field has a value '-3.4028233E38' that is less than the defined minimum value '0xFF7FFFFA'. 
      INFO  [info.array.is_special_constant]   array 1, location (7, 2): Value is a special constant defined in the label: -3.4028225E38
      INFO  [info.array.is_special_constant]   array 1, location (7, 3): Value is a special constant defined in the label: -3.4028227E38
      INFO  [info.array.is_special_constant]   array 1, location (7, 4): Value is a special constant defined in the label: -3.4028229E38
      INFO  [info.array.is_special_constant]   array 1, location (7, 5): Value is a special constant defined in the label: -3.402823E38
      WARNING  [warning.array.value_out_of_special_constant_min_max_range]   array 1, location (7, 6): Field has a value '-3.4028233E38' that is less than the defined minimum value '0xFF7FFFFA'. 
      INFO  [info.array.is_special_constant]   array 1, location (7, 7): Value is a special constant defined in the label: -3.4028235E38
      WARNING  [warning.array.value_out_of_special_constant_min_max_range]   array 1, location (7, 8): Field has a value '-3.4028233E38' that is less than the defined minimum value '0xFF7FFFFA'. 
    End Content Validation: file:/Users/rchen/Desktop/kplo.cub
        1 product validation(s) completed
Summary:
  1 product(s)
  0 error(s)
  3 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
  Message Types:
    5            info.array.is_special_constant
    5            info.label.context_ref_found
    1            info.label.filesize_matches
    2            info.label.local_identifier_found
    3            warning.array.value_out_of_special_constant_min_max_range
End of Report
Completed execution in 2297 ms

📚 Version of Software Used

Both 3.5.0-SNAPSHOT on 2024-02-20T21:01:33Z and 3.4.1 on 2024-02-20T20:53:17Z do this

🩺 Test Data / Additional context

Here's the relevant section of a hex dump of the attached file kplo.cub:
000000c0: feff 7fff faff 7fff fbff 7fff fcff 7fff ................
000000d0: fdff 7fff feff 7fff ffff 7fff feff 7fff ................

Note that because it's LSB, the ordering is backwards from what the xml has, which is:

        <high_instrument_saturation>0xFF7FFFFE</high_instrument_saturation>
        <high_representation_saturation>0xFF7FFFFF</high_representation_saturation>
        <valid_minimum>0xFF7FFFFA</valid_minimum>
        <low_instrument_saturation>0xFF7FFFFD</low_instrument_saturation>
        <low_representation_saturation>0xFF7FFFFC</low_representation_saturation>

Ideally, all 8 values in kplo.cub would throw INFOs. It would also be logically consistent if 7 of them threw WARNINGs. The actual result is odd, that only the 3 floats matching high_instrument_saturation throw a WARNING.

kplo.zip

🦄 Related requirements

🦄 #xyz

⚙️ Engineering Details

No response

@al-niessner
Copy link
Contributor

Fixed. Looking at the constant for an E as in 1E32 to determine it is a float. Updated check to ignore E when starts with 0x.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: 🏁 Done
3 participants