Opened 15 years ago
Closed 15 years ago
#344 closed defect (fixed)
produce asc when there is a hole in the model
Reported by: | sexton | Owned by: | hudson |
---|---|---|---|
Priority: | high | Milestone: | ANUGA Flood Modelling Capability |
Component: | Functionality and features | Version: | |
Severity: | normal | Keywords: | ascii grid |
Cc: |
Description
From Peter Wells to anuga user list 12 November 2009:
I'm trying to produce an ASC file showing peak stage of a simulation.
Unfortunately sww2dem does not dela very well with the hole in the middle of the model:
Traceback (most recent call last):
File "makeASC.py", line 52, in <module>
format = 'asc')
File "C:\Python25\lib\site-packages\anuga\shallow_water\data_manager.py", line 2415, in sww2dem
grid_values = interp.interpolate(result, grid_points).flatten()
File "C:\Python25\lib\site-packages\anuga\fit_interpolate\interpolate.py", line 290, in interpolate
verbose=verbose)
File "C:\Python25\lib\site-packages\anuga\fit_interpolate\interpolate.py", line 378, in interpolate_block
verbose=verbose)
File "C:\Python25\lib\site-packages\anuga\fit_interpolate\interpolate.py", line 505, in _build_interpolation_matrix_A
raise Exception(msg)
Exception: ('Could not find triangle for point', array([ 13.8, 9.8]))
Attachments (2)
Change History (7)
Changed 15 years ago by sexton
comment:1 Changed 15 years ago by sexton
This has been confirmed. Using the script that Peter sent and changing the clipping coordinates to easting_min = 2.5, easting_max = 3.0, northing_min = 8.5, northing_max = 9.0 thereby missing the hole, then sww2dem works. a unit test is now required.
comment:2 Changed 15 years ago by hudson
- Owner changed from nhabili to hudson
- Status changed from new to assigned
Cause of the bug: the interpolate() function uses get_boundary_polygon, which returns the bounding volume of the polygon, without taking into account holes in the mesh.
This means that points that fall in the hole trigger the 'Could not find triangle for point' exception in interpolate(). Instead of this exception, points should be moved into the outside_poly_indices list.
A unit test should be written for this.
comment:3 Changed 15 years ago by hudson
Failing unit test written to make sure points are placed in correct inside/outside lists - I'll check this all in when the test passes.
comment:4 Changed 15 years ago by hudson
Rev 7685 has all passing tests and correct handling of inside/outside lists.
comment:5 Changed 15 years ago by hudson
- Resolution set to fixed
- Status changed from assigned to closed
script supplied by Peter Wells highlighting error