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

Add support for Complex data types #650

Merged
merged 8 commits into from
May 31, 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
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ POSSIBILITY OF SUCH DAMAGE.
<dependency>
<groupId>gov.nasa.pds</groupId>
<artifactId>pds4-jparser</artifactId>
<version>2.5.0</version>
<version>2.6.0-SNAPSHOT</version>
<scope>compile</scope>
<exclusions>
<exclusion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,18 +232,22 @@ private void validatePosition(Array array, ArrayObject arrayObject, ArrayLocatio
value = arrayObject.getLong(position);
rangeChecker = SignedMSB8_RANGE;
break;
case ComplexLSB8:
case IEEE754LSBSingle:
value = (float) arrayObject.getDouble(position);
rangeChecker = IEEE754LSBSingle_RANGE;
break;
case ComplexMSB8:
case IEEE754MSBSingle:
value = (float) arrayObject.getDouble(position);
rangeChecker = IEEE754MSBSingle_RANGE;
break;
case ComplexLSB16:
case IEEE754LSBDouble:
value = arrayObject.getDouble(position);
rangeChecker = IEEE754LSBDouble_RANGE;
break;
case ComplexMSB16:
case IEEE754MSBDouble:
value = arrayObject.getDouble(position);
rangeChecker = IEEE754MSBDouble_RANGE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import gov.nasa.pds.label.Label;
import gov.nasa.pds.label.NameNotKnownException;
import gov.nasa.pds.label.ProductType;
import gov.nasa.pds.label.object.ArrayObject;
import gov.nasa.pds.label.object.DataObject;
Expand Down Expand Up @@ -124,6 +125,10 @@ public void validate() throws MalformedURLException, URISyntaxException {
getListener().addProblem(new ValidationProblem(
new ProblemDefinition(ExceptionType.ERROR, ProblemType.TABLE_DEFINITION_PROBLEM, msg),
getTarget(), objectCounter, -1));
} catch (NameNotKnownException e) {
getListener().addProblem(new ValidationProblem(
new ProblemDefinition(ExceptionType.ERROR, ProblemType.UNKNOWN_VALUE, e.getMessage()),
getTarget(), objectCounter, -1));
} catch (ParseException e) {
// Ignore. Shouldn't happen
} catch (FileNotFoundException e) {
Expand Down
2 changes: 2 additions & 0 deletions src/test/resources/features/validate.feature
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,8 @@ Scenario Outline: Execute validate command for tests below.
|"NASA-PDS/validate#299 VALID" | "github299" | 0 | "0 errors message expected" | "totalErrors" | "src/test/resources" | "target/test" | "-R pds4.label -r {reportDir}/report_github299_label_valid.json -s json -t {resourceDir}/github299/valid/gbo_ast_fieber-beyer_spectra_v2.0_20210211_aip_v1.0.xml" | "report_github299_label_valid.json" |
|"NASA-PDS/validate#299 INVALID" | "github299" | 3 | "3 errors message expected" | "totalErrors" | "src/test/resources" | "target/test" | "-R pds4.label -r {reportDir}/report_github299_label_invalid.json -s json -t {resourceDir}/github299/invalid/gbo_ast_fieber-beyer_spectra_v2.0_20210211_aip_v1.0.xml" | "report_github299_label_invalid.json" |

|"NASA-PDS/validate#7 Success with ComplexLSB8" | "github7" | 0 | "0 errors expected" | "totalErrors" | "src/test/resources" | "target/test" | "-r {reportDir}/report_github7.json -s json --skip-context-validation -t {resourceDir}/github7/ch2_sar_ncxs_20090107t163003745_d_sli_xx_fp_hh_pb1_19111.xml" | "report_github7.json" |

# BIG_NOTE: The tests for github6 has to be moved toward the beginning as leave them here results in error in information model.
# BIG_NOTE: The tests for github240 has to be moved toward the beginning as leave them here results in error in information model.

Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?xml-model href="http://pds.nasa.gov/pds4/pds/v1/PDS4_PDS_1A00.sch"
schematypens="http://purl.oclc.org/dsdl/schematron"?>
<?xml-model schematypens="http://purl.oclc.org/dsdl/schematron"
href="https://pds.nasa.gov/pds4/sp/v1/PDS4_SP_1A00.sch"
schematypens="http://purl.oclc.org/dsdl/schematron"?>
<?xml-model href="http://pds.nasa.gov/pds4/disp/v1/PDS4_DISP_1301.sch"
schematypens="http://purl.oclc.org/dsdl/schematron"?>
<Product_Observational xmlns="http://pds.nasa.gov/pds4/pds/v1"
xmlns:disp="http://pds.nasa.gov/pds4/disp/v1"
xmlns:sp="http://pds.nasa.gov/pds4/sp/v1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://pds.nasa.gov/pds4/pds/v1 http://pds.nasa.gov/pds4/pds/v1/PDS4_PDS_1A00.xsd http://pds.nasa.gov/pds4/disp/v1/PDS4_DISP_1301.xsd https://pds.nasa.gov/pds4/sp/v1/PDS4_SP_1A00.xsd">
<Identification_Area>
<logical_identifier>urn:isro:isda:ch2_cho:sar_calibrated:ch2_sar_ncxs_20090107t163003745_d_sli_xx_fp_hh_pb1</logical_identifier>
<version_id>1.0</version_id>
<title>Chandrayaan-2 Dual frequency L and S band SAR</title>
<information_model_version>1.10.0.0</information_model_version>
<product_class>Product_Observational</product_class>
<Modification_History>
<Modification_Detail>
<modification_date>2018-12-03</modification_date>
<version_id>1.0</version_id>
<description>PDS4 product label created by SAR DP SAC-ISRO team</description>
</Modification_Detail>
</Modification_History>
</Identification_Area>
<Observation_Area>
<Time_Coordinates>
<start_date_time>2009-01-07Z</start_date_time>
<stop_date_time>2009-01-07Z</stop_date_time>
</Time_Coordinates>
<Primary_Result_Summary>
<purpose>Science</purpose>
<processing_level>Calibrated</processing_level>
</Primary_Result_Summary>
<Investigation_Area>
<name>Chandrayaan-2</name>
<type>Mission</type>
<Internal_Reference>
<lidvid_reference>urn:isro:isda:context:investigation.chandrayaan-2::1.0</lidvid_reference>
<reference_type>data_to_investigation</reference_type>
</Internal_Reference>
</Investigation_Area>
<Observing_System>
<Observing_System_Component>
<name>Chandrayaan-2 orbiter</name>
<type>Spacecraft</type>
</Observing_System_Component>
<Observing_System_Component>
<name>Dual frequency L and S band SAR</name>
<type>Instrument</type>
</Observing_System_Component>
</Observing_System>
<Target_Identification>
<name>Moon</name>
<type>Planet</type>
</Target_Identification>
<Discipline_Area>
</Discipline_Area>
</Observation_Area>

<File_Area_Observational>
<File>
<file_name>ch2_sar_ncxs_20090107t163003745_d_sli_xx_fp_hh_pb1_19111.tiff</file_name>
<local_identifier>DATA_FILE</local_identifier>
<creation_date_time>2019-03-15T10:45:25Z</creation_date_time>
<file_size unit="byte">276674</file_size>
<md5_checksum>70f9aff5665e5bcc2efdb45f74f48bbc</md5_checksum>
<comment>Comment to be filled</comment>
</File>
<Array_2D_Image>
<offset unit="byte">4386</offset>
<axes>2</axes>
<axis_index_order>Last Index Fastest</axis_index_order>
<Element_Array>
<data_type>ComplexLSB8</data_type>
</Element_Array>
<Axis_Array>
<axis_name>Line</axis_name>
<elements>50</elements>
<sequence_number>1</sequence_number>
</Axis_Array>
<Axis_Array>
<axis_name>Sample</axis_name>
<elements>676</elements>
<sequence_number>2</sequence_number>
</Axis_Array>
</Array_2D_Image>
</File_Area_Observational>
</Product_Observational>