Changeset 3087
- Timestamp:
- Jun 5, 2006, 5:07:42 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
documentation/user_manual/anuga_user_manual.tex
r3076 r3087 1175 1175 store and manipulate data associated with a mesh. The mesh is 1176 1176 specified either by assigning the name of a meshfile to 1177 \code{source} or by 1177 \code{source} or by 1178 1178 \end{classdesc} 1179 1179 … … 2196 2196 default_attribute_name = None, 2197 2197 file_name = None} 2198 2199 2200 2201 Create instance from data points and associated attributes 2202 2203 2204 data_points: x,y coordinates in metres. Type must be either a 2205 sequence of 2-tuples or an Mx2 Numeric array of floats. 2206 2207 attributes: Associated values for each data point. The type 2208 must be either a list or an array of length M or a dictionary 2209 of lists (or arrays) of length M. In the latter case the keys 2210 in the dictionary represent the attribute names, in the former 2211 the attribute will get the default name 'attribute'. 2212 2213 geo_reference: Object representing the origin of the data 2214 points. It contains UTM zone, easting and northing and data 2215 points are assumed to be relative to this origin. 2216 If geo_reference is None, the default geo ref object is used 2217 2218 default_attribute_name: Name of default attribute to be used with 2219 get_attribute_values. The idea is that the dataset can be 2220 equipped with information about which attribute to return. 2221 If None, the default is the 'first' 2222 2223 file_name: Name of input NetCDF file or xya file. NetCDF file must 2224 have dimensions "points" etc. 2225 XYA file is a CVS file with lats(x), longs(y) and elevation(a). 2226 first line must be attribute name eg elevation 2227 2198 Module: \code{geospatial_data} 2199 2200 This class is used to store a set of data points and associated 2201 attributes, allowing these to be manipulated by methods defined for 2202 the class. 2203 2204 The data points are specified either by reading them from a NetCDF 2205 or XYA file, identified through the parameter \code{file_name}, or 2206 by providing their \code{x}- and \code{y}-coordinates in metres, 2207 either as a sequence of 2-tuples of floats or as an $M \times 2$ 2208 Numeric array of floats, where $M$ is the number of points. 2209 Coordinates are interpreted relative to the origin specified by the 2210 object \code{geo_reference}, which contains data indicating the UTM 2211 zone, easting and northing. If \code{geo_reference} is not 2212 specified, a default is used. 2213 2214 Attributes are specified through the parameter \code{attributes}, 2215 set either to a list or array of length $M$ or to a dictionary whose 2216 keys are the attribute names and whose values are lists or arrays of 2217 length $M$. One of the attributes may be specified as the default 2218 attribute, by assigning its name to \code{default_attribute_name}. 2219 If no value is specified, the default attribute is taken to be the 2220 first one. 2228 2221 \end{classdesc} 2229 2222 2223 2224 \begin{funcdesc}{import_points_file}{delimiter = None, verbose = False} 2225 2226 \end{funcdesc} 2227 2228 2229 \begin{funcdesc}{export_points_file}{ofile, absolute=False} 2230 2231 \end{funcdesc} 2232 2233 2234 \begin{funcdesc}{get_data_points}{absolute = True} 2235 2236 \end{funcdesc} 2237 2238 2239 \begin{funcdesc}{set_attributes}{attributes} 2240 2241 \end{funcdesc} 2242 2243 2244 \begin{funcdesc}{get_attributes}{attribute_name = None} 2245 2246 \end{funcdesc} 2247 2248 2249 \begin{funcdesc}{get_all_attributes}{} 2250 2251 \end{funcdesc} 2252 2253 2254 \begin{funcdesc}{set_default_attribute_name}{default_attribute_name} 2255 2256 \end{funcdesc} 2257 2258 2259 \begin{funcdesc}{set_geo_reference}{geo_reference} 2260 2261 \end{funcdesc} 2262 2263 2264 \begin{funcdesc}{__add__} 2265 2266 \end{funcdesc} 2267 2268 2230 2269 \section{pmesh GUI} 2231 2270 2232 2271 \section{alpha_shape} 2233 2234 2235 \section{utilities/numerical_tools} Do now. 2272 An \emph{alpha shape} is a shape created from a set of points in the 2273 plane, according to an algorithm. This shape is intended to capture 2274 the intuitive notion of the `shape formed by the points'. For a 2275 sufficiently simple set, the alpha shape reduces to the more precise 2276 notion of the convex hull, but in general an alpha shape can be much 2277 much more complex and may be far from convex. 2278 2279 In the context of \anuga, an alpha shape is used to fit a polygonal 2280 boundary around a set of points when fitting a mesh to a region. The 2281 algorithm uses a parameter $\alpha$ that can be adjusted to make the 2282 resultant shape resemble the shape suggested by intuition more 2283 closely. 2284 2285 The following paragraphs describe the class used to model an alpha 2286 shape and some of the more important methods and attributes 2287 associated with instances of this class. 2288 2289 \begin{classdesc}{Alpha_Shape}{points, alpha = None} 2290 Module: \code{alpha_shape} 2291 2292 To instantiate this class the user supplies the points from which 2293 the alpha shape is to be created (in the form of a list of 2-tuples 2294 \code{[[x1, y1],[x2, y2]}\ldots\code{]}, assigned to the parameter 2295 \code{points}) and, optionally, a value for the parameter $\alpha$. 2296 The alpha shape is then computed and details of the required 2297 boundary may be retrieved as attributes of the class instance. 2298 \end{classdesc} 2299 2300 2301 \begin{funcdesc}{alpha_shape_via_files}{point_file, boundary_file, alpha= None} 2302 Module: \code{alpha_shape} 2303 2304 This function reads points from the specified file 2305 \code{point_file}, computes the associated alpha shape (either using 2306 the specified value for \code{alpha} or, if no value is specified, 2307 automatically setting it to a value judged to be optimal} and 2308 outputs the boundary to a file named \code{boundary_file}. This 2309 output file lists the coordinates \code{x, y} of each point in the 2310 boundary, using one line per point. 2311 \end{funcdesc} 2312 2313 2314 \begin{funcdesc}{set_boundary_type}{self,raw_boundary=True, 2315 remove_holes=False, 2316 smooth_indents=False, 2317 expand_pinch=False, 2318 boundary_points_fraction=0.2} 2319 Module: \code{alpha_shape} 2320 2321 This function sets flags that govern the operation of the algorithm 2322 that computes the boundary, 2323 raw_boundary Return raw boundary i.e. the regular edges of the 2324 alpha shape. 2325 remove_holes filter to remove small holes 2326 (small is defined by boundary_points_fraction ) 2327 smooth_indents remove sharp triangular indents in boundary 2328 expand_pinch test for pinch-off and correct 2329 i.e. a boundary vertex with more than two edges. 2330 \end{funcdesc} 2331 2332 \section{utilities/numerical_tools} 2333 2334 \begin{tabular}{|l l|} \hline 2335 \code{angle(v1, v2=None)} & Angle between two-dimensional vectors 2336 \code{v1} and \code{v2}, in range $0$ to $2\pi$. If \code{v2} is 2337 omitted it is taken as the unit vector in the $x$-direction.\\ 2338 2339 \code{normal_vector(v)} & Normal vector to \code{v}\\ 2340 2341 \code{mean(x)} & Mean value of a vector\\ 2342 2343 \code{cov(x, y=None)} & Covariance of vectors \code{x} and \code{y}. 2344 If y is None, returns \code{cov(x, x)}\\ 2345 2346 \code{err(x, y=0, n=2, relative=True)} & Relative error of 2347 $\parallel$\code{x}$-$\code{y}$\parallel$ to 2348 $\parallel$\code{y}$\parallel$ (2-norm if \code{n} = 2 or Max norm 2349 if \code{n} = None). If denominator evaluates to zero or if \code{y} 2350 is omitted, absolute error is returned.\\ 2351 2352 \code{norm(x)} & 2-norm of \code{x}\\ 2353 2354 \code{corr(x, y=None)} & Correlation of \code{x} and \code{y}. If 2355 \code{y} is \code{None} returns autocorrelation of \code{x}.\\ 2356 2357 \code{ensure_numeric(A, typecode = None)} & Ensure that sequence is 2358 a Numeric array. If \code{A} is already a Numeric array it will be 2359 returned unaltered. Otherwise, an attempt is made to convert it to a 2360 Numeric array. This function is necessary as \code{array(A)} can 2361 cause memory overflow.\\ 2362 2363 \code{histogram(a, bins, relative=False)} & Standard histogram. If 2364 \code{relative} is \code{True}, values will be normalised against 2365 the total and thus represent frequencies rather than counts.\\ 2366 2367 \code{create_bins(data, number_of_bins = None)} & Safely create bins 2368 for use with histogram. If data contains only one point or is 2369 constant, one bin will be created. If \code{number_of_bins} is 2370 omitted, 10 bins will be created.\\ \hline 2371 2372 \end{tabular} 2373 2236 2374 2237 2375 \begin{itemize}
Note: See TracChangeset
for help on using the changeset viewer.