Changeset 6131


Ignore:
Timestamp:
Jan 9, 2009, 3:12:32 PM (15 years ago)
Author:
ole
Message:

Documented add_quantity and csv2building_polygons

Location:
anuga_core
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • anuga_core/documentation/user_manual/anuga_user_manual.tex

    r6050 r6131  
    19911991    function = None,
    19921992    geospatial_data = None,
     1993    expression = None,   
    19931994    filename = None,
    19941995    attribute_name = None,
     
    20492050
    20502051\end{methoddesc}
     2052
     2053
     2054
     2055
     2056\begin{methoddesc}{add\_quantity}{name,
     2057    numeric = None,
     2058    quantity = None,
     2059    function = None,
     2060    geospatial_data = None,
     2061    expression = None,
     2062    filename = None,
     2063    attribute_name = None,
     2064    alpha = None,
     2065    location = 'vertices',
     2066    indices = None,
     2067    verbose = False,
     2068    use_cache = False}
     2069  Module: \module{abstract\_2d\_finite\_volumes.domain}
     2070  (see also \module{abstract\_2d\_finite\_volumes.domain.set\_quantity})
     2071
     2072\label{add quantity}
     2073This function is used to \emph{add} values to individual quantities for a
     2074domain. It has the same syntax as \code{domain.set\_quantity(name, x)}.
     2075
     2076A typical use of this function is to add structures to an existing elevation model:
     2077
     2078{\small
     2079\begin{verbatim}
     2080    # Create digital elevation model from points file
     2081    domain.set_quantity('elevation',
     2082                        filename = 'elevation_file.pts,
     2083                        verbose = True)
     2084
     2085    # Add buildings from file
     2086    building_polygons, building_heights = csv2building_polygons(building_file)
     2087
     2088    B = []
     2089    for key in building_polygons:
     2090        poly = building_polygons[key]
     2091        elev = building_heights[key]
     2092        B.append((poly, elev))
     2093
     2094    domain.add_quantity('elevation', Polygon_function(B, default=0.0))
     2095
     2096\end{verbatim}}
     2097
     2098\end{methoddesc}
     2099
     2100
    20512101
    20522102
     
    32723322  \end{funcdesc}
    32733323
     3324 
     3325 
     3326 
     3327\begin{funcdesc}{csv2building\_polygons}{file\_name, floor\_height=3}
     3328
     3329Module: \module{shallow\_water.data\_manager}
     3330
     3331Convert CSV files of the form:
     3332{\small
     3333\begin{verbatim}
     3334    easting,northing,id,floors
     3335    422664.22,870785.46,2,0
     3336    422672.48,870780.14,2,0
     3337    422668.17,870772.62,2,0
     3338    422660.35,870777.17,2,0
     3339    422664.22,870785.46,2,0
     3340    422661.30,871215.06,3,1
     3341    422667.50,871215.70,3,1
     3342    422668.30,871204.86,3,1
     3343    422662.21,871204.33,3,1
     3344    422661.30,871215.06,3,1
     3345\end{verbatim} }
     3346
     3347to a dictionary of polygons with id as key.
     3348The associated number of floors are converted to m above MSL and
     3349returned as a separate dictionary also keyed by id.
     3350   
     3351Optional parameter floor_height is the height of each building story.
     3352
     3353These can e.g. be converted to a Polygon\_function for use with add\_quantity
     3354as shown on page \pageref{add quantity}.
     3355\end{funcdesc}
     3356
     3357 
     3358 
    32743359
    32753360
  • anuga_core/source/anuga/abstract_2d_finite_volumes/test_quantity.py

    r5897 r6131  
    326326        quantity = Quantity(self.mesh4)
    327327
    328         #Try constants first
     328        # Try constants first
    329329        const = 5
    330330        quantity.set_values(const, location = 'vertices')
     
    333333        assert allclose(quantity.get_integral(), self.mesh4.get_area() * const)
    334334
    335         #Try with a linear function
     335        # Try with a linear function
    336336        def f(x, y):
    337337            return x+y
  • anuga_core/source/anuga/culvert_flows/culvert_class.py

    r6128 r6131  
    415415        self.last_update = time
    416416
     417           
     418        if hasattr(self, 'log_filename'):
     419            log_filename = self.log_filename
    417420           
    418421        # Compute stage and energy at the
Note: See TracChangeset for help on using the changeset viewer.