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 composites not being recorded with desired resolution in deptree #836

Merged
merged 5 commits into from
Jul 2, 2019

Conversation

mraspaud
Copy link
Member

@mraspaud mraspaud commented Jun 28, 2019

When a given resolution is requested for loading some composites, the resolution wasn't included in the DatasetIDs recorded in the dependency tree for these composites.

This PR fixes this through making sure the fully filtered dataset ID is created and recorded in the dependency tree.

  • Tests added and test suite added to parent suite
  • Tests passed
  • Passes flake8 satpy

@mraspaud mraspaud added bug component:dep_tree Dependency tree and dataset loading labels Jun 28, 2019
@mraspaud mraspaud requested a review from djhoese as a code owner June 28, 2019 12:58
@mraspaud mraspaud self-assigned this Jun 28, 2019
@codecov
Copy link

codecov bot commented Jun 28, 2019

Codecov Report

Merging #836 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #836      +/-   ##
==========================================
+ Coverage   83.97%   83.98%   +<.01%     
==========================================
  Files         167      167              
  Lines       24567    24586      +19     
==========================================
+ Hits        20631    20649      +18     
- Misses       3936     3937       +1
Impacted Files Coverage Δ
satpy/tests/test_scene.py 99.48% <100%> (ø) ⬆️
satpy/node.py 94.65% <100%> (-0.14%) ⬇️
satpy/dataset.py 90.55% <100%> (+0.98%) ⬆️
satpy/readers/avhrr_l1b_gaclac.py 90.14% <0%> (-1.41%) ⬇️
satpy/readers/abi_l1b.py 94.44% <0%> (-0.05%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5def3dc...3e91628. Read the comment docs.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.03%) to 83.982% when pulling 8c0cd52 on mraspaud:fix-dep-tree-resolution into 28b2628 on pytroll:master.

@coveralls
Copy link

coveralls commented Jun 28, 2019

Coverage Status

Coverage increased (+0.005%) to 83.983% when pulling 3e91628 on mraspaud:fix-dep-tree-resolution into 5def3dc on pytroll:master.

@@ -463,7 +455,8 @@ def _find_dependencies(self, dataset_key, **dfilter):

# 0 check if the *exact* dataset is already loaded
try:
node = self.getitem(dataset_key)
dsid = create_filtered_dsid(dataset_key, **dfilter)
node = self.getitem(dsid)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure about this. Checking if the exact dataset is meant to see if an exact DatasetID exists. I don't think it should be modified by dfilter parameters.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, it's the point of my resolution PRs that the requested dataset with the correct resolution should be returned. Or is that not the point of the resolution keyword in Scene.load ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean that passing resolution and a name should be equivalent to passing a full fledged DatasetID right ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but if something gets to _find_dependencies and passes a DatasetID that means that's the exact ID that should be used. However, I can see that if that DatasetID (in composite loading, etc) hasn't been updated with the dfilter then it would likely return the wrong resolution.

The problem, from what I can tell, with the way it is implemented now is that if an exact DatasetID is provided to _find_dependencies it's resolution (and other parameters) are overwritten with dfilter even if they were specified exactly by the composite config. Another case would be a user specifying scn.load([DatasetID(name='X', resolution=500), 'Y', 'Z'], resolution=1000), what should happen then?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, I could fix it so that the create_filtered_dsid gives the priority to the existing DatasetID instance if it is filled with other things than None. Would that work ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think so

Copy link
Member

@djhoese djhoese left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. I'm willing to merge it and give it a shot.

@mraspaud mraspaud force-pushed the fix-dep-tree-resolution branch from 2f6afa7 to 3e91628 Compare July 2, 2019 12:53
@mraspaud mraspaud merged commit 44239a0 into pytroll:master Jul 2, 2019
@mraspaud mraspaud deleted the fix-dep-tree-resolution branch July 2, 2019 13:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug component:dep_tree Dependency tree and dataset loading
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants