Changeset 6131
- Timestamp:
- Jan 9, 2009, 3:12:32 PM (16 years ago)
- Location:
- anuga_core
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/documentation/user_manual/anuga_user_manual.tex
r6050 r6131 1991 1991 function = None, 1992 1992 geospatial_data = None, 1993 expression = None, 1993 1994 filename = None, 1994 1995 attribute_name = None, … … 2049 2050 2050 2051 \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} 2073 This function is used to \emph{add} values to individual quantities for a 2074 domain. It has the same syntax as \code{domain.set\_quantity(name, x)}. 2075 2076 A 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 2051 2101 2052 2102 … … 3272 3322 \end{funcdesc} 3273 3323 3324 3325 3326 3327 \begin{funcdesc}{csv2building\_polygons}{file\_name, floor\_height=3} 3328 3329 Module: \module{shallow\_water.data\_manager} 3330 3331 Convert 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 3347 to a dictionary of polygons with id as key. 3348 The associated number of floors are converted to m above MSL and 3349 returned as a separate dictionary also keyed by id. 3350 3351 Optional parameter floor_height is the height of each building story. 3352 3353 These can e.g. be converted to a Polygon\_function for use with add\_quantity 3354 as shown on page \pageref{add quantity}. 3355 \end{funcdesc} 3356 3357 3358 3274 3359 3275 3360 -
anuga_core/source/anuga/abstract_2d_finite_volumes/test_quantity.py
r5897 r6131 326 326 quantity = Quantity(self.mesh4) 327 327 328 # Try constants first328 # Try constants first 329 329 const = 5 330 330 quantity.set_values(const, location = 'vertices') … … 333 333 assert allclose(quantity.get_integral(), self.mesh4.get_area() * const) 334 334 335 # Try with a linear function335 # Try with a linear function 336 336 def f(x, y): 337 337 return x+y -
anuga_core/source/anuga/culvert_flows/culvert_class.py
r6128 r6131 415 415 self.last_update = time 416 416 417 418 if hasattr(self, 'log_filename'): 419 log_filename = self.log_filename 417 420 418 421 # Compute stage and energy at the
Note: See TracChangeset
for help on using the changeset viewer.