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 rasterio example in docs #1881

Merged
merged 2 commits into from
Feb 2, 2018
Merged

Fix rasterio example in docs #1881

merged 2 commits into from
Feb 2, 2018

Conversation

fmaussion
Copy link
Member

#1796 introduced a bug in the doc gallery. This PR reverts the code to the previous greyscale example and adds a new case using imshow (the use case is different, as I tried to explain in the descriptions).

I also took care of #1789 (comment) : the docs should now build even when rasterio is not installed.

cc @Zac-HD , @shoyer

@jhamman
Copy link
Member

jhamman commented Feb 2, 2018

LGTM. Thanks @fmaussion. I had noticed this was broken but hadn't figured out why yet.

Copy link
Member

@shoyer shoyer left a comment

Choose a reason for hiding this comment

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

thanks!

da = xr.open_rasterio('RGB.byte.tif')

# Normalize the image
da = da / 255
Copy link
Member

Choose a reason for hiding this comment

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

I don't think this is strictly necessary with RGB support in imshow, though I suppose it doesn't hurt.

Copy link
Member Author

Choose a reason for hiding this comment

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

That's unfortunately necessary, see #1880


# Plot on a map
ax = plt.subplot(projection=crs)
da.plot.imshow(ax=ax, transform=crs)
Copy link
Member

Choose a reason for hiding this comment

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

For pedagogical purposes, it might be nice to explicitly write rga='band'.

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, will do

@shoyer
Copy link
Member

shoyer commented Feb 2, 2018 via email

@fmaussion fmaussion merged commit e9b98d0 into pydata:master Feb 2, 2018
@fmaussion
Copy link
Member Author

Thanks!

@jhamman jhamman mentioned this pull request Feb 13, 2018
4 tasks
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

Successfully merging this pull request may close these issues.

3 participants