-
Notifications
You must be signed in to change notification settings - Fork 523
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
Plan for replacing GDAL transform arrays with Affine instances #86
Labels
Milestone
Comments
sgillies
pushed a commit
that referenced
this issue
May 30, 2014
All tests pass, all examples are working. TODO: docs.
Closed
TimoRoth
added a commit
to TimoRoth/oggm
that referenced
this issue
Jun 23, 2017
See rasterio/rasterio#86 for reference. Fixes a couple hundret deprecation warnings that come up during testing.
TimoRoth
added a commit
to TimoRoth/oggm
that referenced
this issue
Jun 23, 2017
See rasterio/rasterio#86 for reference. Fixes a couple hundred deprecation warnings that come up during testing.
What is the recommended way to have code working with both rasterio 0.36 and the 1.0* releases? I currently use dst.affine, which works fine under both versions, but generates a shitload of warning on 1.0*. Do I really have to check for the rasterio version and adopt the behaviour? |
I dislike checking for a version, so I came up with this solution, may be useful for others.
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The Goal
In Rasterio versions up to 0.8, GDAL geotransform arrays were used throughout: in the internals when calling GDAL functions and in the Rasterio Python interfaces. In Rasterio 1.0 GDAL's arrays will be for internal use only and Rasterio will deal in instances of
affine.Affine
or 6-element tuples that can be converted directly to instances of that class.The Plan
Arguments
In the methods and functions with
transform
arguments, we will try to support both the new objects and the GDAL geotransform arrays up until 1.0 by sniffing sequences for characteristic signs of being a GDAL array. Here's the function to be used:Geospatial rasters very rarely have non-zero rotation coefficients and GDAL has them at indexes 2 and 4. GDAL puts the pixel sizes at indexes 1 and 5 and the later should be negative. When a GDAL geotransform argument is received, Rasterio will raise a future warning like this:
Note that deprecation warnings get ignored unless warnings are turned on with the
-W
option.Return Values
For the methods and properties that return a transformation object, we need a different approach. Starting with version 0.9, properties like
.transform
will raise a deprecation warning. We will also add parallel.affine
property, values of which are instances ofaffine.Affine
. At version 1.0, we will switch the values of.transform
over toaffine.Affine
and leave the.affine
attribute as a deprecated alias.This plan will finish for Rasterio the harmonization proposed in #80.
cc @brendan-ward @mwtoews @AsgerPetersen
The text was updated successfully, but these errors were encountered: