#188 Split randomly does not honour the % requested

v2.1.1
closed
nobody
None
1
2014-10-22
2014-05-04
No

See: http://sourceforge.net/apps/trac/saga-gis/ticket/3
(side note: please remove old bugtracker)

Discussion

  • Comment has been marked as spam. 
    Undo

    You can see all pending comments posted by this user  here

    Anonymous - 2014-05-05

    I've removed the (never used) bug tracker in the trac installation (where we only use the wiki). Now I saw that you just linked to the old tracker, so I'm posting your message here again for reference:

    If I use the Split shapefile randomly at 50% on a 12 points layer, I get a variable number of points in the two groups, rarely 50/50.
    I can provide sample data if useful. Tested on 2.0.8 and 2.1

     
  • Volker Wichmann

    Volker Wichmann - 2014-05-05
    • status: open --> closed
     
  • Volker Wichmann

    Volker Wichmann - 2014-05-05

    This has been fixed in

    shapes_tools, split randomly: option added, give results with excact percentages specified by user http://sourceforge.net/p/saga-gis/code-0/2108/

    by adding a new option (since splitting a dataset by random does not guarantee that you get exactly the portions requested).

     
  • Paolo Cavallini

    Paolo Cavallini - 2014-10-17

    The selection does not seem random anyway, as it is consistently repeated on the same dataset.
    Thanks.

     
  • Volker Wichmann

    Volker Wichmann - 2014-10-18

    Hi Paolo,

    what makes you think that the selection is not random? I just did a quick test and could not see such an effect. Executing the module with the same input dataset several times resulted in different populations.

     
  • Paolo Cavallini

    Paolo Cavallini - 2014-10-18

    I tested it through QGIS (current master) on SAGA 2.1.2 from Debian sid: in this case, the samplleas are always the same for repeated runs of the same command. I assumed Processing is simply invoking the SAGA command:

    processing.runalg("saga:splitshapeslayerrandomly","/usr/local/src/qgis/QGIS-Documentation/source/docs/training_manual/exercise_data/processing/interp_contour/points.shp",50,None,None)

    Thanks

     
  • Volker Wichmann

    Volker Wichmann - 2014-10-19

    Please test this with a native SAGA application like saga_gui or saga_cmd. I can't reproduce this with SAGA 2.1.2 on windows and current svn trunk (no changes in source code since 2.1.2) on Linux. Seems to me like the problem is with the QGIS processing framework not updating the output files correctly after consecutive tool runs.

     
  • Paolo Cavallini

    Paolo Cavallini - 2014-10-19

    Probelm confirmed here:

    saga_cmd shapes_tools "Split Shapes Layer Randomly" -SHAPES "/tmp/23030.shp" -PERCENT 50 -EXACT -A "/tmp/A1.shp" -B "/tmp/B1.shp"

    and

    saga_cmd shapes_tools "Split Shapes Layer Randomly" -SHAPES "/tmp/23030.shp" -PERCENT 50 -EXACT -A "/tmp/A2.shp" -B "/tmp/B2.shp"

    give exactly the same result (and the same as the Processing interface).

    Thanks.

     
  • Volker Wichmann

    Volker Wichmann - 2014-10-19

    Thanks for testing. Very strange because I can't reproduce this. Just tested with SAGA 2.1.2 and saga_cmd and I get different results for consecutive module runs. Could you please attach a minimal sample SHP to this ticket which fails on your system? Just to rule it out - do you have several SAGA binary versions installed on your system and saga_cmd possibly picks up a saga_api.so from a different version?

     
  • Paolo Cavallini

    Paolo Cavallini - 2014-10-20

    SAGA is installed cleanly here, from Debian package - no duplicated lib.
    Shapefile attached.
    Thanks.

     
  • Volker Wichmann

    Volker Wichmann - 2014-10-22

    Ok, thanks - with your shapefile it was possible to reproduce the problem under certain conditions. The problem resulted from an incomplete initialization of the pseudo random number generator. This is fixed now in svn trunk (r2298 and r2299).

     
  • Paolo Cavallini

    Paolo Cavallini - 2014-10-22

    Thanks Volker

     


Anonymous

Cancel  Add attachments





Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks