Comments (5)
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.
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.
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.
Try setting them to 2 or 4. The block sizes just need to be strictly smaller than the output dimensions.
from pysheds.
Ok, thanks for all your help @mdbartos
from pysheds.
Related Issues (20)
- How to create Flow Distance raster same shape as DEM raster?
- Re-evaluate Numba performance HOT 2
- Allow Numba to perform polymorphic dispatching HOT 5
- Can't 'imshow' DEM for some unkown reason HOT 1
- extract_profiles function returning wrong connections when neighbouring cells drain to outlet
- strang plots HOT 1
- Allow user to disable `parallel=True` with numba HOT 2
- Why stream network `LineStrings` do not pass through the centroid of each grid cell? HOT 1
- accumulation issue HOT 3
- Preprocessing DEM with pysheds seems to produce incorrect accumulations HOT 11
- Using catchment() with discharge point outside of extents crashes program
- sGrid and pGrid have major differences
- Pysheds Cupy / Cuspatial support HOT 1
- Accumulation disconnections HOT 4
- setup fail by github repo of latest release version
- Pixels that should be accumulation watercourses are shown as nodata HOT 2
- Wrong bbox when using `ViewFinder` HOT 3
- issue in pygrid with np.int and np.warnings
- D8 and Dinf flow directions look incorrect HOT 4
- Indexing Error in _d8_distance_from_ridge
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pysheds.