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

warning generated despite correct syntax #1481

Closed
wkitlasten opened this issue Aug 4, 2022 · 2 comments · Fixed by #1489
Closed

warning generated despite correct syntax #1481

wkitlasten opened this issue Aug 4, 2022 · 2 comments · Fixed by #1489
Assignees

Comments

@wkitlasten
Copy link
Contributor

gwf.modelgrid.intersect() generates the warning below, despite the correct syntax. Is this intentional? (I'd hate to "fix" it if it ain't broken) It wouldn't be a big deal except I am calling it from a lambda function in a large dataframe and it blows all other information off the screen!!

obs['ij'] = obs[[x_field, y_field]]. apply(lambda x: gwf.modelgrid.intersect(x[0], x[1], z=None, local=False, forgive=True), axis=1)

structuredgrid.py:777: UserWarning: The interface 'intersect(self, x, y, local=False, forgive=False)' has been deprecated. Use the intersect(self, x, y, z=None, local=False, forgive=False) interface instead.

@jlarsen-usgs
Copy link
Contributor

@wkitlasten

The warning is intentional to make users aware of the interface change. I'm planning on updating this to either throw an error if the interface is called incorrectly, or only warn the first time it is called.

I'll put in a PR to change this behavior. For the time being, you can supress those messages by adding a warnings filter to the top of your script, like so.

import warnings
warnings.simplefilter("ignore", UserWarning)

@jdhughes-usgs
Copy link
Contributor

@jlarsen-usgs I guess the confusing thing to me is the Warning seems to tell users to do just what they did (at least in Wes' case)

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 a pull request may close this issue.

3 participants