Skip to content

Check that the parent is not already provided in the netcdf file #282

Description

@mortenwh

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:

  1. The parent is already added - and we get repetition of the same related_dataset line. This needs to be avoided.
  2. 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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions