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

Segfault on river calculation #1

Open
dkartaschew opened this issue Mar 10, 2018 · 1 comment
Open

Segfault on river calculation #1

dkartaschew opened this issue Mar 10, 2018 · 1 comment
Labels
bug Something isn't working Python side It involves the Python code Rivers Related to rivers

Comments

@dkartaschew
Copy link

Attempting to generate world using STRM data for grid 39_01 (http://srtm.csi.cgiar.org/SRT-ZIP/SRTM_V41/SRTM_Data_GeoTiff/srtm_39_01.zip) results in segfault at end of river calculation.

The application runs through all river calculations and segfaults on "Calculating water quantity".

Reading heightmap
Generating database
Adding heightmap
Writing file
Done.
Reading heightmap
Generating rivermap
[rivers] Finding start points
[rivers] Found 127563 start points
[rivers] Building river trees: 24357850 points to visit
[rivers] 24 × 10⁶ points remaining Altitude: 0 Queue: 164617
[rivers] 23 × 10⁶ points remaining Altitude: 10 Queue: 213554
[rivers] 22 × 10⁶ points remaining Altitude: 20 Queue: 219249
[rivers] 21 × 10⁶ points remaining Altitude: 30 Queue: 226943
[rivers] 20 × 10⁶ points remaining Altitude: 41 Queue: 222354
[rivers] 19 × 10⁶ points remaining Altitude: 44 Queue: 434193
[rivers] 18 × 10⁶ points remaining Altitude: 51 Queue: 242251
[rivers] 17 × 10⁶ points remaining Altitude: 62 Queue: 250995
[rivers] 16 × 10⁶ points remaining Altitude: 72 Queue: 257564
[rivers] 15 × 10⁶ points remaining Altitude: 83 Queue: 251176
[rivers] 14 × 10⁶ points remaining Altitude: 90 Queue: 260919
[rivers] 13 × 10⁶ points remaining Altitude: 100 Queue: 253073
[rivers] 12 × 10⁶ points remaining Altitude: 115 Queue: 267606
[rivers] 11 × 10⁶ points remaining Altitude: 126 Queue: 279741
[rivers] 10 × 10⁶ points remaining Altitude: 137 Queue: 283323
[rivers] 9 × 10⁶ points remaining Altitude: 147 Queue: 299957
[rivers] 8 × 10⁶ points remaining Altitude: 156 Queue: 306785
[rivers] 7 × 10⁶ points remaining Altitude: 166 Queue: 293640
[rivers] 6 × 10⁶ points remaining Altitude: 176 Queue: 289131
[rivers] 5 × 10⁶ points remaining Altitude: 189 Queue: 240500
[rivers] 4 × 10⁶ points remaining Altitude: 205 Queue: 207819
[rivers] 3 × 10⁶ points remaining Altitude: 212 Queue: 190416
[rivers] 2 × 10⁶ points remaining Altitude: 246 Queue: 154364
[rivers] 1 × 10⁶ points remaining Altitude: 280 Queue: 97489
[rivers] 0 × 10⁶ points remaining Altitude: 703 Queue: 0
[rivers] Calculating water quantity
Segmentation fault (core dumped)

I've successfully generated world data for areas with little water bodies, but nothing as large as the baltic area. (eg STRM area 67_18 works fine).

System:
Arch Linux
Linux cobalt 4.15.7-1-ARCH #1 SMP PREEMPT Wed Feb 28 19:01:57 UTC 2018 x86_64 GNU/Linux
i7-4770 + 32GB RAM + SSD as primary storage.
python 3.6.4
gdal v2.2.3

Steps to replicate:

  1. Download SRTM data for 39_01
  2. run tool select SRTM data and world file.
  3. Under region, leave as "Don't modify the image"
  4. Check to enable rivers, use all defaults.
  5. Click on Proceed
@gaelysam
Copy link
Owner

gaelysam commented Mar 10, 2018

I don't manage to reproduce the bug with this map, but it happened to me once with another map.
I think it is due to a too heavy recursion in the water quantity algorithm, in function set_water. It covers every river from its estuary to the source of tributaries, so the recursion depth is equal to the length of the river, that can easily exceed 2000.

I'm looking for a way to re-implement this without recursion.

@gaelysam gaelysam added bug Something isn't working Python side It involves the Python code Rivers Related to rivers labels Mar 10, 2018
@gaelysam gaelysam added this to Middle term in Main roadmap Mar 31, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Python side It involves the Python code Rivers Related to rivers
Projects
Main roadmap
Middle term
Development

No branches or pull requests

2 participants