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

TST: mask warning in test_cf_from_numpy_dtypes #783

Merged
merged 1 commit into from
Mar 1, 2021
Merged
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
27 changes: 14 additions & 13 deletions test/crs/test_crs_cf.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,19 +51,20 @@ def test_cf_from_numpy_dtypes():
"latitude_of_projection_origin": numpy.int(45),
Copy link
Contributor

@jorisvandenbossche jorisvandenbossche Mar 1, 2021

Choose a reason for hiding this comment

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

Instead of masking the warning, I think the "proper" fix is to change the above to numpy.int64(45) (because the above usage of np.int() is deprecated)

Copy link
Member Author

Choose a reason for hiding this comment

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

The warning masked is the one about losing CRS information raised by pyproj when exporting to PROJ string. That is good to know about the numpy deprecation. If you have a moment to raise an issue or open a quick PR with the fix, that would be helpful. Thanks 👍

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, yes, stupid me, of course the warning you were fixing wasn't coming from here, since the pytest.warns is only below ;)

(but indeed, something to fix anyway, and I see you already did a PR!)

}
crs = CRS.from_cf(cf)
assert crs.to_dict() == {
"datum": "WGS84",
"lat_0": 45,
"lat_1": 60,
"lat_2": 30,
"lon_0": 0,
"no_defs": None,
"proj": "lcc",
"type": "crs",
"units": "m",
"x_0": 0,
"y_0": 0,
}
with pytest.warns(UserWarning):
assert crs.to_dict() == {
"datum": "WGS84",
"lat_0": 45,
"lat_1": 60,
"lat_2": 30,
"lon_0": 0,
"no_defs": None,
"proj": "lcc",
"type": "crs",
"units": "m",
"x_0": 0,
"y_0": 0,
}


def test_to_cf_transverse_mercator():
Expand Down