GeoscienceAustralia / eqrm

Automatically exported from code.google.com/p/eqrm
Other
5 stars 4 forks source link

Divide by zero warning for TS_fat01 on rhe-compute1 #20

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Run scenario TS_fat01 on rhe-compute1
2. Notice the divide by zero warning

What is the expected output? What do you see instead?
The scenario produces the expected output so this is a low priority, but could 
be an issue as log10(0) produces -inf

Please use labels and text to provide additional information.
>>> from numpy import log10
>>> log10(0)
__main__:1: RuntimeWarning: divide by zero encountered in log10
-inf

Original issue reported on code.google.com by b...@girorosso.com on 2 Mar 2012 at 12:48

GoogleCodeExporter commented 9 years ago

Original comment by b...@girorosso.com on 15 Mar 2012 at 9:09

GoogleCodeExporter commented 9 years ago
If numpy.seterr(divide="raise") is set then an exception is raised for this 
warning.

The traceback:

Traceback (most recent call last):
  File "check_scenarios.py", line 51, in <module>
    check_scenarios_main()
  File "/nas/gemd/georisk_models/earthquake/sandpits/ben/eqrm/trunk/eqrm_code/check_scenarios.py", line 539, in check_scenarios_main
    files=files)
  File "/nas/gemd/georisk_models/earthquake/sandpits/ben/eqrm/trunk/eqrm_code/check_scenarios.py", line 171, in run_scenarios
    analysis.main(pull_path, True)
  File "/nas/gemd/georisk_models/earthquake/sandpits/ben/eqrm/trunk/eqrm_code/analysis.py", line 413, in main
    MMI = rsa2mmi_array(SA)
  File "/nas/gemd/georisk_models/earthquake/sandpits/ben/eqrm/trunk/eqrm_code/RSA2MMI.py", line 67, in rsa2mmi_array
    ind = nonzero(log10(data)<=logy15)
  File "/usr/local/python-2.7.2/lib/python2.7/site-packages/numpy/lib/scimath.py", line 303, in log10
    return nx.log10(x)
FloatingPointError: divide by zero encountered in log10

Uncomment

Original comment by b...@girorosso.com on 15 Mar 2012 at 10:11

GoogleCodeExporter commented 9 years ago
Revision 1013 - only work on positive indices when calculating MMI as 
MMI[where(data <= 0)] is set to zero anyway.

Original comment by b...@girorosso.com on 22 Mar 2012 at 5:09