From: Ole N. <ole...@gm...> - 2011-04-21 05:10:38
|
You should be able to call set_quantity with a polygon restricting where values are changed. That could be used to reset parts of the domain. Something like domain.set_quantity(0, polygon=......) To see what is possible, consult the underlying function set_values (everything you pass to set_quantity is passed down to set_values in the quantity object): http://datamining.anu.edu.au/browser/trunk/anuga_core/source/anuga/abstract_2d_finite_volumes/quantity.py#L344 An excerpt from the docstring states: Restrict update of quantity to locations that fall inside polygon. Polygon works by selecting indice and calling set_values recursively. Polygon mode has only been implemented for constant values so far. Let me know how it goes O On Tue, Apr 12, 2011 at 11:26 AM, Ole Nielsen <ole...@ai...> wrote: > > > -----Original Message----- > From: Rudy [mailto:ru...@ba...] > Sent: Monday, 11 April 2011 8:55 PM > To: Ole Nielsen > Subject: Re: Changing Elevation to a Set Value > > Hi Ole, > > > Yes I tried using add_quantity.... > > the problem is if I want to define something new in place of the existing > terrain, I need to start from Zero! > > I have not been able to subtract a portion of the existing terrain (inside > a polygon) from the existing terrain, to set it to zero, and then to add > the new replacement terrain, like an embankment !! > > > I think I need to use the get_values restricted to a polygon.... and then > set_values for the same polygon... > > So Q1 = get_values (polygon) > Q2 = -Q1 > Q3 = set_values(polygon, new terrain) > > New elevation = Q1+Q2+Q3 ( = 0 +new terrain) ??? > > Trying to use add_quantity, to a variable underlying terrain is very > clumsy and time consuming, and does not provide a good result.... (unless > I am doing it wrong?) > > > ANy clues or ideas ?? > > Regards Rudy > > > > On Mon, 11 Apr 2011 20:09:00 +1000, Ole Nielsen <ole...@ai...> > wrote: > > > You can just use add_quantity() and built it up piece by piece. > > O > > > > > > > > -----Original Message----- > > From: Rudy [mailto:ru...@ba...] > > Sent: Monday, 11 April 2011 12:45 PM > > To: Ole Nielsen; Jan...@ga...; Stephen Roberts > > Cc: 'Nar...@ga...' > > Subject: Re: Changing Elevation to a Set Value > > > > I note that in quantity.py it states the following: > > > > > > # FIXME (Ole): I reckon we should have the option of passing a > > # polygon into get_values. The question becomes how > > # resulting values should be ordered. > > > > > > > > > > and for set.values > > > > > > polygon: Restrict update of quantity to locations that fall > > inside polygon. Polygon works by selecting indices > > and calling set_values recursively. > > Polygon mode has only been implemented for > > constant values so far. > > > > So does that mean it is not possible to use existing tools to set the > > elevation values within a polygon to ZERO ?? > > > > I would have thought that you need to get.values for the polygon and > > then set.values. > > > > > > I want to create a Flat area of Zero, so that I can then adjust the > > elevation by adding to it ?? > > > > > > Any one done this before ? > > > > > > Regards rudy > > > -- > Using Opera's revolutionary email client: http://www.opera.com/mail/ > |