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
Remove deprecated features #763
Conversation
I'll finish this one up late tonight or tomorrow. I think the only feature remaining is affine vs. transform. |
…ing deprecating src.affine. Switch src.affine to src.transform in tests
…kwargs['transform']) and update some docstrings.
@perrygeo @sgillies @brendan-ward This isn't quite finished but it's kinda big so some 👀 now wouldn't hurt. I need to add add a section to the migration guide about |
import rasterio | ||
import rasterio.env | ||
|
||
with rasterio.env.Env(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this different than with rasterio.Env()
? Or are they equivalent. In #760 everything was set to just rasterio.Env()
and wanted to make sure that is right.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@eseglem Yes, you are correct - thanks for catching this.
@geowurster this is looking good. I do wonder if we shouldn't have a period of time where we still use In addition to Per your question above, I think raising a |
@geowurster The migration guide is fantastic and will help all of us out tremendously. Links to issues is a nice touch 👌 I have written oodles of code that uses the
So pragmatically we need to keep To the other issues, 👍 to all of @brendan-ward's suggestions |
Would it be heresy to suggest that we keep I imagine no matter what we do here, we're likely to break code. @perrygeo maybe we shouldn't jump to 1.0 until we're ready to roll out a few breaking API changes? I have mixed feelings about waiting until after 1.0 to roll those out. But I'm definitely OK with a few more <1.0 releases while we work through API changes. |
@brendan-ward @perrygeo Incorporated your suggestions and merged |
@geowurster Awesome! Changes look good to me and I think this is good to go. Pending review from @perrygeo , I think we're ready to 🚀 Thank you for all the hard work on this! |
Added #794 to this PR. |
@geowurster @sgillies I'm going to take a stab at resolving the merge conflicts and merging with master post-public-io. I'll push a commit shortly... |
So it's all merged up with the public io work. Testing this against some other rasterio scripts/modules, I've come across one instance where the affine→transform switch is going to break code: This is a common pattern in some rasterio code, ironically intended as a way to prepare for the future by ensuring
Which now gives you A couple of ways to proceed, there may be other options.
Other than that potential backwards incompatibility, this looks great. @sgillies @geowurster , thoughts? |
@perrygeo Nice! We're keeping class _TempProfile(dict):
def __init__(self, *args, **kwargs):
super(dict, self).__init__(*args, **kwargs)
if 'affine' in self:
with warnings.catch_warnings():
warnings.simplefilter('always')
warnings.warn("The 'affine' key in src.profile and src.meta will go away eventually", DeprecationWarning)
def __getitem__(self, item):
if item == 'affine':
with warnings.catch_warnings():
warnings.simplefilter('always')
warnings.warn("The 'affine' key in src.profile and src.meta will go away eventually", DeprecationWarning)
return super(dict, self).__getitem__(item)
def __setitem__(self, item):
# Same as __getitem__
def copy(self):
# This would spit out another warning from __init__, but being extra noisy isn't necessarily bad.
# We could disable it with an argument in init like _initial_check=False
return _TempProfile(super(dict, self).copy()) |
@geowurster I like that direction. We could even shadow
|
@perrygeo Yeah, but we don't know what the user is doing with the dictionary, so that could create some really wacky behavior if it is used outside of the Rasterio API. |
The reason the alias approach might be nice is that warning would only be triggered if a user was explicitly accessing those keys. In the absence of using an In the other approach, every user would see multiple warnings every time they used a profile, regardless of whether they get/set affine. IOW our own code would be triggering warnings when a user initialized the profile and when they copied or destructured it. ... As an aside, it might be fun to build an |
Ah I understand what you are saying now. We are providing an object to the user but it contains something we don't really want them to have, so we don't give it to them unless they know to ask for it. The fact that it is a dictionary is somewhat irrelevant because the users want the content, so really its just behaving like a dictionary in a weird meta way. Aliasing the key does make a certain amount of sense, and I'm guessing users are only referencing profile outside of What if we just disguised this as a new Now that I think about it again you're right - issuing a warning in ... Optimizing |
👍 My thinking is that FWIW, I worked up a general @sgillies the two remaining decision points here are
|
The |
@perrygeo Will try to review later today but may not have time. |
if 'affine' in kwargs: | ||
# DeprecationWarning's are ignored by default | ||
with warnings.catch_warnings(): | ||
warnings.simplefilter('always') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer we simply warn and not mess with catching or filtering and encourage developers to test their programs with python -W "error::DeprecationWarning:rasterio"
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about FutureWarning
which seems to be a bit louder by default than DeprecationWarning
.
I like the profile object idea. I think the essence of it is that it should warn ( I regret that we didn't already deprecate the We already have a |
@sgillies I forgot all about the profile class, mainly because it's only used to construct the
|
Looking at The |
@geowurster @sgillies Let's merge this and deal with the affine key regression in #823 |
Just my 2 cents, but A use case (I'm used to medical images, so bear with me) could be non-linear registration to improve geolocation accuracy by correcting for atmospheric distortion using control points or automated feature extraction. That's not currently supported, but it would be a powerful addition. I think ORFEO has some of that functionality??? |
@dmwelch Do you mean referring to the geospatial transformation construct as There's a lot going on in this thread, but the more recent parts about the |
Closes #516
Closes #794
Remove deprecated features and API's. See
docs/migrating-to-v1.rst
for a general description.