Giter Club home page Giter Club logo

Comments (2)

sgillies avatar sgillies commented on May 24, 2024

@adehecq windows have float offsets and dimension. They're primarily for use with GDAL. They must be rounded if you want integers that can be used to slice an array.

from rasterio.

adehecq avatar adehecq commented on May 24, 2024

@adehecq windows have float offsets and dimension. They're primarily for use with GDAL. They must be rounded if you want integers that can be used to slice an array.

Thanks @sgillies. Yes, I'm aware that windows have float offsets and dimension. Sorry if that was not clear, but what I meant is that the output is incorrect. The function returns a height of 3022.0000000000005 whereas it should be exactly 3022.
This is caused by floating precision. windows.from_bounds uses transform.rowcol underneath, at this line. In the example I gave above:

rows, cols = rio.transform.rowcol(transform, [left, right, right, left],[top, top, bottom, bottom],op=float,)

yields "rows = [0.533333333333303, 0.533333333333303, 3022.5333333333338, 3022.5333333333338]". Due to floating precision, the left term has 15 decimals and the right one 13. I don't know if there is a way to overcome this precision issue? Maybe by allowing a fixed number of decimals?
This floating precision issue has caused me a lot of troubles with many other rasters...

from rasterio.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.