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

GeoImage functions: new vs inplace #60

Closed
matthewhanson opened this issue Apr 17, 2016 · 0 comments
Closed

GeoImage functions: new vs inplace #60

matthewhanson opened this issue Apr 17, 2016 · 0 comments
Labels

Comments

@matthewhanson
Copy link
Member

The convention for operations on a raster is that a new raster gets returned with the operation chained to it. Thus:

newband = band * 5

where (band * 5) returns a new GeoRaster with a x5 function added to it's chain.

In contrast, some GeoImage functions (eg AddMask) actually operate on *this, which is then returned. This is not consistent.

I think the best way is to always return a new object, that way any previous references will still contain the original GeoImage without the processing applied, which would be desirable.

Somewhat related is the various Set functions: SetGain, SetBandNames which return void and operate on *this as well, however I think with a 'Set' functions this would be the expected behavior. Although, at least returning *this from these would allow those functions to be included in a chain, e.g.,

image2 = image.SetGain(1.0).autoscale(args)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant