Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions pyQuARC/code/schema_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,13 +136,14 @@ def _build_errors(error_log, paths):
# For DIF, because the namespace is specified in the metadata file, lxml library
# provides field name concatenated with the namespace,
# the following 3 lines of code removes the namespace
namespaces = re.findall("(\{http[^}]*\})", line)

namespaces = re.findall(r"(\{http[^}]*\})", line)
for namespace in namespaces:
line = line.replace(namespace, "")
field_name = re.search("Element\s'(.*)':", line)[1]
field_name = re.search(r"Element\s'(.*)':", line)[1]
field_paths = [abs_path for abs_path in paths if field_name in abs_path]
field_name = field_paths[0] if len(field_paths) == 1 else field_name
message = re.search("Element\s'.+':\s(\[.*\])?(.*)", line)[2].strip()
message = re.search(r"Element\s'.+':\s(\[.*\])?(.*)", line)[2].strip()
errors.setdefault(field_name, {})["schema"] = {
"message": [f"Error: {message}"],
"valid": False,
Expand Down
2 changes: 1 addition & 1 deletion pyQuARC/schemas/check_messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
"message": "",
"url": "https://wiki.earthdata.nasa.gov/display/CMR/Processing+Level, https://www.earthdata.nasa.gov/engage/open-data-services-and-software/data-information-policy/data-levels"
},
"remediation": "Recommend changing the Id to match one of the EOSDIS Data Processing Levels, if applicable: [0, 1A, 1B, 1C, 2, 2A, 2B, 3, 3A, 4]"
"remediation": "Recommend changing the Id to match one of the EOSDIS Data Processing Levels, if applicable: [Not Provided, 0, 1, 1A, 1B, 1C, 1T, 2, 2A, 2B, 2G, 2P, 3, 3A 4, NA]"
},
"processing_level_description_length_check": {
"failure": "The provided description is less than 50 characters and therefore may be lacking in contextual information.",
Expand Down
1 change: 0 additions & 1 deletion pyQuARC/schemas/check_messages_override.json
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
{}

7 changes: 6 additions & 1 deletion pyQuARC/schemas/rule_mapping.json
Original file line number Diff line number Diff line change
Expand Up @@ -994,15 +994,20 @@
"data": [
[
"0",
"1",
"1A",
"1B",
"1C",
"2",
"2A",
"2B",
"2G",
"2P",
"3",
"3A",
"4"
"4",
"NA",
"Not provided"
]
],
"severity": "warning",
Expand Down
4 changes: 2 additions & 2 deletions tests/test_downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ class TestDownloader:
def setup_method(self):
self.concept_ids = {
"collection": {
"real": "C1000000010-CDDIS", #C1339230297-GES_DISC
"real": "C1000000010-CDDIS",
"dummy": "C123456-LPDAAC_ECS",
},
"granule": {
"real": "G1001434969-CDDIS", #G1370895082-GES_DISC
"real": "G1001434969-CDDIS",
"dummy": "G1000000002-CMR_PROV",
},
"invalid": "asdfasdf",
Expand Down