It seems we're not checking if a parent is already added from the nc-file. See:
|
self.metadata['related_dataset'] = self.get_related_dataset( |
|
mmd_yaml.pop('related_dataset'), ncin) |
|
# Add parent from function kwarg |
|
if parent is not None: |
|
if ":" not in parent: |
|
raise ValueError("parent must be composed as <%s>:<uuid>" % |
|
self.ACDD_NAMING_AUTH) |
|
nauth, uuid = parent.split(":") |
|
if nauth not in self.VALID_NAMING_AUTHORITIES: |
|
raise ValueError('%s ACDD attribute %s is not valid' % |
|
(self.ACDD_NAMING_AUTH, nauth)) |
|
if not Nc_to_mmd.is_valid_uuid(uuid): |
|
raise ValueError("UUID part of the parent ID is not valid") |
|
self.metadata['related_dataset'].append({ |
|
'id': parent, |
|
'relation_type': "parent", |
|
}) |
Two cases may appear:
- The parent is already added - and we get repetition of the same
related_dataset line. This needs to be avoided.
- A parent is already added from the nc-file but it is not the same as the one provided in the kwargs. In this case, we should issue a warning.
It seems we're not checking if a parent is already added from the nc-file. See:
py-mmd-tools/py_mmd_tools/nc_to_mmd.py
Lines 1534 to 1550 in 81d67c7
Two cases may appear:
related_datasetline. This needs to be avoided.