Opened 17 years ago

Closed 17 years ago

#229 closed defect (duplicate)

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: major Keywords:
Cc:

Description

Here is a small piece of code that highlights the problem, it runs in seconds. Note the data file attached

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)

the data file is attached.

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 (1)

comment:1 Changed 17 years ago by nick

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