();
142 | outputs.addAll(transform(url, outputDir, format));
143 | return outputs;
144 | }
145 |
146 | /**
147 | * Set the paths to search for files referenced by pointers.
148 | *
149 | * Default is to always look first in the same directory
150 | * as the label, then search specified directories.
151 | * @param i List of paths
152 | */
153 | public void setIncludePaths(List i) {
154 | this.includePaths = new ArrayList (i);
155 | while(this.includePaths.remove(""));
156 | }
157 | }
158 |
--------------------------------------------------------------------------------
/src/main/java/gov/nasa/pds/transform/product/Pds4LabelTransformer.java:
--------------------------------------------------------------------------------
1 | // Copyright © 2019, California Institute of Technology ("Caltech").
2 | // U.S. Government sponsorship acknowledged.
3 | //
4 | // All rights reserved.
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions are met:
8 | //
9 | // • Redistributions of source code must retain the above copyright notice,
10 | // this list of conditions and the following disclaimer.
11 | // • Redistributions must reproduce the above copyright notice, this list of
12 | // conditions and the following disclaimer in the documentation and/or other
13 | // materials provided with the distribution.
14 | // • Neither the name of Caltech nor its operating division, the Jet Propulsion
15 | // Laboratory, nor the names of its contributors may be used to endorse or
16 | // promote products derived from this software without specific prior written
17 | // permission.
18 | //
19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
23 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 | // POSSIBILITY OF SUCH DAMAGE.
30 |
31 | package gov.nasa.pds.transform.product;
32 |
33 | import java.io.File;
34 | import java.io.IOException;
35 | import java.util.ArrayList;
36 | import java.util.Arrays;
37 | import java.util.List;
38 | import java.net.URL;
39 | import java.net.URISyntaxException;
40 |
41 | import gov.nasa.pds.tools.label.Label;
42 | import gov.nasa.pds.transform.TransformException;
43 | import gov.nasa.pds.transform.logging.ToolsLevel;
44 | import gov.nasa.pds.transform.logging.ToolsLogRecord;
45 | import gov.nasa.pds.transform.util.PDS3LabelWriter;
46 | import gov.nasa.pds.transform.util.Utility;
47 |
48 | /**
49 | * Class that performs transformations on a PDS4 label.
50 | *
51 | * @author mcayanan
52 | *
53 | */
54 | public class Pds4LabelTransformer extends DefaultTransformer {
55 |
56 | /**
57 | * Constructor.
58 | *
59 | * @param overwrite Flag to allow overwriting of the output file.
60 | */
61 | public Pds4LabelTransformer(boolean overwrite) {
62 | super(overwrite);
63 | }
64 |
65 | @Override
66 | public List transform(URL url, File outputDir, String format,
67 | String dataFile, int index) throws TransformException, URISyntaxException, Exception {
68 | File target = new File(url.toURI());
69 | log.log(new ToolsLogRecord(ToolsLevel.INFO,
70 | "Transforming label file: " + url.toString(), url.toString()));
71 |
72 | File outputFile = Utility.createOutputFile(new File(url.getFile()), outputDir, format);
73 | Pds4ToPds3LabelTransformer transformer = new Pds4ToPds3LabelTransformer(outputFile);
74 | if ((outputFile.exists() && outputFile.length() != 0) && !overwriteOutput) {
75 | log.log(new ToolsLogRecord(ToolsLevel.INFO,
76 | "Output file already exists. No transformation will occur: "
77 | + outputFile.toString(), target));
78 | return Arrays.asList(outputFile);
79 | }
80 | try {
81 | Label label = transformer.transform(target);
82 | PDS3LabelWriter writer = new PDS3LabelWriter();
83 | writer.write(label);
84 | log.log(new ToolsLogRecord(ToolsLevel.INFO,
85 | "Successfully transformed target label to a PDS3 label: " + outputFile.toString(),
86 | target));
87 | return Arrays.asList(label.getLabelFile());
88 | } catch (TransformException t) {
89 | t.printStackTrace();
90 | throw t;
91 | } catch (IOException io) {
92 | throw new TransformException("Error while writing label to a file: " + io.getMessage());
93 | }
94 | }
95 |
96 | @Override
97 | public List transformAll(URL url, File outputDir, String format)
98 | throws TransformException, URISyntaxException, Exception {
99 | List outputs = new ArrayList();
100 | outputs.addAll(transform(url, outputDir, format));
101 | return outputs;
102 | }
103 | }
104 |
--------------------------------------------------------------------------------
/src/main/java/gov/nasa/pds/transform/product/ProductTransformer.java:
--------------------------------------------------------------------------------
1 | // Copyright © 2019, California Institute of Technology ("Caltech").
2 | // U.S. Government sponsorship acknowledged.
3 | //
4 | // All rights reserved.
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions are met:
8 | //
9 | // • Redistributions of source code must retain the above copyright notice,
10 | // this list of conditions and the following disclaimer.
11 | // • Redistributions must reproduce the above copyright notice, this list of
12 | // conditions and the following disclaimer in the documentation and/or other
13 | // materials provided with the distribution.
14 | // • Neither the name of Caltech nor its operating division, the Jet Propulsion
15 | // Laboratory, nor the names of its contributors may be used to endorse or
16 | // promote products derived from this software without specific prior written
17 | // permission.
18 | //
19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
23 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 | // POSSIBILITY OF SUCH DAMAGE.
30 |
31 | package gov.nasa.pds.transform.product;
32 |
33 | import gov.nasa.pds.transform.TransformException;
34 |
35 | import java.io.File;
36 | import java.util.List;
37 | import java.net.URL;
38 | import java.net.URISyntaxException;
39 |
40 |
41 | /**
42 | * Interface to perform transformations on PDS data products.
43 | *
44 | * @author mcayanan
45 | *
46 | */
47 | public interface ProductTransformer {
48 |
49 | /**
50 | * Transform a single target. This will transform
51 | * the first image/table found within the first data file found.
52 | *
53 | * @param target file specification to the PDS label.
54 | * @param outputDir directory where the output file will be
55 | * written.
56 | * @param format Valid format file type.
57 | *
58 | * @return The resulting output file.
59 | *
60 | * @throws TransformException If an error occurred during the
61 | * transformation process.
62 | */
63 | public List transform(File target, File outputDir, String format)
64 | throws TransformException;
65 |
66 | public List transform(URL url, File outputDir, String format)
67 | throws TransformException, URISyntaxException, Exception;
68 |
69 | /**
70 | * Transform a single target.
71 | *
72 | * @param target file specification to the PDS label.
73 | * @param outputDir directory where the output file will be written.
74 | * @param format Valid format file type.
75 | * @param dataFile Tells the tool which data file to transform.
76 | * If this argument is an empty string, the default is to transform
77 | * the first data file found in the label.
78 | * @param index The index of the data. This tells the tool which image
79 | * or table to transform if there are multiple images/tables within a
80 | * single data file.
81 | *
82 | * @return The resulting output file.
83 | *
84 | * @throws TransformException If an error occurred during the
85 | * transformation process.
86 | */
87 | public List transform(File target, File outputDir, String format,
88 | String dataFile, int index) throws TransformException;
89 |
90 | public List transform(URL target, File outputDir, String format,
91 | String dataFile, int index)
92 | throws TransformException, URISyntaxException, Exception;
93 |
94 | /**
95 | * Transform multiple targets. This will transform
96 | * the first image/table found within the first data file found in
97 | * each target.
98 | *
99 | * @param targets a list of URL specifications to the PDS labels.
100 | * @param outputDir directory where the output file will be
101 | * written.
102 | * @param format Valid format file type.
103 | *
104 | * @return The resulting output files.
105 | *
106 | * @throws TransformException If an error occurred during the
107 | * transformation process.
108 | */
109 | public List transform(List targets, File outputDir, String format)
110 | throws TransformException, URISyntaxException, Exception;
111 |
112 |
113 | /**
114 | * Transform all images/tables found in the given target.
115 | *
116 | * @param target file specification to the PDS label.
117 | * @param outputDir directory where the output file will be written.
118 | * @param format Valid format file type.
119 | *
120 | * @return The resulting output files.
121 | *
122 | * @throws TransformException If an error occurred during the
123 | * transformation process.
124 | */
125 | public List transformAll(File target, File outputDir, String format)
126 | throws TransformException;
127 |
128 | public List transformAll(URL url, File outputDir, String format)
129 | throws TransformException, URISyntaxException, Exception;
130 |
131 | /**
132 | * Transform all images/tables found in each target.
133 | *
134 | * @param targets a list of URL specifications to the PDS labels.
135 | * @param outputDir directory where the output file will be written.
136 | * @param format Valid format file type.
137 | *
138 | * @return The resulting output files.
139 | *
140 | * @throws TransformException If an error occurred during the
141 | * transformation process.
142 | */
143 | public List transformAll(List targets, File outputDir, String format)
144 | throws TransformException, URISyntaxException, Exception;
145 | }
146 |
--------------------------------------------------------------------------------
/src/main/java/gov/nasa/pds/transform/product/ProductTransformerFactory.java:
--------------------------------------------------------------------------------
1 | // Copyright © 2019, California Institute of Technology ("Caltech").
2 | // U.S. Government sponsorship acknowledged.
3 | //
4 | // All rights reserved.
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions are met:
8 | //
9 | // • Redistributions of source code must retain the above copyright notice,
10 | // this list of conditions and the following disclaimer.
11 | // • Redistributions must reproduce the above copyright notice, this list of
12 | // conditions and the following disclaimer in the documentation and/or other
13 | // materials provided with the distribution.
14 | // • Neither the name of Caltech nor its operating division, the Jet Propulsion
15 | // Laboratory, nor the names of its contributors may be used to endorse or
16 | // promote products derived from this software without specific prior written
17 | // permission.
18 | //
19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
23 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 | // POSSIBILITY OF SUCH DAMAGE.
30 |
31 | package gov.nasa.pds.transform.product;
32 |
33 | import gov.nasa.pds.transform.TransformException;
34 | import gov.nasa.pds.transform.constants.Constants;
35 |
36 | import java.io.File;
37 | import java.net.URL;
38 |
39 | import org.apache.commons.io.FilenameUtils;
40 |
41 | /**
42 | * Transformer Factory class that determines whether to transform a
43 | * PDS3 or PDS4 product.
44 | *
45 | * @author mcayanan
46 | *
47 | */
48 | public class ProductTransformerFactory {
49 | /** Holds the factory object. */
50 | private static ProductTransformerFactory factory = null;
51 |
52 | /** Private constructor. */
53 | private ProductTransformerFactory() {}
54 |
55 | private final String OVERWRITE_PROP = "overwrite.output";
56 |
57 | /** Gets an instance of the factory.
58 | *
59 | */
60 | public static synchronized ProductTransformerFactory getInstance() {
61 | if (factory == null) {
62 | factory = new ProductTransformerFactory();
63 | }
64 | return factory;
65 | }
66 |
67 | /**
68 | * Gets an instance of a Transformer. If the given label ends in ".xml",
69 | * then this will return a PDS4 Transformer object. Otherwise, a PDS3
70 | * Transformer object will be returned.
71 | *
72 | * @param target A PDS3 or PDS4 label file.
73 | * @param format The transformation format.
74 | *
75 | * @return The appropriate Transformer object.
76 | *
77 | * @throws TransformException If the input label could not be opened or
78 | * the format type is not one of the valid formats.
79 | */
80 | public ProductTransformer newInstance(File target, String format)
81 | throws TransformException {
82 | if (!target.exists()) {
83 | throw new TransformException("Target not found: " + target);
84 | }
85 | boolean overwrite = Boolean.parseBoolean(
86 | System.getProperty(OVERWRITE_PROP));
87 | String extension = FilenameUtils.getExtension(target.toString());
88 | if (extension.equalsIgnoreCase("xml")) {
89 | if (Constants.PDS4_VALID_FORMATS.contains(format)) {
90 | if ("csv".equals(format)) {
91 | return new Pds4TableTransformer(overwrite);
92 | } else if (Constants.STYLESHEETS.containsKey(format)) {
93 | return new StylesheetTransformer(overwrite);
94 | } else if ("pds3-label".equals(format)) {
95 | return new Pds4LabelTransformer(overwrite);
96 | } else {
97 | return new Pds4ImageTransformer(overwrite);
98 | }
99 | } else {
100 | throw new TransformException("Format value '" + format
101 | + "' is not one of the valid formats for a PDS4 transformation: "
102 | + Constants.PDS4_VALID_FORMATS);
103 | }
104 | } else {
105 | if (Constants.PDS3_VALID_FORMATS.contains(format)) {
106 | if ("pds4-label".equals(format)) {
107 | return new Pds3LabelTransformer(overwrite);
108 | } else if ("csv".equals(format)) {
109 | return new Pds3TableTransformer(overwrite);
110 | } else {
111 | return new Pds3ImageTransformer(overwrite);
112 | }
113 | } else {
114 | throw new TransformException("Format value '" + format
115 | + "' is not one of the valid formats for a PDS3 transformation: "
116 | + Constants.PDS3_VALID_FORMATS);
117 | }
118 | }
119 | }
120 |
121 | public ProductTransformer newInstance(URL target, String format)
122 | throws TransformException {
123 | boolean overwrite = Boolean.parseBoolean(
124 | System.getProperty(OVERWRITE_PROP));
125 | String extension = FilenameUtils.getExtension(target.toString());
126 | if (extension.equalsIgnoreCase("xml")) {
127 | if (Constants.PDS4_VALID_FORMATS.contains(format)) {
128 | if ("csv".equals(format)) {
129 | return new Pds4TableTransformer(overwrite);
130 | } else if (Constants.STYLESHEETS.containsKey(format)) {
131 | return new StylesheetTransformer(overwrite);
132 | } else if ("pds3-label".equals(format)) {
133 | return new Pds4LabelTransformer(overwrite);
134 | } else {
135 | return new Pds4ImageTransformer(overwrite);
136 | }
137 | } else {
138 | throw new TransformException("Format value '" + format
139 | + "' is not one of the valid formats for a PDS4 transformation: "
140 | + Constants.PDS4_VALID_FORMATS);
141 | }
142 | } else {
143 | if (Constants.PDS3_VALID_FORMATS.contains(format)) {
144 | if ("pds4-label".equals(format)) {
145 | return new Pds3LabelTransformer(overwrite);
146 | } else if ("csv".equals(format)) {
147 | return new Pds3TableTransformer(overwrite);
148 | } else {
149 | return new Pds3ImageTransformer(overwrite);
150 | }
151 | } else {
152 | throw new TransformException("Format value '" + format
153 | + "' is not one of the valid formats for a PDS3 transformation: "
154 | + Constants.PDS3_VALID_FORMATS);
155 | }
156 | }
157 | }
158 | }
159 |
--------------------------------------------------------------------------------
/src/main/java/gov/nasa/pds/transform/product/label/DelimitedTableLabelTransformer.java:
--------------------------------------------------------------------------------
1 | // Copyright © 2019, California Institute of Technology ("Caltech").
2 | // U.S. Government sponsorship acknowledged.
3 | //
4 | // All rights reserved.
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions are met:
8 | //
9 | // • Redistributions of source code must retain the above copyright notice,
10 | // this list of conditions and the following disclaimer.
11 | // • Redistributions must reproduce the above copyright notice, this list of
12 | // conditions and the following disclaimer in the documentation and/or other
13 | // materials provided with the distribution.
14 | // • Neither the name of Caltech nor its operating division, the Jet Propulsion
15 | // Laboratory, nor the names of its contributors may be used to endorse or
16 | // promote products derived from this software without specific prior written
17 | // permission.
18 | //
19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
23 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 | // POSSIBILITY OF SUCH DAMAGE.
30 |
31 | package gov.nasa.pds.transform.product.label;
32 |
33 | import java.math.BigInteger;
34 |
35 | import gov.nasa.arc.pds.xml.generated.TableDelimited;
36 | import gov.nasa.pds.objectAccess.table.DelimiterType;
37 |
38 | /**
39 | * Class to transform a non-CSV Table_Delimited object to a
40 | * CSV Table_Delimited object.
41 | *
42 | * @author mcayanan
43 | *
44 | */
45 | public class DelimitedTableLabelTransformer implements
46 | TableLabelTransformer {
47 |
48 | @Override
49 | public TableDelimited toTableDelimited(Object table) {
50 | return toTableDelimited(table, DelimiterType.COMMA);
51 | }
52 |
53 | @Override
54 | public TableDelimited toTableDelimited(Object table,
55 | DelimiterType type) {
56 | return toTableDelimited((TableDelimited) table, type);
57 | }
58 |
59 |
60 | @Override
61 | public TableDelimited toTableDelimited(TableDelimited table) {
62 | return toTableDelimited(table, DelimiterType.COMMA);
63 | }
64 |
65 | @Override
66 | public TableDelimited toTableDelimited(TableDelimited table,
67 | DelimiterType type) {
68 | if (!table.getFieldDelimiter().equals(type.getXmlType())) {
69 | table.setFieldDelimiter(type.getXmlType());
70 | }
71 | //Should always set the value to 0
72 | table.getOffset().setValue(BigInteger.valueOf(0));
73 | return table;
74 | }
75 |
76 | }
77 |
--------------------------------------------------------------------------------
/src/main/java/gov/nasa/pds/transform/product/label/TableLabelTransformer.java:
--------------------------------------------------------------------------------
1 | // Copyright © 2019, California Institute of Technology ("Caltech").
2 | // U.S. Government sponsorship acknowledged.
3 | //
4 | // All rights reserved.
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions are met:
8 | //
9 | // • Redistributions of source code must retain the above copyright notice,
10 | // this list of conditions and the following disclaimer.
11 | // • Redistributions must reproduce the above copyright notice, this list of
12 | // conditions and the following disclaimer in the documentation and/or other
13 | // materials provided with the distribution.
14 | // • Neither the name of Caltech nor its operating division, the Jet Propulsion
15 | // Laboratory, nor the names of its contributors may be used to endorse or
16 | // promote products derived from this software without specific prior written
17 | // permission.
18 | //
19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
23 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 | // POSSIBILITY OF SUCH DAMAGE.
30 |
31 | package gov.nasa.pds.transform.product.label;
32 |
33 | import gov.nasa.arc.pds.xml.generated.ByteStream;
34 | import gov.nasa.arc.pds.xml.generated.TableDelimited;
35 | import gov.nasa.pds.objectAccess.table.DelimiterType;
36 |
37 | /**
38 | * Interface class for a TableLabelTransformer.
39 | *
40 | * @author mcayanan
41 | *
42 | * @param Should be one of the PDS4 supported table objects.
43 | */
44 | public interface TableLabelTransformer {
45 |
46 | /** Convenience wrapper class to convert a given table object
47 | * to a Table_Delimited object with a comma field delimter.
48 | */
49 | public TableDelimited toTableDelimited(Object table);
50 |
51 |
52 | /**
53 | * Convenience wrapper class to convert a given table object
54 | * to a Table_Delimited object with the given field delimiter.
55 | *
56 | * @param table The table object.
57 | * @param type The field delimiter to set.
58 | *
59 | * @return The transformed Table_Delimited object.
60 | */
61 | public TableDelimited toTableDelimited(Object table, DelimiterType type);
62 |
63 | /** Converts the given table object to a Table_Delimited object with a
64 | * comma field delimter.
65 | */
66 | public TableDelimited toTableDelimited(T table);
67 |
68 | /**
69 | * Converts the given table to a TableDelimited object.
70 | *
71 | * @param table The table object to convert.
72 | * @param type The delimiter type to set.
73 | *
74 | * @return The transformed Table_Delimited object.
75 | */
76 | public TableDelimited toTableDelimited(T table, DelimiterType type);
77 | }
78 |
--------------------------------------------------------------------------------
/src/main/java/gov/nasa/pds/transform/product/label/TableLabelTransformerFactory.java:
--------------------------------------------------------------------------------
1 | // Copyright © 2019, California Institute of Technology ("Caltech").
2 | // U.S. Government sponsorship acknowledged.
3 | //
4 | // All rights reserved.
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions are met:
8 | //
9 | // • Redistributions of source code must retain the above copyright notice,
10 | // this list of conditions and the following disclaimer.
11 | // • Redistributions must reproduce the above copyright notice, this list of
12 | // conditions and the following disclaimer in the documentation and/or other
13 | // materials provided with the distribution.
14 | // • Neither the name of Caltech nor its operating division, the Jet Propulsion
15 | // Laboratory, nor the names of its contributors may be used to endorse or
16 | // promote products derived from this software without specific prior written
17 | // permission.
18 | //
19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
23 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 | // POSSIBILITY OF SUCH DAMAGE.
30 |
31 | package gov.nasa.pds.transform.product.label;
32 |
33 | import gov.nasa.arc.pds.xml.generated.TableBinary;
34 | import gov.nasa.arc.pds.xml.generated.TableCharacter;
35 | import gov.nasa.arc.pds.xml.generated.TableDelimited;
36 | import gov.nasa.pds.transform.TransformException;
37 |
38 | /**
39 | * Class that determines which TableLabelTransformer sub-class
40 | * to instantiate based on the given object.
41 | *
42 | * @author mcayanan
43 | *
44 | */
45 | public class TableLabelTransformerFactory {
46 | /** Holds the factory object. */
47 | private static TableLabelTransformerFactory factory = null;
48 |
49 | /** Private constructor. */
50 | private TableLabelTransformerFactory() {}
51 |
52 | /**
53 | * Gets an instance of the factory.
54 | */
55 | public static synchronized TableLabelTransformerFactory getInstance() {
56 | if (factory == null) {
57 | factory = new TableLabelTransformerFactory();
58 | }
59 | return factory;
60 | }
61 |
62 | /**
63 | * Instantiates a new TableLabelTransformer object based on the given
64 | * table object.
65 | *
66 | * @param tableObject Must be either Table_Binary,
67 | * Table_Character, or Table_Delimited.
68 | *
69 | * @return a TableLabelTransformer object.
70 | *
71 | * @throws TransformException If the given object is not one of
72 | * the supported PDS4 table objects.
73 | */
74 | public TableLabelTransformer> newInstance(Object tableObject)
75 | throws TransformException {
76 | if (tableObject instanceof TableBinary) {
77 | return new BinaryTableLabelTransformer();
78 | } else if (tableObject instanceof TableCharacter) {
79 | return new CharacterTableLabelTransformer();
80 | } else if (tableObject instanceof TableDelimited) {
81 | return new DelimitedTableLabelTransformer();
82 | } else {
83 | throw new TransformException(
84 | "Table Object must be 'TableBinary', 'TableCharacter' or 'TableDelimited'");
85 | }
86 | }
87 | }
88 |
--------------------------------------------------------------------------------
/src/main/java/gov/nasa/pds/transform/product/pds3/OrderedObjectStatement.java:
--------------------------------------------------------------------------------
1 | // Copyright © 2019, California Institute of Technology ("Caltech").
2 | // U.S. Government sponsorship acknowledged.
3 | //
4 | // All rights reserved.
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions are met:
8 | //
9 | // • Redistributions of source code must retain the above copyright notice,
10 | // this list of conditions and the following disclaimer.
11 | // • Redistributions must reproduce the above copyright notice, this list of
12 | // conditions and the following disclaimer in the documentation and/or other
13 | // materials provided with the distribution.
14 | // • Neither the name of Caltech nor its operating division, the Jet Propulsion
15 | // Laboratory, nor the names of its contributors may be used to endorse or
16 | // promote products derived from this software without specific prior written
17 | // permission.
18 | //
19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
23 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 | // POSSIBILITY OF SUCH DAMAGE.
30 |
31 | package gov.nasa.pds.transform.product.pds3;
32 |
33 | import java.util.ArrayList;
34 | import java.util.List;
35 |
36 | import gov.nasa.pds.tools.label.Label;
37 | import gov.nasa.pds.tools.label.ObjectStatement;
38 | import gov.nasa.pds.tools.label.Statement;
39 |
40 | /**
41 | * An extension of the ObjectStatement object in order to preserve
42 | * the ordering of the statements when they are added to the object.
43 | * This comes in handy in that it allows the statements to be printed
44 | * in order. The parent class stores statements in a Hash Map and sorts
45 | * it by object name.
46 | *
47 | * @author mcayanan
48 | *
49 | */
50 | public class OrderedObjectStatement extends ObjectStatement {
51 | private List statements;
52 |
53 | /**
54 | * Constructor.
55 | *
56 | * @param sourceLabel The label the object belongs to.
57 | * @param identifier The name of the object.
58 | */
59 | public OrderedObjectStatement(Label sourceLabel, String identifier) {
60 | super(sourceLabel, identifier);
61 | this.statements = new ArrayList();
62 | }
63 |
64 | public void addStatement(Statement statement) {
65 | super.addStatement(statement);
66 | this.statements.add(statement);
67 | }
68 |
69 | public List getStatements() {
70 | return this.statements;
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/src/main/java/gov/nasa/pds/transform/util/ImageProperties.java:
--------------------------------------------------------------------------------
1 | // Copyright © 2019, California Institute of Technology ("Caltech").
2 | // U.S. Government sponsorship acknowledged.
3 | //
4 | // All rights reserved.
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions are met:
8 | //
9 | // • Redistributions of source code must retain the above copyright notice,
10 | // this list of conditions and the following disclaimer.
11 | // • Redistributions must reproduce the above copyright notice, this list of
12 | // conditions and the following disclaimer in the documentation and/or other
13 | // materials provided with the distribution.
14 | // • Neither the name of Caltech nor its operating division, the Jet Propulsion
15 | // Laboratory, nor the names of its contributors may be used to endorse or
16 | // promote products derived from this software without specific prior written
17 | // permission.
18 | //
19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
23 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 | // POSSIBILITY OF SUCH DAMAGE.
30 |
31 | package gov.nasa.pds.transform.util;
32 |
33 | import java.util.List;
34 |
35 | import gov.nasa.arc.pds.xml.generated.DisplaySettings;
36 | import gov.nasa.arc.pds.xml.generated.FileAreaObservational;
37 |
38 | /**
39 | * Class to hold image properties.
40 | *
41 | * @author mcayanan
42 | *
43 | */
44 | public class ImageProperties {
45 |
46 | /** List of FileAreaObservational elements. */
47 | private List fileAreas;
48 |
49 | /** List of DisplaySettings. */
50 | private List displaySettings;
51 |
52 | /**
53 | * Default constructor.
54 | *
55 | * @param fileAreas A list of FileAreaObservational objects.
56 | * @param displaySettings A list of DisplaySettings objects.
57 | */
58 | public ImageProperties(List fileAreas,
59 | List displaySettings) {
60 | this.fileAreas = fileAreas;
61 | this.displaySettings = displaySettings;
62 | }
63 |
64 | /**
65 | *
66 | * @return the list of FileAreaObservational objects.
67 | */
68 | public List getFileAreas() {
69 | return fileAreas;
70 | }
71 |
72 | /**
73 | *
74 | * @return the list of DisplaySettings objects.
75 | */
76 | public List getDisplaySettings() {
77 | return displaySettings;
78 | }
79 | }
80 |
--------------------------------------------------------------------------------
/src/main/java/gov/nasa/pds/transform/util/PDS3LabelWriter.java:
--------------------------------------------------------------------------------
1 | // Copyright © 2019, California Institute of Technology ("Caltech").
2 | // U.S. Government sponsorship acknowledged.
3 | //
4 | // All rights reserved.
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions are met:
8 | //
9 | // • Redistributions of source code must retain the above copyright notice,
10 | // this list of conditions and the following disclaimer.
11 | // • Redistributions must reproduce the above copyright notice, this list of
12 | // conditions and the following disclaimer in the documentation and/or other
13 | // materials provided with the distribution.
14 | // • Neither the name of Caltech nor its operating division, the Jet Propulsion
15 | // Laboratory, nor the names of its contributors may be used to endorse or
16 | // promote products derived from this software without specific prior written
17 | // permission.
18 | //
19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
23 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 | // POSSIBILITY OF SUCH DAMAGE.
30 |
31 | package gov.nasa.pds.transform.util;
32 |
33 | import java.io.FileWriter;
34 | import java.io.IOException;
35 | import java.io.PrintWriter;
36 | import java.util.List;
37 |
38 | import gov.nasa.pds.tools.containers.FileReference;
39 | import gov.nasa.pds.tools.label.AttributeStatement;
40 | import gov.nasa.pds.tools.label.Label;
41 | import gov.nasa.pds.tools.label.PointerStatement;
42 | import gov.nasa.pds.tools.label.Scalar;
43 | import gov.nasa.pds.tools.label.Sequence;
44 | import gov.nasa.pds.tools.label.Set;
45 | import gov.nasa.pds.tools.label.Statement;
46 | import gov.nasa.pds.tools.label.Value;
47 | import gov.nasa.pds.transform.product.pds3.OrderedObjectStatement;
48 |
49 | /**
50 | * Class that writes the label to a file.
51 | *
52 | * @author mcayanan
53 | *
54 | */
55 | public class PDS3LabelWriter {
56 | private final String CRLF = "\r\n";
57 |
58 | /**
59 | * Write the given label to a file. It will use the file name
60 | * stored within the given Label object.
61 | *
62 | * @param label The label.
63 | *
64 | * @throws IOException If an error occurred while writing the
65 | * label to a file.
66 | */
67 | public void write(Label label) throws IOException {
68 | PrintWriter writer = new PrintWriter(new FileWriter(label.getLabelFile()));
69 | try {
70 | for (Statement statement : label.getStatements()) {
71 | printStatement(writer, statement, 0);
72 | }
73 | writer.print("END" + CRLF);
74 | } finally {
75 | writer.flush();
76 | writer.close();
77 | }
78 | }
79 |
80 | private void printStatement(PrintWriter writer, Statement statement, int indent) {
81 | String spaces = "";
82 | for (int i = 0; i < indent; i++) {
83 | spaces += " ";
84 | }
85 | writer.print(spaces);
86 | if (statement instanceof AttributeStatement) {
87 | AttributeStatement a = (AttributeStatement) statement;
88 | writer.print(a.getIdentifier() + " = " + toString(a.getValue()) + CRLF);
89 | } else if (statement instanceof PointerStatement) {
90 | PointerStatement p = (PointerStatement) statement;
91 | writer.print("^" + p.getIdentifier().toString() + " = " + toString(p.getFileRefs()) + CRLF);
92 | } else if (statement instanceof OrderedObjectStatement) {
93 | OrderedObjectStatement o = (OrderedObjectStatement) statement;
94 | writer.print("OBJECT = " + o.getIdentifier().toString() + CRLF);
95 | for (Statement child : o.getStatements()) {
96 | printStatement(writer, child, indent + 2);
97 | }
98 | writer.print(spaces + "END_OBJECT = " + o.getIdentifier().toString() + CRLF + CRLF);
99 | }
100 | }
101 |
102 | private String toString(List fileRefs) {
103 | String result = "";
104 | FileReference fileRef = fileRefs.get(0);
105 | if (fileRef.getStartPosition() == null ||
106 | (fileRef.getStartPosition() != null && fileRef.getStartPosition().getValue().equals("0"))) {
107 | result = "\"" + fileRef.getPath() + "\"";
108 | } else {
109 | result = "(\"" + fileRef.getPath() + "\", " + fileRef.getStartPosition().toString() + " )";
110 | }
111 | return result;
112 | }
113 |
114 | private String toString(Value value) {
115 | String result = "";
116 | if (value instanceof Scalar) {
117 | result = ((Scalar) value).toString();
118 | } else if (value instanceof Sequence) {
119 | Sequence sequence = (Sequence) value;
120 | result = sequence.toString();
121 | } else if (value instanceof Set) {
122 | Set set = (Set) value;
123 | result = set.toString();
124 | }
125 | return result;
126 | }
127 | }
128 |
--------------------------------------------------------------------------------
/src/main/java/gov/nasa/pds/transform/util/ToolInfo.java:
--------------------------------------------------------------------------------
1 | // Copyright © 2019, California Institute of Technology ("Caltech").
2 | // U.S. Government sponsorship acknowledged.
3 | //
4 | // All rights reserved.
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions are met:
8 | //
9 | // • Redistributions of source code must retain the above copyright notice,
10 | // this list of conditions and the following disclaimer.
11 | // • Redistributions must reproduce the above copyright notice, this list of
12 | // conditions and the following disclaimer in the documentation and/or other
13 | // materials provided with the distribution.
14 | // • Neither the name of Caltech nor its operating division, the Jet Propulsion
15 | // Laboratory, nor the names of its contributors may be used to endorse or
16 | // promote products derived from this software without specific prior written
17 | // permission.
18 | //
19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
23 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 | // POSSIBILITY OF SUCH DAMAGE.
30 |
31 | package gov.nasa.pds.transform.util;
32 |
33 | import java.io.IOException;
34 | import java.io.InputStream;
35 | import java.net.URL;
36 | import java.util.Properties;
37 |
38 | /**
39 | * Class to get tool release information.
40 | *
41 | * @author mcayanan
42 | *
43 | */
44 | public class ToolInfo {
45 | /** Properties file name. */
46 | public static final String FILE = "transform.properties";
47 |
48 | /** Property key that holds the tool name. */
49 | public static final String NAME = "transform.name";
50 |
51 | /** Property key that holds the version. */
52 | public static final String VERSION = "transform.version";
53 |
54 | /** Property key that holds the release date. */
55 | public static final String RELEASE_DATE = "transform.date";
56 |
57 | /** Property key that holds the copyright information. */
58 | public static final String COPYRIGHT = "transform.copyright";
59 |
60 | private static final Properties props = new Properties();
61 |
62 | static {
63 | try {
64 | URL propertyFile = ToolInfo.class.getResource(FILE);
65 | InputStream in = propertyFile.openStream();
66 | props.load(in);
67 | } catch (IOException io) {
68 | throw new RuntimeException(io.getMessage());
69 | }
70 | }
71 |
72 | /**
73 | * Get the name of the tool.
74 | *
75 | * @return The tool name.
76 | */
77 | public static String getName() {
78 | return props.getProperty(NAME);
79 | }
80 |
81 | /**
82 | * Get the version.
83 | *
84 | * @return The tool version.
85 | */
86 | public static String getVersion() {
87 | return props.getProperty(VERSION);
88 | }
89 |
90 | /**
91 | * Get the release date.
92 | *
93 | * @return The tool release date.
94 | */
95 | public static String getReleaseDate() {
96 | return props.getProperty(RELEASE_DATE);
97 | }
98 |
99 | /**
100 | * Get copyright information.
101 | *
102 | * @return The copyright info.
103 | */
104 | public static String getCopyright() {
105 | return props.getProperty(COPYRIGHT);
106 | }
107 | }
108 |
--------------------------------------------------------------------------------
/src/main/java/gov/nasa/pds/transform/util/Transcoder.java:
--------------------------------------------------------------------------------
1 | // Copyright © 2019, California Institute of Technology ("Caltech").
2 | // U.S. Government sponsorship acknowledged.
3 | //
4 | // All rights reserved.
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions are met:
8 | //
9 | // • Redistributions of source code must retain the above copyright notice,
10 | // this list of conditions and the following disclaimer.
11 | // • Redistributions must reproduce the above copyright notice, this list of
12 | // conditions and the following disclaimer in the documentation and/or other
13 | // materials provided with the distribution.
14 | // • Neither the name of Caltech nor its operating division, the Jet Propulsion
15 | // Laboratory, nor the names of its contributors may be used to endorse or
16 | // promote products derived from this software without specific prior written
17 | // permission.
18 | //
19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
23 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 | // POSSIBILITY OF SUCH DAMAGE.
30 |
31 | package gov.nasa.pds.transform.util;
32 |
33 | import gov.nasa.pds.transform.TransformException;
34 |
35 | import java.io.File;
36 | import java.util.ArrayList;
37 | import java.util.List;
38 |
39 | import jpl.mipl.io.jConvertIIO;
40 |
41 | /**
42 | * Wrapper class to the Transcoder in the VICAR IO library.
43 | *
44 | * @author mcayanan
45 | *
46 | */
47 | public class Transcoder {
48 |
49 | /**
50 | * Constructor.
51 | *
52 | */
53 | public Transcoder() {}
54 |
55 | /**
56 | * Transcode the given input.
57 | *
58 | * @param input The input file.
59 | * @param output The output file.
60 | * @param format The format of the resulting transformation.
61 | *
62 | * @throws TransformException If an error occurred transcoding
63 | * the input file.
64 | */
65 | public void transcode(File input, File output, String format)
66 | throws TransformException {
67 | transcode(input, output, format, 0, true);
68 | }
69 |
70 | /**
71 | * Transcode the given input.
72 | *
73 | * @param input The input file.
74 | * @param output The output file.
75 | * @param format The format of the resulting transformation.
76 | * @param index The index of the image within the input file.
77 | * @param readAsRenderedImage 'true' to read the input as a rendered
78 | * image, 'false' otherwise.
79 | *
80 | * @throws TransformException If an error occurred transcoding
81 | * the input file.
82 | */
83 | public void transcode(File input, File output, String format,
84 | int index, boolean readAsRenderedImage) throws TransformException {
85 | List args = new ArrayList();
86 | args.add("INP=" + input.toString());
87 | args.add("OUT=" + output.toString());
88 | if("jp2".equalsIgnoreCase(format)) {
89 | args.add("FORMAT=jpeg2000");
90 | } else {
91 | args.add("FORMAT=" + format);
92 | }
93 | if (readAsRenderedImage) {
94 | args.add("RI");
95 | }
96 | if (index != 0) {
97 | args.add("IMAGE_INDEX=" + index);
98 | }
99 | args.add("OFORM=BYTE");
100 | try {
101 | System.getProperties().setProperty(
102 | "javax.xml.parsers.DocumentBuilderFactory",
103 | "com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl");
104 | System.getProperties().setProperty("javax.xml.transform.TransformerFactory",
105 | "com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl");
106 | jConvertIIO.main(args.toArray(new String[0]));
107 | } catch (Exception e) {
108 | throw new TransformException(e.getMessage());
109 | }
110 | }
111 | }
112 |
--------------------------------------------------------------------------------
/src/main/resources/conf/context-classes.xml:
--------------------------------------------------------------------------------
1 |
2 |
33 | gov.nasa.pds.imaging.generate.automatic.AutoGeneratedElements
34 | gov.nasa.pds.imaging.generate.util.TextUtil
35 |
--------------------------------------------------------------------------------
/src/main/resources/conf/generated-mappings.xml:
--------------------------------------------------------------------------------
1 |
2 |
33 |
34 | md5_checksum
35 | gov.nasa.pds.imaging.generate.automatic.elements.Md5Checksum
36 |
37 |
38 | file_size
39 | gov.nasa.pds.imaging.generate.automatic.elements.FileSize
40 |
41 |
42 | file_name
43 | gov.nasa.pds.imaging.generate.automatic.elements.FileName
44 |
45 |
46 | label_length
47 | gov.nasa.pds.imaging.generate.automatic.elements.LabelLength
48 |
49 |
50 | current_date_utc
51 | gov.nasa.pds.imaging.generate.automatic.elements.CurrentDateUTC
52 |
53 |
--------------------------------------------------------------------------------
/src/main/resources/conf/velocity-tools.xml:
--------------------------------------------------------------------------------
1 |
2 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
56 |
57 |
58 |
60 |
61 |
62 | this is bar.
63 |
65 |
66 |
--------------------------------------------------------------------------------
/src/main/resources/examples/20140804T205944Z_MAP_bias_V001.fits:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NASA-PDS/transform/c9e8ed9c5d2139ae78318db77ba1c63d4cef3dd6/src/main/resources/examples/20140804T205944Z_MAP_bias_V001.fits
--------------------------------------------------------------------------------
/src/main/resources/examples/2d234493326edratf3d2537n0m1.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NASA-PDS/transform/c9e8ed9c5d2139ae78318db77ba1c63d4cef3dd6/src/main/resources/examples/2d234493326edratf3d2537n0m1.dat
--------------------------------------------------------------------------------
/src/main/resources/examples/BA03S183.IMG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NASA-PDS/transform/c9e8ed9c5d2139ae78318db77ba1c63d4cef3dd6/src/main/resources/examples/BA03S183.IMG
--------------------------------------------------------------------------------
/src/main/resources/examples/C000M5232T493378259EDR_F0000_0134M1.IMG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NASA-PDS/transform/c9e8ed9c5d2139ae78318db77ba1c63d4cef3dd6/src/main/resources/examples/C000M5232T493378259EDR_F0000_0134M1.IMG
--------------------------------------------------------------------------------
/src/main/resources/examples/ELE_MOM.LBL:
--------------------------------------------------------------------------------
1 | PDS_VERSION_ID = PDS3
2 | RECORD_TYPE = FIXED_LENGTH
3 | RECORD_BYTES = 46
4 | FILE_RECORDS = 2278
5 | ^TABLE = "ELE_MOM.TAB"
6 | DATA_SET_ID = "VG2-J-PLS-5-SUMM-ELE-MOM-96.0SEC-V1.0"
7 | SPACECRAFT_NAME = "VOYAGER 2"
8 | INSTRUMENT_NAME = "PLASMA SCIENCE EXPERIMENT"
9 | TARGET_NAME = JUPITER
10 | START_TIME = 1979-07-06T00:00:42.687Z
11 | STOP_TIME = 1979-07-09T23:59:06.436Z
12 | MISSION_PHASE_NAME = "VOYAGER 2 JUPITER ENCOUNTER"
13 | PRODUCT_ID = "ELE_MOM.TAB"
14 | PRODUCT_TYPE = "DATA"
15 | PRODUCT_CREATION_TIME = "UNK"
16 | SPACECRAFT_CLOCK_START_COUNT = "2/20541:22:726"
17 | SPACECRAFT_CLOCK_STOP_COUNT = "2/20661:20:726"
18 | DESCRIPTION = "
19 | Electron density and moment temperature from the Plasma experiment on
20 | Voyager 2 from the Jupiter encounter. The data set contains 96 second
21 | averages of the electron moment data."
22 |
23 | OBJECT = TABLE
24 | INTERCHANGE_FORMAT = ASCII
25 | ROWS = 2278
26 | COLUMNS = 3
27 | ROW_BYTES = 46
28 | SAMPLING_PARAMETER_NAME = TIME
29 | SAMPLING_PARAMETER_UNIT = SECOND
30 | SAMPLING_PARAMETER_INTERVAL = 96.0
31 | OBJECT = COLUMN
32 | NAME = "TIME"
33 | COLUMN_NUMBER = 1
34 | UNIT = "N/A"
35 | DATA_TYPE = TIME
36 | START_BYTE = 1
37 | BYTES = 24
38 | DESCRIPTION = "
39 | Time column. This field contains time in PDS format
40 | yyyy-mm-ddThh:mm:ss.sssZ. The individual elements of the
41 | time field can be read using the format
42 | (i4,4(1x,i2),1x,f6.3) yr, mon, day, hr, min, sec."
43 | END_OBJECT = COLUMN
44 | OBJECT = COLUMN
45 | NAME = "ELE_DEN"
46 | COLUMN_NUMBER = 2
47 | UNIT = "COUNT/CM**3"
48 | DATA_TYPE = ASCII_REAL
49 | START_BYTE = 25
50 | BYTES = 10
51 | MISSING_CONSTANT = -9.99e+10
52 | DESCRIPTION = "
53 | Column contains total electron moment density in counts/cm^3."
54 | END_OBJECT = COLUMN
55 | OBJECT = COLUMN
56 | NAME = "ELE_TEMP"
57 | COLUMN_NUMBER = 3
58 | UNIT = "ELECTRONVOLT"
59 | DATA_TYPE = ASCII_REAL
60 | START_BYTE = 35
61 | BYTES = 10
62 | MISSING_CONSTANT = -9.99e+10
63 | DESCRIPTION = "
64 | Column contains total electron moment temperature in units of
65 | electron volts."
66 | END_OBJECT = COLUMN
67 |
68 | END_OBJECT = TABLE
69 | END
70 |
--------------------------------------------------------------------------------
/src/main/resources/examples/FF01.IMG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NASA-PDS/transform/c9e8ed9c5d2139ae78318db77ba1c63d4cef3dd6/src/main/resources/examples/FF01.IMG
--------------------------------------------------------------------------------
/src/main/resources/examples/FF01.LBL:
--------------------------------------------------------------------------------
1 | PDS_VERSION_ID = PDS3
2 | /* Framelet file format, size and location */
3 | RECORD_TYPE = FIXED_LENGTH
4 | RECORD_BYTES = 1024
5 | FILE_RECORDS = 1026
6 | ^IMAGE_HEADER = ("FF01.IMG",1)
7 | ^IMAGE = ("FF01.IMG",3)
8 | /* Framelet description */
9 | DATA_SET_ID = 'MGN-V-RDRS-5-MIDR-FULL-RES-V1.0'
10 | SPACECRAFT_NAME = MAGELLAN
11 | MISSION_PHASE_NAME = PRIMARY_MISSION
12 | TARGET_NAME = VENUS
13 | IMAGE_ID = 'F-MIDR.20S145;1'
14 | INSTRUMENT_NAME = 'RADAR SYSTEM'
15 | /* Description of objects contained in the framelet */
16 | OBJECT = IMAGE_HEADER
17 | TYPE = VICAR2
18 | BYTES = 1024
19 | RECORDS = 2
20 | END_OBJECT = IMAGE_HEADER
21 | OBJECT = IMAGE
22 | LINES = 1024
23 | LINE_SAMPLES = 1024
24 | SAMPLE_TYPE = UNSIGNED_INTEGER
25 | SAMPLE_BITS = 8
26 | NOTE = "
27 | DN = INT((MIN(MAX(RV,-20),30) + 20) * 5) + 1,
28 | where RV = radar crossection/area divided by the
29 | Muhleman Law and converted to decibels. Muhleman Law
30 | multiplicative constant of 0.0118 was used. (Note: Intention
31 | was to use 0.0188.)"
32 | END_OBJECT = IMAGE
33 |
34 | OBJECT = IMAGE_MAP_PROJECTION_CATALOG
35 | ^DATA_SET_MAP_PROJECT_CATALOG = 'DSMAPF.LBL'
36 | DATA_SET_ID = 'MGN-V-RDRS-5-MIDR-FULL-RES-V1.0'
37 | IMAGE_ID = 'F-MIDR.20S145;1'
38 | MAP_PROJECTION_TYPE = SINUSOIDAL
39 | MAP_RESOLUTION = 1407.4
40 | MAP_SCALE = 75
41 | MAXIMUM_LATITUDE = -17.4548
42 | MAXIMUM_LONGITUDE = 142.4009
43 | MINIMUM_LATITUDE = -18.1813
44 | MINIMUM_LONGITUDE = 141.6269
45 | X_AXIS_PROJECTION_OFFSET = -24579
46 | Y_AXIS_PROJECTION_OFFSET = 4096
47 | X_AXIS_FRAMELET_OFFSET = 1
48 | Y_AXIS_FRAMELET_OFFSET = 1
49 | A_AXIS_RADIUS = 6051.92
50 | B_AXIS_RADIUS = 6051.92
51 | C_AXIS_RADIUS = 6051.92
52 | FIRST_STANDARD_PARALLEL = 0.0000
53 | SECOND_STANDARD_PARALLEL = 'N/A'
54 | POSITIVE_LONGITUDE_DIRECTION = EAST
55 | CENTER_LATITUDE = 0.0000
56 | CENTER_LONGITUDE = 144.6882
57 | REFERENCE_LATITUDE = 'N/A'
58 | REFERENCE_LONGITUDE = 'N/A'
59 | X_AXIS_FIRST_PIXEL = 1
60 | Y_AXIS_FIRST_PIXEL = 1
61 | X_AXIS_LAST_PIXEL = 1024
62 | Y_AXIS_LAST_PIXEL = 1024
63 | MAP_PROJECTION_ROTATION = 0.0000
64 | END_OBJECT = IMAGE_MAP_PROJECTION_CATALOG
65 | END
66 |
--------------------------------------------------------------------------------
/src/main/resources/examples/FHA01118.IMG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NASA-PDS/transform/c9e8ed9c5d2139ae78318db77ba1c63d4cef3dd6/src/main/resources/examples/FHA01118.IMG
--------------------------------------------------------------------------------
/src/main/resources/examples/N1727539187_1.IMG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NASA-PDS/transform/c9e8ed9c5d2139ae78318db77ba1c63d4cef3dd6/src/main/resources/examples/N1727539187_1.IMG
--------------------------------------------------------------------------------
/src/main/resources/examples/N1727539187_1.LBL:
--------------------------------------------------------------------------------
1 | PDS_VERSION_ID = PDS3
2 |
3 | /* FILE CHARACTERISTICS */
4 |
5 | RECORD_TYPE = FIXED_LENGTH
6 | RECORD_BYTES = 2072
7 | FILE_RECORDS = 1027
8 |
9 | /* POINTERS TO DATA OBJECTS */
10 |
11 | ^IMAGE_HEADER = ("N1727539187_1.IMG",1)
12 | ^TELEMETRY_TABLE = ("N1727539187_1.IMG",3)
13 | ^LINE_PREFIX_TABLE = ("N1727539187_1.IMG",4)
14 | ^IMAGE = ("N1727539187_1.IMG",4)
15 |
16 | /* IDENTIFICATION DATA ELEMENTS */
17 |
18 | ANTIBLOOMING_STATE_FLAG = "ON"
19 | BIAS_STRIP_MEAN = 18.548109
20 | CALIBRATION_LAMP_STATE_FLAG = "N/A"
21 | COMMAND_FILE_NAME = "trigger_10368_1.ioi"
22 | COMMAND_SEQUENCE_NUMBER = 10368
23 | DARK_STRIP_MEAN = 0.735323
24 | DATA_CONVERSION_TYPE = "12BIT"
25 | DATA_SET_ID = "CO-S-ISSNA/ISSWA-2-EDR-V1.0"
26 | DELAYED_READOUT_FLAG = "NO"
27 | DESCRIPTION = "N/A"
28 | DETECTOR_TEMPERATURE = -89.318428
29 | EARTH_RECEIVED_START_TIME = 2012-273T00:06:46.557
30 | EARTH_RECEIVED_STOP_TIME = 2012-273T00:07:52.940
31 | ELECTRONICS_BIAS = 112
32 | EXPECTED_MAXIMUM = (56.543201,62.339600)
33 | EXPECTED_PACKETS = 831
34 | EXPOSURE_DURATION = 38000.000000
35 | FILTER_NAME = ("CL1","CB3")
36 | FILTER_TEMPERATURE = -0.468354
37 | FLIGHT_SOFTWARE_VERSION_ID = "1.4"
38 | GAIN_MODE_ID = "29 ELECTRONS PER DN"
39 | IMAGE_MID_TIME = 2012-272T15:06:21.685
40 | IMAGE_NUMBER = "1727539187"
41 | IMAGE_OBSERVATION_TYPE = {"SCIENCE"}
42 | IMAGE_TIME = 2012-272T15:06:40.685
43 | INSTRUMENT_DATA_RATE = 182.783997
44 | INSTRUMENT_HOST_NAME = "CASSINI ORBITER"
45 | INSTRUMENT_ID = "ISSNA"
46 | INSTRUMENT_MODE_ID = "FULL"
47 | INSTRUMENT_NAME = "IMAGING SCIENCE SUBSYSTEM - NARROW ANGLE"
48 | INST_CMPRS_PARAM = ("N/A","N/A","N/A","N/A")
49 | INST_CMPRS_RATE = (5.802420,5.442307)
50 | INST_CMPRS_RATIO = 2.939930
51 | INST_CMPRS_TYPE = "LOSSLESS"
52 | LIGHT_FLOOD_STATE_FLAG = "ON"
53 | METHOD_DESC = "ISSPT2.8;Titan;ISS_172TI_CLOUD002_PRIME"
54 | MISSING_LINES = 0
55 | MISSING_PACKET_FLAG = "NO"
56 | MISSION_NAME = "CASSINI-HUYGENS"
57 | MISSION_PHASE_NAME = "EXTENDED-EXTENDED MISSION"
58 | OBSERVATION_ID = "ISS_172TI_CLOUD002_PRIME"
59 | OPTICS_TEMPERATURE = (0.712693,1.905708)
60 | ORDER_NUMBER = 3
61 | PARALLEL_CLOCK_VOLTAGE_INDEX = 9
62 | PREPARE_CYCLE_INDEX = 8
63 | PRODUCT_CREATION_TIME = 2012-273T04:57:56.000
64 | PRODUCT_ID = "1_N1727539187.122"
65 | PRODUCT_VERSION_TYPE = "FINAL"
66 | READOUT_CYCLE_INDEX = 5
67 | RECEIVED_PACKETS = 781
68 | SENSOR_HEAD_ELEC_TEMPERATURE = 1.633024
69 | SEQUENCE_ID = "S75"
70 | SEQUENCE_NUMBER = 15
71 | SEQUENCE_TITLE = "ISS_172TI_CLOUD002_PRIME"
72 | SHUTTER_MODE_ID = "NACONLY"
73 | SHUTTER_STATE_ID = "ENABLED"
74 | SOFTWARE_VERSION_ID = "ISS 11.00 05-24-2006"
75 | SPACECRAFT_CLOCK_CNT_PARTITION = 1
76 | SPACECRAFT_CLOCK_START_COUNT = "1727539149.122"
77 | SPACECRAFT_CLOCK_STOP_COUNT = "1727539187.122"
78 | START_TIME = 2012-272T15:06:02.685
79 | STOP_TIME = 2012-272T15:06:40.685
80 | TARGET_DESC = "Titan"
81 | TARGET_LIST = "N/A"
82 | TARGET_NAME = "TITAN"
83 | TELEMETRY_FORMAT_ID = "S&ER3"
84 | VALID_MAXIMUM = (4095,4095)
85 | OBJECT = IMAGE_HEADER
86 | INTERCHANGE_FORMAT = ASCII
87 | HEADER_TYPE = VICAR2
88 | BYTES = 4144
89 | RECORDS = 1
90 | ^DESCRIPTION = "../../label/vicar2.txt"
91 | END_OBJECT = IMAGE_HEADER
92 | OBJECT = TELEMETRY_TABLE
93 | INTERCHANGE_FORMAT = BINARY
94 | ROWS = 1
95 | COLUMNS = 2
96 | ROW_BYTES = 2072
97 | ^STRUCTURE = "../../label/tlmtab.fmt"
98 | OBJECT = COLUMN
99 | NAME = NULL_PADDING
100 | DATA_TYPE = MSB_UNSIGNED_INTEGER
101 | START_BYTE = 61
102 | BYTES = 2011
103 | END_OBJECT = COLUMN
104 | END_OBJECT = TELEMETRY_TABLE
105 | OBJECT = LINE_PREFIX_TABLE
106 | INTERCHANGE_FORMAT = BINARY
107 | ROWS = 1024
108 | COLUMNS = 10
109 | ROW_BYTES = 24
110 | ROW_SUFFIX_BYTES = 2048
111 | ^LINE_PREFIX_STRUCTURE = "../../label/prefix3.fmt"
112 | END_OBJECT = LINE_PREFIX_TABLE
113 | OBJECT = IMAGE
114 | LINES = 1024
115 | LINE_SAMPLES = 1024
116 | SAMPLE_BITS = 16
117 | SAMPLE_TYPE = SUN_INTEGER
118 | LINE_PREFIX_BYTES = 24
119 | END_OBJECT = IMAGE
120 | END
121 |
--------------------------------------------------------------------------------
/src/main/resources/examples/PDS4_ATM_TABLE_CHAR.TAB:
--------------------------------------------------------------------------------
1 | 91,0.088, 91.06951,5.156,0.42,0.42656,125.547152, 4.7691,15300.0,"SS091A990R6M1.IMG"
2 | 91,0.088, 91.06951,5.156,0.42,0.42656,125.547152, 4.7691,15300.0,"SS091A990R6M1.IMG"
3 | 91,0.088, 91.07029,5.155,0.42,0.42652,125.550546, 4.7692,15300.0,"SS091A990R6M1.IMG"
4 | 91,0.089, 91.07105,5.155,0.42,0.42657,125.550344, 4.7692,15300.0,"SS091A990R6M1.IMG"
5 | 91,0.377, 91.35854,2.225,0.72,0.56432,147.854445, 19.1305, 4314.6,"SS091AA00R6M1.IMG"
6 | 91,0.377, 91.35919,2.010,0.64,0.51506,197.022189, 18.7507, 4314.6,"SS091AA00R6M1.IMG"
7 | 91,0.378, 91.35978,1.928,0.70,0.52962,199.881316, 21.4121, 4314.6,"SS091AA00R6M1.IMG"
8 | 91,0.379, 91.36042,1.366,1.71,0.71758,185.232248,180.0000, 4314.6,"SS091AA00R6M1.IMG"
9 | 91,0.379, 91.36104,1.494,1.47,0.69841,179.932613, 81.2461, 4314.6,"SS091AA00R6M1.IMG"
10 | 91,0.380, 91.36165,1.908,0.83,0.58457,171.164927, 25.8445, 4314.6,"SS091AA00R6M1.IMG"
11 | 91,0.380, 91.36229,1.677,1.13,0.65682,169.245035, 42.4206, 4314.6,"SS091AA00R6M1.IMG"
12 | 91,0.381, 91.36289,1.720,0.87,0.57686,237.047264, 30.6785, 4314.6,"SS091AA00R6M1.IMG"
13 | 91,0.382, 91.36415,2.645,0.49,0.40090,323.650451, 10.7665, 4314.6,"SS091AA00R6M1.IMG"
14 | 91,0.383, 91.36477,4.752,0.40,0.39856, 10.696469, 4.8413, 4314.6,"SS091AA00R6M1.IMG"
15 | 91,0.384, 91.36543,4.521,0.40,0.39494,358.661558, 5.1823, 4314.6,"SS091AA00R6M1.IMG"
16 | 91,0.384, 91.36604,3.427,0.39,0.38187, 13.809568, 6.6027, 4314.6,"SS091AA00R6M1.IMG"
17 | 91,0.385, 91.36663,3.239,0.39,0.37979, 4.907225, 7.0238, 4314.6,"SS091AA00R6M1.IMG"
18 | 91,0.385, 91.36729,2.826,0.42,0.39259,317.423490, 8.7466, 4314.6,"SS091AA00R6M1.IMG"
19 | 91,0.386, 91.36792,2.840,0.42,0.39058,321.608207, 8.6859, 4314.6,"SS091AA00R6M1.IMG"
20 | 91,0.387, 91.36851,3.124,0.39,0.37922,339.039685, 7.3389, 4314.6,"SS091AA00R6M1.IMG"
21 | 91,0.387, 91.36917,3.317,0.39,0.37703,352.720837, 6.7690, 4314.6,"SS091AA00R6M1.IMG"
22 | 151,0.229,151.20464,2.980,0.43,0.40324,293.965171, 8.3952, 7140.0,"SS1520900R6M1.IMG"
23 | 151,0.230,151.20527,3.072,0.46,0.41565,268.822094, 8.6166, 7140.0,"SS1520900R6M1.IMG"
24 |
--------------------------------------------------------------------------------
/src/main/resources/examples/PDS4_ATM_TABLE_CHAR_MULTIPLE.TAB:
--------------------------------------------------------------------------------
1 | 91,0.088, 91.06951,5.156,0.42,0.42656,125.547152, 4.7691,15300.0,"SS091A990R6M1.IMG"
2 | 91,0.088, 91.06951,5.156,0.42,0.42656,125.547152, 4.7691,15300.0,"SS091A990R6M1.IMG"
3 | 91,0.088, 91.07029,5.155,0.42,0.42652,125.550546, 4.7692,15300.0,"SS091A990R6M1.IMG"
4 | 91,0.089, 91.07105,5.155,0.42,0.42657,125.550344, 4.7692,15300.0,"SS091A990R6M1.IMG"
5 | 91,0.377, 91.35854,2.225,0.72,0.56432,147.854445, 19.1305, 4314.6,"SS091AA00R6M1.IMG"
6 | 91,0.377, 91.35919,2.010,0.64,0.51506,197.022189, 18.7507, 4314.6,"SS091AA00R6M1.IMG"
7 | 91,0.378, 91.35978,1.928,0.70,0.52962,199.881316, 21.4121, 4314.6,"SS091AA00R6M1.IMG"
8 | 91,0.379, 91.36042,1.366,1.71,0.71758,185.232248,180.0000, 4314.6,"SS091AA00R6M1.IMG"
9 | 91,0.379, 91.36104,1.494,1.47,0.69841,179.932613, 81.2461, 4314.6,"SS091AA00R6M1.IMG"
10 | 91,0.380, 91.36165,1.908,0.83,0.58457,171.164927, 25.8445, 4314.6,"SS091AA00R6M1.IMG"
11 | 91,0.380, 91.36229,1.677,1.13,0.65682,169.245035, 42.4206, 4314.6,"SS091AA00R6M1.IMG"
12 | 91,0.381, 91.36289,1.720,0.87,0.57686,237.047264, 30.6785, 4314.6,"SS091AA00R6M1.IMG"
13 | 91,0.382, 91.36415,2.645,0.49,0.40090,323.650451, 10.7665, 4314.6,"SS091AA00R6M1.IMG"
14 | 91,0.383, 91.36477,4.752,0.40,0.39856, 10.696469, 4.8413, 4314.6,"SS091AA00R6M1.IMG"
15 | 91,0.384, 91.36543,4.521,0.40,0.39494,358.661558, 5.1823, 4314.6,"SS091AA00R6M1.IMG"
16 | 91,0.384, 91.36604,3.427,0.39,0.38187, 13.809568, 6.6027, 4314.6,"SS091AA00R6M1.IMG"
17 | 91,0.385, 91.36663,3.239,0.39,0.37979, 4.907225, 7.0238, 4314.6,"SS091AA00R6M1.IMG"
18 | 91,0.385, 91.36729,2.826,0.42,0.39259,317.423490, 8.7466, 4314.6,"SS091AA00R6M1.IMG"
19 | 91,0.386, 91.36792,2.840,0.42,0.39058,321.608207, 8.6859, 4314.6,"SS091AA00R6M1.IMG"
20 | 91,0.387, 91.36851,3.124,0.39,0.37922,339.039685, 7.3389, 4314.6,"SS091AA00R6M1.IMG"
21 | 91,0.387, 91.36917,3.317,0.39,0.37703,352.720837, 6.7690, 4314.6,"SS091AA00R6M1.IMG"
22 | 151,0.229,151.20464,2.980,0.43,0.40324,293.965171, 8.3952, 7140.0,"SS1520900R6M1.IMG"
23 | 151,0.230,151.20527,3.072,0.46,0.41565,268.822094, 8.6166, 7140.0,"SS1520900R6M1.IMG"
24 |
25 | 10,0.088, 91.06951,5.156,0.42,0.42656,125.547152, 4.7691,15300.0,"BLAH.IMG "
26 | 10,0.088, 91.06951,5.156,0.42,0.42656,125.547152, 4.7691,15300.0,"BLAH.IMG "
27 | 10,0.088, 91.07029,5.155,0.42,0.42652,125.550546, 4.7692,15300.0,"BLAH.IMG "
28 | 10,0.089, 91.07105,5.155,0.42,0.42657,125.550344, 4.7692,15300.0,"BLAH.IMG "
29 | 10,0.377, 91.35854,2.225,0.72,0.56432,147.854445, 19.1305, 4314.6,"BLAH.IMG "
30 | 10,0.377, 91.35919,2.010,0.64,0.51506,197.022189, 18.7507, 4314.6,"SS091AA00R6M1.IMG"
31 | 10,0.378, 91.35978,1.928,0.70,0.52962,199.881316, 21.4121, 4314.6,"SS091AA00R6M1.IMG"
32 | 10,0.379, 91.36042,1.366,1.71,0.71758,185.232248,180.0000, 4314.6,"SS091AA00R6M1.IMG"
33 | 10,0.379, 91.36104,1.494,1.47,0.69841,179.932613, 81.2461, 4314.6,"SS091AA00R6M1.IMG"
34 | 10,0.380, 91.36165,1.908,0.83,0.58457,171.164927, 25.8445, 4314.6,"SS091AA00R6M1.IMG"
35 | 10,0.380, 91.36229,1.677,1.13,0.65682,169.245035, 42.4206, 4314.6,"SS091AA00R6M1.IMG"
36 | 10,0.381, 91.36289,1.720,0.87,0.57686,237.047264, 30.6785, 4314.6,"SS091AA00R6M1.IMG"
37 | 10,0.382, 91.36415,2.645,0.49,0.40090,323.650451, 10.7665, 4314.6,"SS091AA00R6M1.IMG"
38 | 10,0.383, 91.36477,4.752,0.40,0.39856, 10.696469, 4.8413, 4314.6,"SS091AA00R6M1.IMG"
39 | 10,0.384, 91.36543,4.521,0.40,0.39494,358.661558, 5.1823, 4314.6,"SS091AA00R6M1.IMG"
40 | 10,0.384, 91.36604,3.427,0.39,0.38187, 13.809568, 6.6027, 4314.6,"SS091AA00R6M1.IMG"
41 | 10,0.385, 91.36663,3.239,0.39,0.37979, 4.907225, 7.0238, 4314.6,"SS091AA00R6M1.IMG"
42 | 10,0.385, 91.36729,2.826,0.42,0.39259,317.423490, 8.7466, 4314.6,"SS091AA00R6M1.IMG"
43 | 10,0.386, 91.36792,2.840,0.42,0.39058,321.608207, 8.6859, 4314.6,"SS091AA00R6M1.IMG"
44 | 10,0.387, 91.36851,3.124,0.39,0.37922,339.039685, 7.3389, 4314.6,"SS091AA00R6M1.IMG"
45 | 10,0.387, 91.36917,3.317,0.39,0.37703,352.720837, 6.7690, 4314.6,"SS091AA00R6M1.IMG"
46 | 110,0.229,151.20464,2.980,0.43,0.40324,293.965171, 8.3952, 7140.0,"SS1520900R6M1.IMG"
47 | 110,0.230,151.20527,3.072,0.46,0.41565,268.822094, 8.6166, 7140.0,"SS1520900R6M1.IMG"
48 |
--------------------------------------------------------------------------------
/src/main/resources/examples/PDS4_TABLE_DELIMITED.csv:
--------------------------------------------------------------------------------
1 | 27,127,117,19,6,5,5,7,2,3,1,2,6
2 | 28,128,57,34,49,35,30,29,19,8,19,24,11216
3 | 29,202,139,101,96,94,74,71,73,66,70,77,10343
4 |
--------------------------------------------------------------------------------
/src/main/resources/examples/PWR02176_01.LBL:
--------------------------------------------------------------------------------
1 | PDS_VERSION_ID = PDS3
2 | INTERCHANGE_FORMAT = ASCII
3 | RECORD_TYPE = FIXED_LENGTH
4 | RECORD_BYTES = 195
5 | FILE_RECORDS = 269
6 | DATA_SET_ID = "ODY-M-MAR-2-REDR-RAW-DATA-V1.0"
7 | MISSION_PHASE_NAME = "MAPPING"
8 | SPACECRAFT_NAME = "2001 MARS ODYSSEY"
9 | START_TIME = 2002-06-24T00:23:01.21Z
10 | STOP_TIME = 2002-06-25T00:40:01.72Z
11 | SPACECRAFT_CLOCK_START_COUNT = "UNK"
12 | SPACECRAFT_CLOCK_STOP_COUNT = "UNK"
13 | INSTRUMENT_ID = "MARIE"
14 | INSTRUMENT_NAME = "MARTIAN RADIATION ENVIRONMENT EXPERIMENT"
15 | PRODUCT_ID = "PWR02176_01.TAB"
16 | PRODUCT_TYPE = "ANCILLARY"
17 | ORIGINAL_PRODUCT_ID = "N/A"
18 | FILE_NAME = "PWR02176_01.TAB"
19 | NOTE = "Ancillary data from the MARIE
20 | instrument on the 2001 Mars Odyssey spacecraft. Power
21 | consumption of circuits in the instrument."
22 | DESCRIPTION = "
23 | This data file contains ancillary data from the Martian Radiation
24 | Environment Experiment (MARIE) on the 2001 Mars Odyssey
25 | spacecraft. MARIE is a radiation measuring instrument that
26 | counts particles in the energy range 15 MeV to 500 MeV/n.
27 |
28 | This data file contains values of the power consumption by
29 | various circuits on the MARIE instrument, in ASCII format.
30 | The file consists of an attached header (1 line) followed by
31 | a data table. In each row of the data table, the first two
32 | columns represent UTC time, the third column represents Julian
33 | time, and the rest of the columns contain values of the
34 | power consumption. Further information on the columns is
35 | provided in the STRUCTURE file referenced below."
36 |
37 | ^TABLE_HEADER = ("PWR02176_01.TAB", 1)
38 | ^TABLE = ("PWR02176_01.TAB", 2)
39 | OBJECT = TABLE_HEADER
40 | BYTES = 'N/A'
41 | RECORDS = 1
42 | PUBLICATION_DATE = 2002-01-10
43 | NOTE = "The first record of this
44 | file makes up the header. The header includes column headings
45 | for the data table. This line ends with a carriage return/
46 | line feed terminator ()."
47 | END_OBJECT = TABLE_HEADER
48 |
49 | OBJECT = TABLE
50 | NAME = POWER
51 | INTERCHANGE_FORMAT = ASCII
52 | ROWS = 268
53 | ROW_BYTES = 195
54 | COLUMNS = 11
55 | DESCRIPTION = "
56 | The power consumption readings are stored in an ASCII table
57 | structure that immediately follows the attached header. This file
58 | contains rows of time-tagged sets of power values."
59 | ^STRUCTURE = "PWR.FMT"
60 | END_OBJECT = TABLE
61 |
62 | END
63 |
--------------------------------------------------------------------------------
/src/main/resources/examples/b0090_p243401_01_01v02.qub:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NASA-PDS/transform/c9e8ed9c5d2139ae78318db77ba1c63d4cef3dd6/src/main/resources/examples/b0090_p243401_01_01v02.qub
--------------------------------------------------------------------------------
/src/main/resources/examples/ba03s183.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
6 |
10 |
11 | urn:nasa:pds:data:clem1-l-u-5-dim-basemap-v1.0:ba03s183
12 | 1.0
13 | clem1-l-u-5-dim-basemap-v1.0 ba03s183
14 | 1.9.0.0
15 | Product_Observational
16 |
17 |
18 | 2018-06-06
19 | 1.0
20 | Auto generated PDS4 product label created by the Transform Tool.
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 | deep space program science experiment
31 | Mission
32 |
33 | urn:nasa:pds:investigation.deep.space.program.science.experiment
34 | data_to_investigation
35 |
36 |
37 |
38 |
39 | ultraviolet/visible camera
40 | Instrument
41 |
42 |
43 |
44 | moon
45 | Planet
46 |
47 |
48 |
49 |
50 | BA03S183.IMG
51 |
52 |
53 | ARRAY_0
54 | 7376
55 | 2
56 | Last Index Fastest
57 |
58 | SignedMSB2
59 |
60 |
61 | Line
62 | 2127
63 | 1
64 |
65 |
66 | Sample
67 | 1844
68 | 2
69 |
70 |
71 |
72 |
73 |
--------------------------------------------------------------------------------
/src/main/resources/examples/ff01.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
6 |
10 |
11 | urn:nasa:pds:data:mgn-v-rdrs-5-midr-full-res-v1.0:ff01.lbl
12 | 1.0
13 | mgn-v-rdrs-5-midr-full-res-v1.0
14 | 1.10.0.0
15 | Product_Observational
16 |
17 |
18 | 2018-06-11
19 | 1.0
20 | Auto generated PDS4 product label created by the Transform Tool.
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 | primary_mission
31 | Mission
32 |
33 | urn:nasa:pds:investigation.primary_mission
34 | data_to_investigation
35 |
36 |
37 |
38 |
39 | radar system
40 | Instrument
41 |
42 |
43 |
44 | venus
45 | Planet
46 |
47 |
48 |
49 |
50 | FF01.IMG
51 |
52 |
53 | FF01-Array_2D_Image
54 | 2048
55 | 2
56 | Last Index Fastest
57 |
58 | UnsignedByte
59 |
60 |
61 | Line
62 | 1024
63 | 1
64 |
65 |
66 | Sample
67 | 1024
68 | 2
69 |
70 |
71 |
72 |
73 |
--------------------------------------------------------------------------------
/src/main/resources/examples/i943630r.raw:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NASA-PDS/transform/c9e8ed9c5d2139ae78318db77ba1c63d4cef3dd6/src/main/resources/examples/i943630r.raw
--------------------------------------------------------------------------------
/src/main/resources/external-programs/external-programs.properties:
--------------------------------------------------------------------------------
1 | # Copyright © 2019, California Institute of Technology ("Caltech").
2 | # U.S. Government sponsorship acknowledged.
3 | #
4 | # All rights reserved.
5 | #
6 | # Redistribution and use in source and binary forms, with or without
7 | # modification, are permitted provided that the following conditions are met:
8 | #
9 | # • Redistributions of source code must retain the above copyright notice,
10 | # this list of conditions and the following disclaimer.
11 | # • Redistributions must reproduce the above copyright notice, this list of
12 | # conditions and the following disclaimer in the documentation and/or other
13 | # materials provided with the distribution.
14 | # • Neither the name of Caltech nor its operating division, the Jet Propulsion
15 | # Laboratory, nor the names of its contributors may be used to endorse or
16 | # promote products derived from this software without specific prior written
17 | # permission.
18 | #
19 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
23 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 | # POSSIBILITY OF SUCH DAMAGE.
30 | pds=python/coiss_data_to_pds4.py
--------------------------------------------------------------------------------
/src/main/resources/external-programs/python/coiss_data_to_pds4.py:
--------------------------------------------------------------------------------
1 | # encoding: utf-8
2 | #
3 | # Copyright © 2019, California Institute of Technology ("Caltech").
4 | # U.S. Government sponsorship acknowledged.
5 | #
6 | # All rights reserved.
7 | #
8 | # Redistribution and use in source and binary forms, with or without
9 | # modification, are permitted provided that the following conditions are met:
10 | #
11 | # • Redistributions of source code must retain the above copyright notice,
12 | # this list of conditions and the following disclaimer.
13 | # • Redistributions must reproduce the above copyright notice, this list of
14 | # conditions and the following disclaimer in the documentation and/or other
15 | # materials provided with the distribution.
16 | # • Neither the name of Caltech nor its operating division, the Jet Propulsion
17 | # Laboratory, nor the names of its contributors may be used to endorse or
18 | # promote products derived from this software without specific prior written
19 | # permission.
20 | #
21 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
25 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 | # POSSIBILITY OF SUCH DAMAGE.
32 | ################################################################################
33 | # coiss_data_to_pds4.py
34 | #
35 | # Sample program to read the contents of a Cassini ISS data file and save the
36 | # data objects as unformatted binary files.
37 | #
38 | # Mark Showalter, PDS Rings Node, SETI Institute, 8/24/13
39 | ################################################################################
40 |
41 | import sys
42 | sys.dont_write_bytecode=True
43 | import numpy as np
44 | from vicar import VicarImage
45 |
46 | def coiss_data_to_pds4(vicar_filepath, array_filepath,
47 | prefix_filepath=None,
48 | binary_header_filepath=None):
49 |
50 | """Reads a raw Cassini image file in VICAR format and saves its contents
51 | in one or more data files.
52 |
53 | Input:
54 | vicar_filepath full file path to the raw Cassini image file.
55 | array_filepath path to the output file for the data array.
56 | prefix_filepath path to the output file for the prefix bytes of
57 | the array; use None to suppress the writing of this
58 | file.
59 | binary_header_filepath
60 | path to the output file for the binary header; use
61 | None to suppress the writing of this file.
62 |
63 | Return: A Python dictionary containing the VICAR keywords
64 | and their values.
65 |
66 | Note: Output files are written using the same binary format and byte order
67 | as the original VICAR file.
68 | """
69 |
70 | vicar_object = VicarImage.from_file(vicar_filepath)
71 |
72 | vicar_object.data_2d.tofile(array_filepath)
73 |
74 | if prefix_filepath is not None:
75 | vicar_object.prefix_2d.tofile(prefix_filepath)
76 |
77 | if binary_header_filepath is not None:
78 | vicar_object.binary_header.tofile(binary_header_filepath)
79 |
80 | return vicar_object.as_dict()
81 |
82 | if __name__ == "__main__":
83 | inputfile = sys.argv[1]
84 | outputfile = sys.argv[2]
85 | result = coiss_data_to_pds4(inputfile, outputfile)
86 |
87 | ################################################################################
88 |
--------------------------------------------------------------------------------
/src/main/resources/stylesheets/html-structure-only.xsl:
--------------------------------------------------------------------------------
1 |
2 |
33 |
35 |
36 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
65 | |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
--------------------------------------------------------------------------------
/src/main/resources/stylesheets/html.xsl:
--------------------------------------------------------------------------------
1 |
2 |
33 |
35 |
36 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
64 | |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 | |
75 |
76 |
77 |
78 |
79 |
80 |
81 | |
82 |
83 |
84 |
85 |
--------------------------------------------------------------------------------
/src/main/resources/stylesheets/pvl.xsl:
--------------------------------------------------------------------------------
1 |
2 |
33 |
35 |
36 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 | BEGIN_OBJECT =
48 |
49 |
50 |
51 |
52 |
53 | END_OBJECT = ;
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 | =
62 |
63 | "";
64 |
65 | ;
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
--------------------------------------------------------------------------------
/src/main/resources/stylesheets/stylesheets.properties:
--------------------------------------------------------------------------------
1 | # Copyright © 2019, California Institute of Technology ("Caltech").
2 | # U.S. Government sponsorship acknowledged.
3 | #
4 | # All rights reserved.
5 | #
6 | # Redistribution and use in source and binary forms, with or without
7 | # modification, are permitted provided that the following conditions are met:
8 | #
9 | # • Redistributions of source code must retain the above copyright notice,
10 | # this list of conditions and the following disclaimer.
11 | # • Redistributions must reproduce the above copyright notice, this list of
12 | # conditions and the following disclaimer in the documentation and/or other
13 | # materials provided with the distribution.
14 | # • Neither the name of Caltech nor its operating division, the Jet Propulsion
15 | # Laboratory, nor the names of its contributors may be used to endorse or
16 | # promote products derived from this software without specific prior written
17 | # permission.
18 | #
19 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
23 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 | # POSSIBILITY OF SUCH DAMAGE.
30 |
31 | pvl=pvl.xsl
32 | html=html.xsl
33 | html-structure-only=html-structure-only.xsl
34 |
--------------------------------------------------------------------------------
/src/main/resources/transform.properties:
--------------------------------------------------------------------------------
1 | # Copyright © 2019, California Institute of Technology ("Caltech").
2 | # U.S. Government sponsorship acknowledged.
3 | #
4 | # All rights reserved.
5 | #
6 | # Redistribution and use in source and binary forms, with or without
7 | # modification, are permitted provided that the following conditions are met:
8 | #
9 | # • Redistributions of source code must retain the above copyright notice,
10 | # this list of conditions and the following disclaimer.
11 | # • Redistributions must reproduce the above copyright notice, this list of
12 | # conditions and the following disclaimer in the documentation and/or other
13 | # materials provided with the distribution.
14 | # • Neither the name of Caltech nor its operating division, the Jet Propulsion
15 | # Laboratory, nor the names of its contributors may be used to endorse or
16 | # promote products derived from this software without specific prior written
17 | # permission.
18 | #
19 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
23 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 | # POSSIBILITY OF SUCH DAMAGE.
30 |
31 | transform.name=${project.name}
32 | transform.version=Version ${project.version}
33 | transform.date=${buildNumber}
34 | transform.copyright=\nCopyright 2019, by the California Institute of Technology ("Caltech").\nAll rights reserved.
35 |
--------------------------------------------------------------------------------
/src/site/resources/images/pds4_logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NASA-PDS/transform/c9e8ed9c5d2139ae78318db77ba1c63d4cef3dd6/src/site/resources/images/pds4_logo.png
--------------------------------------------------------------------------------
/src/site/resources/images/windows_panel.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NASA-PDS/transform/c9e8ed9c5d2139ae78318db77ba1c63d4cef3dd6/src/site/resources/images/windows_panel.jpg
--------------------------------------------------------------------------------
/src/site/resources/images/windows_search.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NASA-PDS/transform/c9e8ed9c5d2139ae78318db77ba1c63d4cef3dd6/src/site/resources/images/windows_search.jpg
--------------------------------------------------------------------------------
/src/site/site.xml:
--------------------------------------------------------------------------------
1 |
2 |
33 |
34 |
35 | org.apache.maven.skins
36 | maven-fluido-skin
37 | 2.0.0-M6
38 |
39 |
40 |
41 |
42 | nasa-pds/${project.artifactId}
43 | right
44 | black
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
55 |
56 |
57 |
60 |
61 |
62 | PDS Transform Tool
63 | https://pds.nasa.gov
64 |
65 |
66 |
67 |
68 |
69 |
70 |
75 |
76 |
80 |
81 |
85 |
86 |
87 |
88 |
89 |
--------------------------------------------------------------------------------
/src/site/xdoc/index.xml:
--------------------------------------------------------------------------------
1 |
2 |
33 |
34 |
35 | About Transform Tool
36 | Michael Cayanan
37 | Sean Hardman
38 |
39 |
40 |
41 |
42 | The Transform Tool project contains software for transforming PDS3 and PDS4 product labels and product data into other formats. The following transformations are currently supported:
43 |
44 |
45 |
46 | Input | Output | Comment |
47 | PDS3 Image (8-bit Image) (16-bit Image) | GIF, JPEG, JPEG 2000, PNG, PNM, TIFF | Known limitations: - Does not yet support product labels referencing multiple images, including explicit FILE objects - Does not yet support Qube objects |
48 | PDS3 Table | CSV PDS4 Labeled Table | The resulting product label contains the minimum set of elements in order to be compliant with the PDS4 standards. |
49 | PDS3 Label | PDS4 Label | The resulting product label contains the minimum set of elements in order to be compliant with the PDS4 standards. |
50 | PDS4 Table (Table_Binary) (Table_Character) (Table_Delimited) | CSV PDS4 Labeled Table | The resulting product label contains the minimum set of elements in order to be compliant with the PDS4 standards. |
51 | PDS4 2D Image (Array_2D_Image) | GIF, JPEG, JPEG 2000, PNG, PNM, TIFF, FITS | |
52 | PDS4 3D Image (Array_3D_Image) | GIF, JPEG, JPEG 2000, PNG, PNM, TIFF | The current implementation defaults to transforming band 1. Will add support for selecting bands in the future. |
53 | PDS4 3D Hyper-Spectral Cube (Array_3D_Spectrum) | GIF, JPEG, JPEG 2000, PNG, PNM, TIFF | The current implementation defaults to transforming band 1. Will add support for selecting bands in the future. |
54 | PDS4 Label | PDS3 Label | The resulting product label contains the minimum set of elements in order to be compliant with the PDS3 standards.
Known limitations: - Does not yet support a PDS4 label containing multiple File_Area_Observational elements. - Does not yet support a PDS4 label containing Group_Field_Delimited elements - Does not yet support a PDS4 label describing a Qube data object |
55 | PDS4 Label | Object Description Language (ODL) Parameter Value Language (PVL) HTML | |
56 |
57 |
58 | Please send comments, change requests and bug reports to the PDS Operator at pds_operator@jpl.nasa.gov.
59 |
60 |
61 |
62 |
63 |
--------------------------------------------------------------------------------
/src/site/xdoc/install/index-win.xml.vm:
--------------------------------------------------------------------------------
1 |
2 |
33 |
34 |
35 | Windows System Properties
36 | Michael Cayanan
37 | Sean Hardman
38 |
39 |
40 |
41 |
42 | The required environment variables for the ${project.artifactId} package can also be set through the Windows system properties panel. The instructions provided below were based off of a Windows 7 machine. Windows 8 and 10 users should be able to use these steps as well to modify their environment.
43 |
44 |
45 | The Path environment variable can be modified as follows:
46 |
47 |
48 |
49 | - Click on the Windows icon on the bottom left. In the search text box, type in edit system environment variables. A search result called Edit the system environment variables should appear under the Control Panel area as follows:
50 |
51 |
52 |
53 |
54 |
55 |
56 | - Click on Edit the system environment variables and in there, click on the Environment Variables button. At this point, you should now see a window like the one below:
57 |
58 |
59 |
60 |
61 |
62 |
63 | - Highlight the Path variable in the System Variables list and select the Edit button.
64 |
65 | - Append to the current contents of the variable, the path to the bin directory within ${project.artifactId} package. Separate the package path from the current contents of the variable with a semicolon.
66 |
67 | - Select the OK button when you are finished editing the Path variable, then select the OK button on the Environment Variables window to apply the changes.
68 |
69 |
70 |
71 | New environment variables (e.g., JAVA_HOME) may also be specified in the system properties panel. Instead of selecting the Edit button from the System Variables list, select the New button and enter the variable name and value. Select the OK button when you are finished, then select the OK button on the Environment Variables window to apply the changes.
72 |
73 |
74 | Note: If you already have a DOS window open, you will need to close and re-open the window for the environment variable changes to take effect.
75 |
76 |
77 |
78 |
79 |
--------------------------------------------------------------------------------