Skip to content

Commit 5b9fea3

Browse files
authored
Merge pull request #278 from eosdis-nasa/EDPUB-1653-metadata-mapper-updates
EDPUB-653: Metadata mapper updates
2 parents 385383d + 415b929 commit 5b9fea3

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

src/nodejs/lambda-handlers/submission/metadata-mapper.js

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,15 @@ const mapEDPubToUmmc = async (formData) => {
208208

209209
// Strip nulls and empty objects
210210
tmpArr = tmpArr.filter((value) => Object.keys(stripNullsFromObject(value)).length !== 0);
211-
spatialExtent.SpatialExtent.HorizontalSpatialDomain.Geometry.BoundingRectangles = spatialExtent.SpatialExtent.HorizontalSpatialDomain.Geometry.BoundingRectangles.concat(tmpArr);
211+
212+
if (tmpArr.length > 0) {
213+
// If coordinate array not empty, populate metadata object
214+
spatialExtent.SpatialExtent.HorizontalSpatialDomain.Geometry.BoundingRectangles = spatialExtent.SpatialExtent.HorizontalSpatialDomain.Geometry.BoundingRectangles.concat(tmpArr);
215+
} else {
216+
// Otherwise, remove empty metadata field
217+
Object.keys(spatialExtent).forEach((key) => { delete spatialExtent[key]; });
218+
}
219+
212220
// Delete spatial extent information
213221
['west', 'north', 'east', 'south'].forEach((direction) => {
214222
[1, 2, 3].forEach((directionSet) => {
@@ -630,14 +638,6 @@ const mapEDPubToUmmc = async (formData) => {
630638
]
631639
};
632640

633-
const metadataSpecification = {
634-
MetadataSpecification: {
635-
URL: 'https://cdn.earthdata.nasa.gov/umm/collection/v1.17.0',
636-
Name: 'UMM-C',
637-
Version: '1.17.0'
638-
}
639-
};
640-
641641
// Added to capture DAAC specific questions
642642
Object.keys(formData).forEach((extra) => {
643643
additionalAttributes.push({
@@ -662,8 +662,7 @@ const mapEDPubToUmmc = async (formData) => {
662662
...(temporalExtent || {}),
663663
...(spatialExtent || {}),
664664
...(additionalAttributes ? { AdditionalAttributes: additionalAttributes } : {}),
665-
...(metadataDates || {}),
666-
...(metadataSpecification || {})
665+
...(metadataDates || {})
667666
}));
668667
};
669668

0 commit comments

Comments
 (0)