Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
mortenwh opened this issue Nov 1, 2023 · 0 comments
Open

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

mortenwh opened this issue Nov 1, 2023 · 0 comments

Comments

@mortenwh
Copy link
Collaborator

mortenwh commented Nov 1, 2023

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant