Opened 17 years ago

Closed 15 years ago

#230 closed defect (fixed)

Problem with Randint from Numeric when use by split in geospatial_data on cyclone however not tornado

Reported by: nick Owned by: ole
Priority: low Milestone:
Component: Other Version:
Severity: normal Keywords:
Cc: nick

Description

Here is a small piece of code that highlights the problem, it runs in seconds. Note the data file is here
Gneiss\gem\5\nhi\inundation\data\anuga_validation\cocos\elevation_final\new_edited_cocos_final_small_clip.txt

from anuga.geospatial_data.geospatial_data import *
from os import sep, environ, getenv, getcwd,umask
from anuga.pmesh.mesh_interface import create_mesh_from_regions
from anuga.shallow_water import Domain
from anuga.shallow_water import Reflective_boundary
from anuga.shallow_water.data_manager import export_grid
from anuga.shallow_water.data_manager import start_screen_catcher, copy_code_files
from math import sqrt
from time import localtime, strftime, gmtime

home = getenv('INUNDATIONHOME') + sep +'data'+sep
#output_dir = home + 'anuga_validation'+sep+'cocos'+sep+'anuga'+sep+'outputs'+sep+time+sep

data_dir='/d/ehn/4/ehn/tsunami/data/bathymetry/Cocos/bathymetry/'
data_dir_name = data_dir + 'new_edited_cocos_final'

data_dir_name_small_clip=data_dir_name+'_small_clip'

mesh_file=data_dir+'cocos.msh'
sww_file='test_final'

a_points = randint(0,99999,(80,2))
points = a_points.tolist()
#        print points

Ga = Geospatial_data(points)

G1, G2  = Ga.split(0.01,verbose=True)

print 'finish test1 of split'

G = Geospatial_data(file_name=data_dir_name_small_clip + '.txt')
G1, G2 = G.split(0.01,verbose=True)

When I run this code on cyclone two different problem occur. One of the problems is with randint() here is the error

Traceback (most recent call last):
  File "grid_test.py", line 26, in ?
    a_points = randint(0,99999,(80,2))
  File "/opt/lib64/python2.3/site-packages/Numeric/RandomArray.py", line 73, in randint
    a = ((maximum-minimum)* random(shape))
OverflowError: math range error

The other is here

Traceback (most recent call last):
  File "grid_test.py", line 36, in ?
    G1, G2 = G.split(0.01,verbose=True)
  File "/d/cit/1/cit/unixhome/nbartzis/anuga/anuga_core/source/anuga/geospatial_data/geospatial_data.py", line 695, in split
    random_list.append(remainder_list.pop(i))
OverflowError: signed integer is greater than maximum

The interesting thing is that the unit tests for split in geospatial_data, force it to use randint and it is successful when run on cyclone

It is not high on the list of things to do, but it does need to be recorded

Change History (6)

comment:1 Changed 17 years ago by nick

  • Owner ole deleted
  • Severity changed from major to normal

comment:2 Changed 17 years ago by ole

  • Cc nick added

If you check the code in, someone can have a look at the problem :-)

comment:3 Changed 17 years ago by nick

The code to test this is in \anuga_work\development\cocos\find_alpha_cocos.py

I have also just run it on the head node of cyclone and it works fine. It is just the other nodes that in throws a "OverFlowError?" ???

This ticket seems to be related to Trac ticket 237

comment:4 Changed 17 years ago by nick

  • Owner set to ole

comment:5 Changed 17 years ago by ole

  • Status changed from new to assigned

comment:6 Changed 15 years ago by nariman

  • Resolution set to fixed
  • Status changed from assigned to closed
Note: See TracTickets for help on using tickets.