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

rasterio backend: added nodatavals attribute #1740

Merged
merged 8 commits into from
Jan 19, 2018
Merged

rasterio backend: added nodatavals attribute #1740

merged 8 commits into from
Jan 19, 2018

Conversation

snowman2
Copy link
Contributor

@snowman2 snowman2 commented Nov 23, 2017

Connected with issue #1736

@snowman2 snowman2 changed the title WIP: Added nodatavals attribute Added nodatavals attribute Dec 9, 2017
@shoyer
Copy link
Member

shoyer commented Jan 11, 2018

@fmaussion can you take a look?

Copy link
Member

@fmaussion fmaussion left a comment

Choose a reason for hiding this comment

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

Thanks! I only have a suggestion for the what's new entry, and also it would be good to add a simple test to ensure that we don't break this later on.

see e.g. https://github.com/pydata/xarray/blob/master/xarray/tests/test_backends.py#L2139-L2203

@@ -20,6 +20,7 @@ v0.10.1 (unreleased)

Enhancements
~~~~~~~~~~~~
- Added nodatavals attribute to dataset when using open_rasterio.
Copy link
Member

Choose a reason for hiding this comment

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

If you want you can credit yourself here. If you do so it would be good also to link to the original issue (see examples below) and to rename dataset do DataArray

@@ -1871,11 +1871,39 @@ def test_serialization(self):

# Write it to a netcdf and read again (roundtrip)
with xr.open_rasterio(tmp_file) as rioda:
np.testing.assert_array_equal(rioda.attrs['nodatavals'],
[np.nan, np.nan, 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.

Can you put this test in another test? For example in test_utm below

@fmaussion fmaussion changed the title Added nodatavals attribute rasterio backend: added nodatavals attribute Jan 18, 2018
Copy link
Member

@fmaussion fmaussion left a comment

Choose a reason for hiding this comment

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

Thanks @snowman2 ! The tests still have a unnecessary boilerplate code and decorators, but if @shoyer agrees I would like to merge this now and do a refactoring of the tests in a subsequent PR.

@shoyer
Copy link
Member

shoyer commented Jan 18, 2018

@fmaussion This looks good to me, please merge at your leisure

@snowman2
Copy link
Contributor Author

Indeed, it would be nice to refactor the tests to use pytest functions so we can use fixtures and the pytest.mark.parametrize to reduce duplication.

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