Giter Site home page Giter Site logo

Comments (5)

vitorrebello avatar vitorrebello commented on July 16, 2024 1

Hello @mdbartos,
I have just followed all steps listed above and successfully completed it.
But now I got the following message from grid.to_raster:
rasterio._err.CPLE_AppDefinedError: MissingRequired:TIFF directory is missing required "StripOffsets" field
How should I proceed ?
Thanks a lot.

from pysheds.

mdbartos avatar mdbartos commented on July 16, 2024

Greetings,

You can use the grid.snap_to_mask method to snap point(s) to the nearest high-accumulation cell. You will need to first compute the accumulation using grid.accumulation. See this notebook:
https://github.com/mdbartos/pysheds/blob/master/examples/snap_to_mask.ipynb

The blockxsize and blockysize parameters come from rasterio. They default to 16, which means that in this case, your current output raster is smaller than 16x16 cells. You just need to make sure that these block size arguments are less than the y- and x- dimensions of your output raster.

from pysheds.

hikmet34 avatar hikmet34 commented on July 16, 2024

Thanks for your reply.
grid.snap_to_mask method solved to problem.

I know the blockxsize and blockysize parameters come from rasterio.
This is a view of the catchment data: (7x14)

[[nan nan nan nan nan nan nan nan 43. 37. 33. 34. 38. nan]
[nan nan nan nan nan 38. 39. 39. 39. 35. 32. 34. 40. 45.]
[nan nan 45. 40. 38. 37. 36. 36. 33. 32. 31. 33. 40. 44.]
[nan 50. 49. 45. 40. 37. 34. 33. 31. 30. 31. 33. 38. nan]
[53. 54. 54. 53. 46. 37. 34. nan nan nan nan nan nan nan]
[56. 57. 56. 55. 51. nan nan nan nan nan nan nan nan nan]
[nan 59. 58. nan nan nan nan nan nan nan nan nan nan nan]]

Therefore i fixed to this:
grid.to_raster(demView,'../Output/clippedElevations.tif',blockxsize=7,blockysize=14)

But i got error "ValueError: blockysize exceeds raster height."

On the other hand i wrote x = 14 and y =7:
grid.to_raster(demView,'../Output/clippedElevations.tif',blockxsize=14,blockysize=7)

Result:
"CPLE_AppDefinedError: _TIFFVSetField:../Output/clippedElevations.tif: Bad value 14 for "TileWidth tag"

from pysheds.

mdbartos avatar mdbartos commented on July 16, 2024

Try setting them to 2 or 4. The block sizes just need to be strictly smaller than the output dimensions.

from pysheds.

hikmet34 avatar hikmet34 commented on July 16, 2024

Ok, thanks for all your help @mdbartos

from pysheds.

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.