Skip to content

Commit

Permalink
Refactor handling of SMAP instrument information
Browse files Browse the repository at this point in the history
Current SMAP instrument metadata is not compatible with the expected
UMM-G mappings. This results in CMR flagging the UMM-G metadata as
invalid. To work around this issue, instrument information is not
carried over to UMM-G. This commit is a cleanup of the first pass
on addressing this issue. Handling of instrument information is now
conditional based on whether any useful data was extracted from the
source metadata so that the functionality remains available should
future SMAP metadata adhere to published UMM-G mappings.
  • Loading branch information
colecu committed Feb 9, 2024
1 parent b061c21 commit 2517582
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -838,12 +838,22 @@ private void readIsoSmapMetadataFile(String s3Location, Document doc, XPath xpat

Source source = new Source();
source.setSourceShortName(xpath.evaluate(IsoSmapXPath.PLATFORM, doc));
Sensor sensor = new Sensor();
sensor.setSensorShortName(xpath.evaluate(IsoSmapXPath.INSTRUMENT, doc));

DatasetSource datasetSource = new DatasetSource();
DatasetSource.DatasetSourcePK datasetSourcePK = new DatasetSource.DatasetSourcePK();
datasetSourcePK.setSource(source);
datasetSource.setDatasetSourcePK(datasetSourcePK);

datasetSourcePK.setSource(source);

if (!sensor.getSensorShortName().trim().isEmpty()) {
datasetSourcePK.setSensor(sensor);
}

datasetSource.setDatasetSourcePK(datasetSourcePK);

dataset.add(datasetSource);

NodeList inputGranules = (NodeList) xpath.evaluate(IsoSmapXPath.GRANULE_INPUT, doc, XPathConstants.NODESET);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -883,11 +883,13 @@ private JSONArray exportPlatform() {
JSONObject platform = new JSONObject();
platform.put("ShortName", datasetSource.getDatasetSourcePK().getSource().getSourceShortName());

JSONArray instruments = new JSONArray();
JSONObject instrument = new JSONObject();
instrument.put("ShortName", datasetSource.getDatasetSourcePK().getSensor().getSensorShortName());
instruments.add(instrument);
platform.put("Instruments", instruments);
if (!datasetSource.getDatasetSourcePK().getSensor().getSensorShortName().trim().isEmpty()) {
JSONArray instruments = new JSONArray();
JSONObject instrument = new JSONObject();
instrument.put("ShortName", datasetSource.getDatasetSourcePK().getSensor().getSensorShortName());
instruments.add(instrument);
platform.put("Instruments", instruments);
}

platforms.add(platform);
}
Expand Down

0 comments on commit 2517582

Please sign in to comment.