@@ -124,7 +124,7 @@ public void setDatasetValues(String shortName, String version, Boolean rangeIs36
124
124
}
125
125
126
126
if (boundingBox != null ) {
127
- setGranuleBoundingBox (
127
+ addGranuleBoundingBox (
128
128
(Double ) boundingBox .get ("latMax" ),
129
129
(Double ) boundingBox .get ("latMin" ),
130
130
(Double ) boundingBox .get ("lonMax" ),
@@ -204,7 +204,7 @@ public void readCommonMetadataFile(String file, String s3Location) throws IOExce
204
204
// setGranuleFileSizeAndChecksum function
205
205
206
206
//lat/lon
207
- setGranuleBoundingBox (
207
+ addGranuleBoundingBox (
208
208
(Double )((JSONObject )metadata .get ("boundingBox" )).get ("NorthernLatitude" ),
209
209
(Double )((JSONObject )metadata .get ("boundingBox" )).get ("SouthernLatitude" ),
210
210
(Double )((JSONObject )metadata .get ("boundingBox" )).get ("EasternLongitude" ),
@@ -420,7 +420,7 @@ private void parseRequiredFields(Document doc, XPath xpath, IsoType iso) throws
420
420
421
421
public IsoGranule readIsoMendsMetadataFile (String s3Location , Document doc , XPath xpath ) throws XPathExpressionException {
422
422
if (MENDsISOXmlUtiils .extractXPathValueSwallowException (doc , xpath , IsoMendsXPath .NORTH_BOUNDING_COORDINATE , "IsoMendsXPath.NORTH_BOUNDING_COORDINATE" )!= "" ) {
423
- setGranuleBoundingBox (
423
+ addGranuleBoundingBox (
424
424
Double .parseDouble (MENDsISOXmlUtiils .extractXPathValueSwallowException (doc , xpath , IsoMendsXPath .NORTH_BOUNDING_COORDINATE , "IsoMendsXPath.NORTH_BOUNDING_COORDINATE" )),
425
425
Double .parseDouble (MENDsISOXmlUtiils .extractXPathValueSwallowException (doc , xpath , IsoMendsXPath .SOUTH_BOUNDING_COORDINATE , "IsoMendsXPath.SOUTH_BOUNDING_COORDINATE" )),
426
426
Double .parseDouble (MENDsISOXmlUtiils .extractXPathValueSwallowException (doc , xpath , IsoMendsXPath .EAST_BOUNDING_COORDINATE , "IsoMendsXPath.EAST_BOUNDING_COORDINATE" )),
@@ -810,19 +810,34 @@ private void readIsoSmapMetadataFile(String s3Location, Document doc, XPath xpat
810
810
811
811
String boundingBoxInformation = xpath .evaluate (IsoSmapXPath .BOUNDING_BOX , doc );
812
812
if (!boundingBoxInformation .trim ().isEmpty ()) {
813
- String north = xpath .evaluate (IsoSmapXPath .NORTH_BOUNDING_COORDINATE , doc );
814
- String south = xpath . evaluate ( IsoSmapXPath . SOUTH_BOUNDING_COORDINATE , doc );
815
- String east = xpath . evaluate ( IsoSmapXPath . EAST_BOUNDING_COORDINATE , doc );
816
- String west = xpath . evaluate ( IsoSmapXPath . WEST_BOUNDING_COORDINATE , doc );
813
+ NodeList boundingBoxes = ( NodeList ) xpath .evaluate (IsoSmapXPath .BOUNDING_BOX , doc , XPathConstants . NODESET );
814
+ AdapterLogger . LogInfo ( "Found " + boundingBoxes . getLength () + " bounding box nodes." );
815
+ for ( int i = 0 ; i < boundingBoxes . getLength (); i ++) {
816
+ Node boundingBoxNode = boundingBoxes . item ( i );
817
817
818
- try {
819
- setGranuleBoundingBox (Double .parseDouble (north ),
820
- Double .parseDouble (south ),
821
- Double .parseDouble (east ),
822
- Double .parseDouble (west ));
823
- } catch (NullPointerException | NumberFormatException exception ) {
824
- throw new IllegalArgumentException (String .format ("Failed to parse bbox N=%s S=%s E=%s W=%s" ,
825
- north , south , east , west ), exception );
818
+ Element boundingBox = (Element )boundingBoxNode ;
819
+
820
+ Element northBound = (Element )(boundingBox .getElementsByTagName ("gmd:northBoundLatitude" ).item (0 ));
821
+ String north = northBound .getElementsByTagName ("gco:Decimal" ).item (0 ).getTextContent ();
822
+
823
+ Element southBound = (Element )(boundingBox .getElementsByTagName ("gmd:southBoundLatitude" ).item (0 ));
824
+ String south = southBound .getElementsByTagName ("gco:Decimal" ).item (0 ).getTextContent ();
825
+
826
+ Element eastBound = (Element )(boundingBox .getElementsByTagName ("gmd:eastBoundLongitude" ).item (0 ));
827
+ String east = eastBound .getElementsByTagName ("gco:Decimal" ).item (0 ).getTextContent ();
828
+
829
+ Element westBound = (Element )(boundingBox .getElementsByTagName ("gmd:westBoundLongitude" ).item (0 ));
830
+ String west = westBound .getElementsByTagName ("gco:Decimal" ).item (0 ).getTextContent ();
831
+
832
+ try {
833
+ addGranuleBoundingBox (Double .parseDouble (north ),
834
+ Double .parseDouble (south ),
835
+ Double .parseDouble (east ),
836
+ Double .parseDouble (west ));
837
+ } catch (NullPointerException | NumberFormatException exception ) {
838
+ throw new IllegalArgumentException (String .format ("Failed to parse bbox N=%s S=%s E=%s W=%s" ,
839
+ north , south , east , west ), exception );
840
+ }
826
841
}
827
842
}
828
843
@@ -881,7 +896,7 @@ public void readSwotArchiveXmlFile(String file) throws ParserConfigurationExcept
881
896
882
897
granule = createSwotArchiveGranule (doc , xpath );
883
898
// No spatial extent exists for SWOT L0 data so set as global
884
- setGranuleBoundingBox (90.0 , -90.0 , 180.0 , -180.0 );
899
+ addGranuleBoundingBox (90.0 , -90.0 , 180.0 , -180.0 );
885
900
}
886
901
887
902
/**
@@ -917,7 +932,7 @@ public void readSwotCalValXmlFile(String file) throws ParserConfigurationExcepti
917
932
}
918
933
919
934
try {
920
- setGranuleBoundingBox (Double .parseDouble (north ),
935
+ addGranuleBoundingBox (Double .parseDouble (north ),
921
936
Double .parseDouble (south ),
922
937
Double .parseDouble (east ),
923
938
Double .parseDouble (west ));
@@ -1086,12 +1101,10 @@ private TrackType createTrackType(Integer iCycle, Integer iPass) {
1086
1101
return trackType ;
1087
1102
}
1088
1103
1089
- private void setGranuleBoundingBox (double north , double south , double east , double west ) {
1104
+ private void addGranuleBoundingBox (double north , double south , double east , double west ) {
1090
1105
AdapterLogger .LogInfo ("set bounding box 4 coordinates for UMMGranule object" );
1091
- granule .setBbxNorthernLatitude (north );
1092
- granule .setBbxSouthernLatitude (south );
1093
- granule .setBbxEasternLongitude (east );
1094
- granule .setBbxWesternLongitude (west );
1106
+ BoundingBox boundingBox = new BoundingBox (north , south , east , west );
1107
+ granule .addBoundingBox (boundingBox );
1095
1108
}
1096
1109
1097
1110
public JSONObject createJson ()
0 commit comments