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

Fix offset calculation bug handling multiple file areas #756

Merged
merged 7 commits into from
Nov 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,13 @@ public void validate() throws MalformedURLException, URISyntaxException {
EveryNCounter.getInstance().increment();
List<DataObject> offsetSorted = new ArrayList<DataObject>(label.getObjects());
for (int idx = 1 ; idx < offsetSorted.size() ; idx++) {
if (0 < comparator.compare (offsetSorted.get(idx-1), offsetSorted.get(idx))) {
getListener().addProblem(new ValidationProblem(
new ProblemDefinition(ExceptionType.WARNING, ProblemType.DATA_OBJECTS_OUT_OF_ORDER,
"Data Objects out of offset order"),
getTarget(), objectCounter, -1));
if (offsetSorted.get(idx-1).getDataFile().equals (offsetSorted.get(idx).getDataFile())) {
if (0 < comparator.compare (offsetSorted.get(idx-1), offsetSorted.get(idx))) {
getListener().addProblem(new ValidationProblem(
new ProblemDefinition(ExceptionType.WARNING, ProblemType.DATA_OBJECTS_OUT_OF_ORDER,
"Data Objects out of offset order"),
getTarget(), objectCounter, -1));
}
}
}
Collections.sort(offsetSorted, comparator);
Expand Down
29 changes: 5 additions & 24 deletions src/test/resources/features/developer.feature
Original file line number Diff line number Diff line change
Expand Up @@ -9,37 +9,18 @@ Scenario Outline: Execute validate command for tests below.
Examples:
| testName | testDir | messageCount | messageText | problemEnum | resourceDir | reportDir | commandArgs | refOutputValue |

# Validate#693
|"NASA-PDS/validate#693 Invalid PDF/A Checks" | "github693" | 4 | "4 errors expected" | "NON_PDFA_FILE" | "src/test/resources" | "target/test" | "-r {reportDir}/report_github693.json -s json -t {resourceDir}/github693/" | "report_github693.json" |








# Validate#754
|"NASA-PDS/validate#754 Success differentiating file area offsets" | "github754" | 0 | "1 warnings expected" | "DATA_OBJECTS_OUT_OF_ORDER" | "src/test/resources" | "target/test" | "-r {reportDir}/report_github754.json -s json --skip-context-validation -t {resourceDir}/github754/Cassini_ISS_CB2_Jupiter_global_map_2.xml" | "report_github754.json" |

# Validate#693
|"NASA-PDS/validate#693 Invalid PDF/A Checks" | "github693" | 4 | "4 errors expected" | "NON_PDFA_FILE" | "src/test/resources" | "target/test" | "-r {reportDir}/report_github693.json -s json -t {resourceDir}/github693/" | "report_github693.json" |

# Validate#690
|"NASA-PDS/validate#690 Success new constant expression" | "github690" | 0 | "0 errors expected" | "totalErrors" | "src/test/resources" | "target/test" | "-r {reportDir}/report_github690.json -s json --skip-context-validation -t {resourceDir}/github690/rs_20160518_014000_udsc64_l3_e_v10.xml" | "report_github690.json" |
|"NASA-PDS/validate#690 Success new constant expression" | "github690" | 0 | "0 errors expected" | "totalErrors" | "src/test/resources" | "target/test" | "-r {reportDir}/report_github690.json -s json --skip-context-validation -t {resourceDir}/github690/rs_20160518_014000_udsc64_l3_e_v10.xml" | "report_github690.json" |

# Validate#681
|"NASA-PDS/validate#681 Success and Failure of ASCII table with space in number" | "github681" | 1 | "1 errors expected" | "FIELD_VALUE_FORMAT_PRECISION_MISMATCH" | "src/test/resources" | "target/test" | "-r {reportDir}/report_github681.json -s json --skip-context-validation -t {resourceDir}/github681/ff_char.xml {resourceDir}/github681/ff_del.xml" | "report_github681.json" |














# Validate#680
|"NASA-PDS/validate#680 Success char table correct length" | "github680" | 0 | "0 errors expected" | "totalErrors" | "src/test/resources" | "target/test" | "-r {reportDir}/report_github680.1.json -s json --skip-context-validation -t {resourceDir}/github680/ORB12_EUR_EPHIO_reclen96.xml" | "report_github680.1.json" |
|"NASA-PDS/validate#680 Failure char table bad length" | "github680" | 1 | "1 errors expected" | "RECORD_LENGTH_MISMATCH" | "src/test/resources" | "target/test" | "-r {reportDir}/report_github680.2.json -s json --skip-context-validation -t {resourceDir}/github680/ORB12_EUR_EPHIO_reclen95.xml" | "report_github680.2.json" |
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,201 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="https://pds.nasa.gov/pds4/pds/v1/PDS4_PDS_1F00.sch" schematypens="http://purl.oclc.org/dsdl/schematron"?>
<?xml-model href="https://pds.nasa.gov/pds4/disp/v1/PDS4_DISP_1F00_1500.sch" schematypens="http://purl.oclc.org/dsdl/schematron"?>
<?xml-model href="https://pds.nasa.gov/pds4/cart/v1/PDS4_CART_1F00_1950.sch" schematypens="http://purl.oclc.org/dsdl/schematron"?>
<?xml-model href="https://pds.nasa.gov/pds4/mission/cassini/v1/PDS4_CASSINI_1D00_1500.sch" schematypens="http://purl.oclc.org/dsdl/schematron"?>
<Product_Observational xmlns="http://pds.nasa.gov/pds4/pds/v1"
xmlns:pds="http://pds.nasa.gov/pds4/pds/v1"
xmlns:disp="http://pds.nasa.gov/pds4/disp/v1"
xmlns:cart="http://pds.nasa.gov/pds4/cart/v1"
xmlns:cassini="http://pds.nasa.gov/pds4/mission/cassini/v1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://pds.nasa.gov/pds4/pds/v1 https://pds.nasa.gov/pds4/pds/v1/PDS4_PDS_1F00.xsd
http://pds.nasa.gov/pds4/disp/v1 https://pds.nasa.gov/pds4/disp/v1/PDS4_DISP_1F00_1500.xsd
http://pds.nasa.gov/pds4/cart/v1 https://pds.nasa.gov/pds4/cart/v1/PDS4_CART_1F00_1950.xsd">
<Identification_Area>
<logical_identifier>urn:nasa:pds:co_iss_global-maps:data_derived:cassini_iss_cb2_jupiter_global_map_2</logical_identifier>
<version_id>1.0</version_id>
<title>Cassini ISS CB2 Jupiter Global Map 2</title>
<information_model_version>1.15.0.0</information_model_version>
<product_class>Product_Observational</product_class>
<Modification_History>
<Modification_Detail>
<modification_date>2023-05-08</modification_date>
<version_id>1.0</version_id>
<description>Initial Template Creation</description>
</Modification_Detail>
<Modification_Detail>
<modification_date>2023-11-01</modification_date>
<version_id>1.0</version_id>
<description>Corrections/Edits from Lien Resolution</description>
</Modification_Detail>
</Modification_History>
</Identification_Area>
<Observation_Area>
<Time_Coordinates>
<start_date_time>2000-12-07T12:49:45.907Z</start_date_time>
<stop_date_time>2000-12-07T22:58:31.634Z</stop_date_time>
</Time_Coordinates>
<Primary_Result_Summary>
<purpose>Science</purpose>
<processing_level>Derived</processing_level>
<Science_Facets>
<wavelength_range>Visible</wavelength_range>
<domain>Atmosphere</domain>
<discipline_name>Atmospheres</discipline_name>
<facet1>Structure</facet1>
</Science_Facets>
</Primary_Result_Summary>
<Investigation_Area>
<name>Cassini-Huygens</name>
<type>Mission</type>
<Internal_Reference>
<lid_reference>urn:nasa:pds:context:investigation:mission.cassini-huygens</lid_reference>
<reference_type>data_to_investigation</reference_type>
</Internal_Reference>
</Investigation_Area>
<Observing_System>
<name>Cassini</name>
<Observing_System_Component>
<name>Cassini</name>
<type>Host</type>
<Internal_Reference>
<lid_reference>urn:nasa:pds:context:instrument_host:spacecraft.co</lid_reference>
<reference_type>is_instrument_host</reference_type>
</Internal_Reference>
</Observing_System_Component>
<Observing_System_Component>
<name>Imaging Science Subsystem - Narrow Angle for CO</name>
<type>Instrument</type>
<Internal_Reference>
<lid_reference>urn:nasa:pds:context:instrument:issna.co</lid_reference>
<reference_type>is_instrument_host</reference_type>
</Internal_Reference>
</Observing_System_Component>
</Observing_System>
<Target_Identification>
<name>Jupiter</name>
<type>Planet</type>
<Internal_Reference>
<lid_reference>urn:nasa:pds:context:target:planet.jupiter</lid_reference>
<reference_type>data_to_target</reference_type>
</Internal_Reference>
</Target_Identification>
<Discipline_Area>
<cart:Cartography>
<Local_Internal_Reference>
<local_identifier_reference>data_map</local_identifier_reference>
<local_reference_type>cartography_parameters_to_image_object</local_reference_type>
</Local_Internal_Reference>
<cart:Spatial_Domain>
<cart:Bounding_Coordinates>
<cart:west_bounding_coordinate unit="deg">360</cart:west_bounding_coordinate>
<cart:east_bounding_coordinate unit="deg">0</cart:east_bounding_coordinate>
<cart:north_bounding_coordinate unit="deg">90</cart:north_bounding_coordinate>
<cart:south_bounding_coordinate unit="deg">-90</cart:south_bounding_coordinate>
</cart:Bounding_Coordinates>
</cart:Spatial_Domain>
<cart:Spatial_Reference_Information>
<cart:Horizontal_Coordinate_System_Definition>
<cart:Planar>
<cart:Map_Projection>
<cart:map_projection_name>Equirectangular</cart:map_projection_name>
<cart:Equirectangular>
<cart:latitude_of_projection_origin unit="deg">0.0</cart:latitude_of_projection_origin>
<cart:standard_parallel_1 unit="deg">0.0</cart:standard_parallel_1>
<cart:longitude_of_central_meridian unit="deg">180.0</cart:longitude_of_central_meridian>
</cart:Equirectangular>
</cart:Map_Projection>
<cart:Planar_Coordinate_Information>
<cart:planar_coordinate_encoding_method>Row and Column</cart:planar_coordinate_encoding_method>
<cart:Coordinate_Representation>
<cart:pixel_resolution_x unit="km/pixel">139</cart:pixel_resolution_x>
<cart:pixel_resolution_y unit="km/pixel">139</cart:pixel_resolution_y>
<cart:pixel_scale_x unit="pixel/deg">0.1</cart:pixel_scale_x>
<cart:pixel_scale_y unit="pixel/deg">0.1</cart:pixel_scale_y>
</cart:Coordinate_Representation>
</cart:Planar_Coordinate_Information>
<cart:Geo_Transformation>
<cart:upperleft_corner_x unit="m">0.0</cart:upperleft_corner_x>
<cart:upperleft_corner_y unit="m">90.0</cart:upperleft_corner_y>
</cart:Geo_Transformation>
</cart:Planar>
<cart:Geodetic_Model>
<cart:latitude_type>Planetocentric</cart:latitude_type>
<cart:a_axis_radius unit="km">71492</cart:a_axis_radius>
<cart:b_axis_radius unit="km">71492</cart:b_axis_radius>
<cart:c_axis_radius unit="km">66854</cart:c_axis_radius>
<cart:longitude_direction>Positive West</cart:longitude_direction>
</cart:Geodetic_Model>
</cart:Horizontal_Coordinate_System_Definition>
</cart:Spatial_Reference_Information>
</cart:Cartography>
<disp:Display_Settings>
<Local_Internal_Reference>
<local_identifier_reference>data_map</local_identifier_reference>
<local_reference_type>display_settings_to_array</local_reference_type>
</Local_Internal_Reference>
<disp:Display_Direction>
<disp:comment>
These settings apply to all images (Array_2D_Image) in the label.
</disp:comment>
<disp:horizontal_display_axis>Sample</disp:horizontal_display_axis>
<disp:horizontal_display_direction>Left to Right</disp:horizontal_display_direction>
<disp:vertical_display_axis>Line</disp:vertical_display_axis>
<disp:vertical_display_direction>Bottom to Top</disp:vertical_display_direction>
</disp:Display_Direction>
</disp:Display_Settings>
</Discipline_Area>
</Observation_Area>
<File_Area_Observational>
<File>
<file_name>Cassini_ISS_CB2_Jupiter_global_map_2.fits</file_name>
<local_identifier>file</local_identifier>
<creation_date_time>2023-05-08T16:57:55Z</creation_date_time>
</File>
<Header>
<local_identifier>header_map</local_identifier>
<offset unit="byte">0</offset>
<object_length unit="byte">2880</object_length>
<parsing_standard_id>FITS 3.0</parsing_standard_id>
</Header>
<Array_2D_Image>
<local_identifier>data_map</local_identifier>
<offset unit="byte">2880</offset>
<axes>2</axes>
<axis_index_order>Last Index Fastest</axis_index_order>
<description>Global map, single filter</description>
<Element_Array>
<data_type>IEEE754MSBSingle</data_type>
</Element_Array>
<Axis_Array>
<axis_name>Line</axis_name>
<elements>3601</elements>
<sequence_number>1</sequence_number>
</Axis_Array><Axis_Array>
<axis_name>Sample</axis_name>
<elements>1801</elements>
<sequence_number>2</sequence_number>
</Axis_Array>
<Special_Constants>
<invalid_constant>-999.9</invalid_constant>
</Special_Constants>
</Array_2D_Image>
</File_Area_Observational>
<File_Area_Observational_Supplemental>
<File>
<file_name>Image_Information/Jupiter_ISS_CB2_global_map_2_inf.txt</file_name>
<local_identifier>geom</local_identifier>
<file_size unit="byte">2139</file_size>
<comment>List of images and geometry used in this product.</comment>
</File>
<Stream_Text>
<local_identifier>text-file-2</local_identifier>
<offset unit="byte">0</offset>
<object_length unit="byte">2139</object_length>
<parsing_standard_id>7-Bit ASCII Text</parsing_standard_id>
<description>Supplemental text listing parameters</description>
<record_delimiter>Carriage-Return Line-Feed</record_delimiter>
</Stream_Text>
</File_Area_Observational_Supplemental>
</Product_Observational>
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name time img_size fil_1 fil_2 resolution sub_solar_lat sub_craft_lat phs_angle east_lon west_lon north_lat south_lat
(Northern Hemisphere)
N1354885270_1.IMG 2000-342T12:49:45.907 1024 CL1 CB2 141.02454 2.9427669 3.5756464 7.1887787 106.30121 101.02701 90 -25.478673
N1354891152_1.IMG 2000-342T14:27:47.866 1024 CL1 CB2 140.67944 2.9426559 3.5743239 7.126625 165.49932 160.22252 90 -19.01875
N1354897034_1.IMG 2000-342T16:05:49.825 1024 CL1 CB2 140.33449 2.9425449 3.5729898 7.0641411 229.97657 224.6971 90 -18.659721
N1354902916_1.IMG 2000-342T17:43:51.784 1024 CL1 CB2 139.9897 2.9424339 3.571644 7.001325 283.89455 278.61237 90 -24.402206
N1354908798_1.IMG 2000-342T19:21:53.744 1024 CL1 CB2 139.64507 2.9423228 3.5702863 6.9381745 343.09166 337.80678 90 -24.04337
N1354914680_1.IMG 2000-342T20:59:55.703 1024 CL1 CB2 139.3006 2.9422117 3.5689165 6.8746873 42.288424 37.00081 90 -18.659672
N1354921796_1.IMG 2000-342T22:58:31.634 1024 CL1 CB2 138.88409 2.9420772 3.5672432 6.7974276 119.1945 113.90357 90 -18.659718
(Southern Hemisphere)
N1354885678_1.IMG 2000-342T12:56:33.884 1024 CL1 CB2 141.0006 2.9427592 3.5755551 7.1844783 210.54607 21.468242 19.895275 -85.728138
N1354891560_1.IMG 2000-342T14:34:35.843 1024 CL1 CB2 140.65551 2.9426482 3.5742317 7.1223018 269.74192 80.63786 19.446818 -85.729135
N1354897862_1.IMG 2000-342T16:19:37.800 1024 CL1 CB2 140.28595 2.9425293 3.5728011 7.0553189 321.9985 127.96145 19.718571 -85.730283
N1354903324_1.IMG 2000-342T17:50:39.762 1024 CL1 CB2 139.96579 2.9424262 3.5715502 6.9969556 27.960503 199.00379 19.337844 -85.731351
N1354909206_1.IMG 2000-342T19:28:41.721 1024 CL1 CB2 139.62117 2.9423151 3.5701917 6.9337819 87.326738 258.19997 19.40412 -85.732469
N1354915088_1.IMG 2000-342T21:06:43.681 1024 CL1 CB2 139.27671 2.942204 3.5688211 6.8702712 146.69765 317.39582 19.323604 -85.73357
N1354921390_1.IMG 2000-342T22:51:45.637 1024 CL1 CB2 138.90784 2.9420849 3.5673391 6.801849 198.81712 4.0328187 19.454642 -85.734725