NeoGeographyToolkit / synthterrain

Tools for the generation of synthetic planetary terrain
Apache License 2.0
4 stars 0 forks source link

synthcraters --maxd must be greater than 10! #3

Closed rbeyer closed 2 years ago

rbeyer commented 2 years ago

If you run synthcraters like this:

synthcraters --bbox -1054.500 -1373.500 387.500 56.500 --mind 0.5 --maxd 10.0 -v -o craters_small-Site001-004.csv
INFO: Production function is <class 'synthterrain.crater.functions.Grun'>
INFO: In 2062060.0 m^2, generated 227653 craters.
Traceback (most recent call last):
  File "/Users/rbeyer/.anaconda3/envs/synthdev/bin/synthcraters", line 33, in <module>
    sys.exit(load_entry_point('synthterrain', 'console_scripts', 'synthcraters')())
  File "/Users/rbeyer/software/synthterrain/src/python/synthterrain/crater/cli.py", line 134, in main
    by_bin=args.run_individual)
  File "/Users/rbeyer/software/synthterrain/src/python/synthterrain/crater/__init__.py", line 61, in synthesize
    df = generate_ages(diameters, production_fn.csfd, crater_dist.csfd)
  File "/Users/rbeyer/software/synthterrain/src/python/synthterrain/crater/__init__.py", line 137, in generate_ages
    ages = np.random.default_rng().uniform(0, yrs_to_equilibrium)
  File "_generator.pyx", line 958, in numpy.random._generator.Generator.uniform
  File "_common.pyx", line 562, in numpy.random._common.cont
  File "_common.pyx", line 467, in numpy.random._common.cont_broadcast_2
  File "_common.pyx", line 350, in numpy.random._common.check_array_constraint
ValueError: high - low < 0

If --maxd is set to any value greater than 10, it works as expected, but less than or equal to 10 yields this error. The error is likely in the Grun production function, as values greater than 10, result in the code using either the Neukum Production Function (if --mind is also greater than 10) or the mixed GNPF, if the min and max are on opposite sides of 10.

Should be easy to track down when I have a moment.