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 get_area_slices #117

Merged
merged 17 commits into from
May 13, 2018
Merged

Fix get_area_slices #117

merged 17 commits into from
May 13, 2018

Conversation

mraspaud
Copy link
Member

@mraspaud mraspaud commented May 7, 2018

  • Tests added
  • Tests passed
  • Passes git diff origin/develop **/*py | flake8 --diff

This fixes pytroll/satpy#218

@mraspaud mraspaud self-assigned this May 7, 2018
@mraspaud mraspaud added the bug label May 7, 2018
@coveralls
Copy link

coveralls commented May 7, 2018

Coverage Status

Coverage increased (+1.3%) to 87.398% when pulling 4fbda06 on fix-get-area-slices into 89f52c9 on master.

@mraspaud mraspaud requested review from djhoese and pnuu May 8, 2018 10:36
@codecov
Copy link

codecov bot commented May 8, 2018

Codecov Report

❗ No coverage uploaded for pull request base (master@89f52c9). Click here to learn what that means.
The diff coverage is 96.56%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master     #117   +/-   ##
=========================================
  Coverage          ?   87.25%           
=========================================
  Files             ?       34           
  Lines             ?     5510           
  Branches          ?        0           
=========================================
  Hits              ?     4808           
  Misses            ?      702           
  Partials          ?        0
Impacted Files Coverage Δ
pyresample/test/utils.py 62.31% <0%> (ø)
pyresample/spherical_geometry.py 93.36% <100%> (ø)
pyresample/test/__init__.py 95.23% <100%> (ø)
pyresample/test/test_geometry.py 97.03% <100%> (ø)
pyresample/geometry.py 75.59% <88%> (ø)
pyresample/boundary.py 94.44% <94.44%> (ø)
pyresample/spherical.py 96.71% <96.71%> (ø)
pyresample/test/test_spherical.py 99.51% <99.51%> (ø)

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 89f52c9...4fbda06. Read the comment docs.

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.

I had one question that I commented inline. Another one though: how much work would it be to throw the boundary stuff in to pyresample in this PR?

logger.debug('Projections for data and slice areas are'
' identical: %s', area_to_cover.proj_dict['proj'])
# Get xy coordinates
llx, lly, urx, ury = area_to_cover.area_extent
x, y = self.get_xy_from_proj_coords([llx, urx], [lly, ury])

return slice(x[0], x[1] + 1), slice(y[1], y[0] + 1)
xstart = 0 if x[0] is np.ma.masked else x[0]
Copy link
Member

Choose a reason for hiding this comment

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

Are 'old style' area definitions the only ones that return a masked value? What do dask arrays return?

Copy link
Member Author

Choose a reason for hiding this comment

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

self.get_xy_from_proj_coords doesn't produce a dask array, but I suppose that would return np.nan ?

Copy link
Member

Choose a reason for hiding this comment

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

Time to test I guess 😉

Copy link
Member

Choose a reason for hiding this comment

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

Or is it not necessary since you are passing the extents which are scalars?

Copy link
Member Author

Choose a reason for hiding this comment

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

yes, exactly

setup.py Outdated
@@ -33,7 +33,7 @@
'quicklook': ['matplotlib', 'cartopy', 'pillow'],
'dask': ['dask>=0.16.1']}

test_requires = []
test_requires = ['pytroll-schedule']
Copy link
Member

Choose a reason for hiding this comment

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

Should this maybe be added as an extra requirement too?

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'm looking at integrating the boundary stuff really soon, so I don't know

rows = 1
cols = 1
target_y = target_y[data_slice[0]]
target_x = target_x[data_slice[1]]
Copy link
Member

Choose a reason for hiding this comment

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

Wow this whole block of code got a lot smaller.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, but the downside is that the arange is called before the slicing is performed

Copy link
Member

Choose a reason for hiding this comment

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

Couldn't this be da.arange?

Copy link
Member Author

Choose a reason for hiding this comment

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

Then we would need to put dask as a requirement.

Copy link
Member

Choose a reason for hiding this comment

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

Ah sorry, github's diff tool was making it look like this was the _dask method.

@mraspaud mraspaud merged commit 29a8906 into master May 13, 2018
@mraspaud mraspaud deleted the fix-get-area-slices branch May 13, 2018 18:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Resampling to EPSG:4326 produces unexpected results
3 participants