From f7bb3f704c244e92204e3fa3816e46a4414ecd95 Mon Sep 17 00:00:00 2001 From: sxu123 Date: Fri, 31 Mar 2023 11:08:00 -0400 Subject: [PATCH] Cmr 9013 ingest 500 error (#1877) * CMR-9013: Fixing 500 error for invalid orbit granule metadata. * CMR-9013: Added test. * CMR-9013: Modified the test description. --------- Co-authored-by: siwei xu --- .../resources/iso-samples/CMR-5226-coll.xml | 1208 +++++++++++++++++ .../ingest/granule_ingest_test.clj | 19 +- .../src/cmr/umm_spec/validation/granule.clj | 5 +- 3 files changed, 1228 insertions(+), 4 deletions(-) create mode 100644 system-int-test/resources/iso-samples/CMR-5226-coll.xml diff --git a/system-int-test/resources/iso-samples/CMR-5226-coll.xml b/system-int-test/resources/iso-samples/CMR-5226-coll.xml new file mode 100644 index 0000000000..ba432ca7da --- /dev/null +++ b/system-int-test/resources/iso-samples/CMR-5226-coll.xml @@ -0,0 +1,1208 @@ + + + + ATLAS/ICESat-2 L2A Normalized Relative Backscatter Profiles V000 + + + eng; usa + + + UTF8 + + + series + + + ATLAS/ICESat-2 L2A Normalized Relative Backscatter Profiles + + + + + NSIDC User Services + + + NASA National Snow and Ice Data Center Distributed Active Archive Center + + + + + + + 1 303 492 6199 + + + 1 303 492 2468 + + + + + + + National Snow and Ice Data Center + + + CIRES, 449 UCB + + + University of Colorado + + + Boulder + + + CO + + + 80309-0449 + + + USA + + + nsidc@nsidc.org + + + + + + + http://nsidc.org/daac/index.html + + + + + + + + + custodian + + + + + 2018-04-09 + + + ISO 19115-2 Geographic Information 2009 Metadata + + + ISO 19115-2:2009 + + + + + + + CARTESIAN + + + + + + + + + + + Metadata Create Date + + + Create Date + + + Date + + + 2018-04-09 + + + + + + + + + + + + + + Metadata Update Date + + + Update Date + + + Date + + + 2018-04-09 + + + + + + + + + + + + + + ATLAS/ICESat-2 L2A Normalized Relative Backscatter Profiles V000 + + + + + 2018-04-09 + + + publication + + + + + 000 + + + 2018-04-09 + + + + + ATL04 + + + + + + + + + doi:10.5067/ATLAS/ATL04.001 + + + + A Digital Object Identifier (DOI) + + + + + + + Thomas A Neumann + + + NASA Goddard Space Flight Center + + + + + + + 1 301 614 5923 + + + + + + + Greenbelt + + + MD + + + 20770 + + + USA + + + thomas.neumann@nasa.gov + + + + + + + http://nsidc.org + + + + + + + + + principalInvestigator + + + + + + + Thorsten Markus + + + Goddard Space Flight Center + + + + + + + 1 301 614 5882 + + + + + + + NASA/Goddard Space Flight Center + + + Instrumentation Sciences Branch + + + Code 614.6 + + + Greenbelt + + + MD + + + 20771 + + + USA + + + thorsten.markus@nasa.gov + + + + + + + http://nsidc.org + + + + + + + + + principalInvestigator + + + + + + + National Snow and Ice Data Center + + + + + + + Boulder + + + Colorado + + + + USA + + + + + + + http://nsidc.org + + + + + + + + + publisher + + + + + + + ATL04 contains along-track atmosphere backscatter data at full instrument resolution. The product includes full 532 nm (14 km) uncalibrated attenuated backscatter profiles at 25 times per second for vertical bins of approximately 30 meters. Includes calibration coefficient values derived from data within the polar regions. + + + Scientific Research + + + underdevelopment + + + + + NSIDC User Services + + + National Snow and Ice Data Center + + + + + + + 1 303 492 6199 + + + 1 303 492 2468 + + + + + + + CIRES, 449 UCB + + + University of Colorado + + + Boulder + + + CO + + + 80309-0449 + + + USA + + + nsidc@nsidc.org + + + + + + + http://nsidc.org + + + + + + + + + pointOfContact + + + + + + + Thomas A Neumann + + + NASA Goddard Space Flight Center + + + + + + + 1 301 614 5923 + + + + + + + Greenbelt + + + MD + + + 20770 + + + USA + + + thomas.neumann@nasa.gov + + + + + + + http://nsidc.org + + + + + + + + + principalInvestigator + + + + + + + Thorsten Markus + + + Goddard Space Flight Center + + + + + + + 1 301 614 5882 + + + + + + + NASA/Goddard Space Flight Center + + + Instrumentation Sciences Branch + + + Code 614.6 + + + Greenbelt + + + MD + + + 20771 + + + USA + + + thorsten.markus@nasa.gov + + + + + + + http://nsidc.org + + + + + + + + + principalInvestigator + + + + + + + NSIDC User Services + + + NASA National Snow and Ice Data Center Distributed Active Archive Center + + + + + + + 1 303 492 6199 + + + 1 303 492 2468 + + + + + + + National Snow and Ice Data Center + + + CIRES, 449 UCB + + + University of Colorado + + + Boulder + + + CO + + + 80309-0449 + + + USA + + + nsidc@nsidc.org + + + + + + + http://nsidc.org/daac/index.html + + + + + + + + + custodian + + + + + + + NSIDC User Services + + + NASA National Snow and Ice Data Center Distributed Active Archive Center + + + + + + + 1 303 492 6199 + + + 1 303 492 2468 + + + + + + + National Snow and Ice Data Center + + + CIRES, 449 UCB + + + University of Colorado + + + Boulder + + + CO + + + 80309-0449 + + + USA + + + nsidc@nsidc.org + + + + + + + http://nsidc.org/daac/index.html + + + + + + + + + distributor + + + + + + + NASA/GSFC/EOS/ESDIS + + + + + + + http://earthdata.nasa.gov/ + + + + + + + + + processor + + + + + + + NASA/GSFC/EOS/ESDIS + + + + + + + http://earthdata.nasa.gov/ + + + + + + + + + originator + + + + + + + asNeeded + + + dataset + + + series + + + attribute + + + + + NSIDC User Services + + + National Snow and Ice Data Center + + + + + + + 1 303 492 6199 + + + 1 303 492 2468 + + + + + + + CIRES, 449 UCB + + + University of Colorado + + + Boulder + + + CO + + + 80309-0449 + + + USA + + + nsidc@nsidc.org + + + + + + + http://nsidc.org + + + + + + + + + pointOfContact + + + + + + + + + EARTH SCIENCE > Spectral/Engineering > Lidar > Lidar Backscatter + + + theme + + + + + NASA / GCMD Science Keywords + + + + + 2008-02-05 + + + revision + + + + + + + + + + + ICESAT-2 > Ice, Cloud, and land Elevation Satellite-2 + + + platform + + + + + NASA / GCMD Platform Keywords + + + + + 2016-06-10 + + + revision + + + + + + + + + + + ATLAS > Advanced Topographic Laser Altimeter System + + + instrument + + + + + NASA / GCMD Instrument Keywords + + + + + 2016-06-01 + + + revision + + + + + + + + + + + otherRestrictions + + + otherRestrictions + + + Access Constraints : none + + + Use Constraints : none + + + + + eng; usa + + + UTF8 + + + climatologyMeteorologyAtmosphere + + + + + SpatialCoverageType=HORIZONTAL, SpatialGranuleSpatialRepresentation=CARTESIAN, TemporalRangeType=Continuous Range, TimeType=UTC + + + + + -180.0 + + + 180.0 + + + -90.0 + + + 90.0 + + + + + + + + + SwathWidth: 36.0 Period: 96.8 InclinationAngle: 92.0 NumberOfOrbits: 1.0 StartCircularLatitude: 0.0 + + + gov.nasa.esdis.umm.orbitparameters + + + OrbitParameters + + + + + + + + + + 2015-10-27T00:00:00.000Z + + + + + + + + + + + Level 2A + + + + + + + + + + + + + JPEG + + + + HTTPS + + + + + + + HDF5 + + + + HTTPS + + + + + + + + + NSIDC User Services + + + NASA National Snow and Ice Data Center Distributed Active Archive Center + + + + + + + 1 303 492 6199 + + + 1 303 492 2468 + + + + + + + National Snow and Ice Data Center + + + CIRES, 449 UCB + + + University of Colorado + + + Boulder + + + CO + + + 80309-0449 + + + USA + + + nsidc@nsidc.org + + + + + + + http://nsidc.org/daac/index.html + + + + + + + + + distributor + + + + + + + + + https://dx.doi.org/10.5067/ATLAS/ATL04.001 + + + Documentation + + + Documentation explaining the data and how it was processed. + + + information + + + + + + + + + + + + + + + series + + + + + + + + + + + + NASA/GSFC/EOS/ESDIS + + + + + + + http://earthdata.nasa.gov/ + + + + + + + + + processor + + + + + + + + + + + + + + + processingInformation + + + identifier_product_doi + + + Digital object identifier that uniquely identifies this data product + + + STRING + + + + + + + + + processingInformation + + + identifier_product_doi_authority + + + URL of the digital object identifier resolving authority + + + STRING + + + + + + + + + + + + + + + + + + + + + + + ATLAS + + + + Advanced Topographic Laser Altimeter System + + + + + instrument + + + + + + + ATLAS + + + + Advanced Topographic Laser Altimeter System + + + + + + + + + + + + + + ICESAT-2 + + + gov.nasa.esdis.umm.platformshortname + + + Ice, Cloud, and land Elevation Satellite-2 + + + + + Earth Observation Satellites + + + + + + + diff --git a/system-int-test/test/cmr/system_int_test/ingest/granule_ingest_test.clj b/system-int-test/test/cmr/system_int_test/ingest/granule_ingest_test.clj index ae78d3e5b3..6d23db287f 100644 --- a/system-int-test/test/cmr/system_int_test/ingest/granule_ingest_test.clj +++ b/system-int-test/test/cmr/system_int_test/ingest/granule_ingest_test.clj @@ -474,15 +474,30 @@ (ingest/concept :granule "PROV1" "foo" :iso-smap valid-gran-metadata))] (is (= 201 status)))))) -(deftest CMR-5226-invalid-iso-smap-geographic-description-test +(deftest CMR-9013-invalid-orbit-data (let [coll-metadata (-> "iso-samples/CMR-5129-coll.xml" io/resource slurp) invalid-gran-metadata (-> "iso-samples/invalid-CMR-5226-gran.xml" io/resource slurp)] - (testing "Invalid geographic description " + (testing "Invalid Geometries for ORBIT granule." (ingest/ingest-concept (ingest/concept :collection "PROV1" "foo" :iso19115 coll-metadata)) (let [{:keys [status errors]} (ingest/ingest-concept (ingest/concept :granule "PROV1" "foo" :iso-smap invalid-gran-metadata))] (is (= 422 status)) + (is (= [{:errors ["[Geometries] cannot be set when the parent collection's GranuleSpatialRepresentation is ORBIT"], + :path ["SpatialCoverage" "Geometries"]} + {:errors ["[Orbit] must be provided when the parent collection's GranuleSpatialRepresentation is ORBIT"], + :path ["SpatialCoverage" "Orbit"]}] + errors)))))) + +(deftest CMR-5226-invalid-iso-smap-geographic-description-test + (let [coll-metadata (-> "iso-samples/CMR-5226-coll.xml" io/resource slurp) + invalid-gran-metadata (-> "iso-samples/invalid-CMR-5226-gran.xml" io/resource slurp)] + (testing "Invalid geographic description " + (ingest/ingest-concept + (ingest/concept :collection "PROV1" "foo" :iso19115 coll-metadata)) + (let [{:keys [status errors]} (ingest/ingest-concept + (ingest/concept :granule "PROV1" "foo" :iso-smap invalid-gran-metadata))] + (is (= 422 status)) (is (= ["Spatial validation error: Unsupported gmd:description inside gmd:EX_GeographicDescription - The supported ones are: OrbitParameters and OrbitCalculatedSpatialDomains"] (:errors (first errors)))))))) (deftest CMR-5216-invalid-iso-smap-ocsd-values-test diff --git a/umm-spec-lib/src/cmr/umm_spec/validation/granule.clj b/umm-spec-lib/src/cmr/umm_spec/validation/granule.clj index e7882fe72b..8050915268 100644 --- a/umm-spec-lib/src/cmr/umm_spec/validation/granule.clj +++ b/umm-spec-lib/src/cmr/umm_spec/validation/granule.clj @@ -75,9 +75,10 @@ spatial-representation (spatial-extent->granule-spatial-representation (:parent spatial-coverage))] (assoc spatial-coverage :geometries - ;; If the granule spatial representation is :no-spatial, then just ignore the geometries. + ;; If the granule spatial representation is :no-spatial or :orbit, then just ignore the geometries. (when (and spatial-representation - (not= :no-spatial spatial-representation)) + (not= :no-spatial spatial-representation) + (not= :orbit spatial-representation)) (map #(umm-s/set-coordinate-system spatial-representation %) geometries)))))