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

Fix ancillary variable loading when anc var is already loaded #341

Merged
merged 1 commit into from
Jun 28, 2018
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
3 changes: 3 additions & 0 deletions satpy/readers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,9 @@ def get_key(key, key_container, num_results=1, best=True,
elif isinstance(key, (str, six.text_type)):
# ID should act as a query (see wl comment above)
key = DatasetID(name=key, modifiers=None)
elif not isinstance(key, DatasetID):
raise ValueError("Expected 'DatasetID', str, or number dict key, "
"not {}".format(str(type(key))))

res = filter_keys_by_dataset_id(key, key_container)

Expand Down
5 changes: 4 additions & 1 deletion satpy/readers/yaml_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -755,7 +755,10 @@ def _load_ancillary_variables(self, datasets):
for dataset in datasets.values():
new_vars = []
for av_id in dataset.attrs.get('ancillary_variables', []):
new_vars.append(datasets.get(av_id, av_id))
if isinstance(av_id, DatasetID):
new_vars.append(datasets[av_id])
else:
new_vars.append(av_id)
dataset.attrs['ancillary_variables'] = new_vars

def load(self, dataset_keys, previous_datasets=None):
Expand Down