Changeset 3087


Ignore:
Timestamp:
Jun 5, 2006, 5:07:42 PM (18 years ago)
Author:
howard
Message:

Added material on geo_spatial data and alpha shapes to Appendix A

File:
1 edited

Legend:

Unmodified
Added
Removed
  • documentation/user_manual/anuga_user_manual.tex

    r3076 r3087  
    11751175store and manipulate data associated with a mesh. The mesh is
    11761176specified either by assigning the name of a meshfile to
    1177 \code{source} or by 
     1177\code{source} or by
    11781178\end{classdesc}
    11791179
     
    21962196    default_attribute_name = None,
    21972197    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 
     2198Module: \code{geospatial_data}
     2199
     2200This class is used to store a set of data points and associated
     2201attributes, allowing these to be manipulated by methods defined for
     2202the class.
     2203
     2204The data points are specified either by reading them from a NetCDF
     2205or XYA file, identified through the parameter \code{file_name}, or
     2206by providing their \code{x}- and \code{y}-coordinates in metres,
     2207either as a sequence of 2-tuples of floats or as an $M \times 2$
     2208Numeric array of floats, where $M$ is the number of points.
     2209Coordinates are interpreted relative to the origin specified by the
     2210object \code{geo_reference}, which contains data indicating the UTM
     2211zone, easting and northing. If \code{geo_reference} is not
     2212specified, a default is used.
     2213
     2214Attributes are specified through the parameter \code{attributes},
     2215set either to a list or array of length $M$ or to a dictionary whose
     2216keys are the attribute names and whose values are lists or arrays of
     2217length $M$. One of the attributes may be specified as the default
     2218attribute, by assigning its name to \code{default_attribute_name}.
     2219If no value is specified, the default attribute is taken to be the
     2220first one.
    22282221\end{classdesc}
    22292222
     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
    22302269\section{pmesh GUI}
    22312270
    22322271\section{alpha_shape}
    2233 
    2234 
    2235 \section{utilities/numerical_tools} Do now.
     2272An \emph{alpha shape} is a shape created from a set of points in the
     2273plane, according to an algorithm. This shape is intended to capture
     2274the intuitive notion of the `shape formed by the points'. For a
     2275sufficiently simple set, the alpha shape reduces to the more precise
     2276notion of the convex hull, but in general an alpha shape can be much
     2277much more complex and may be far from convex.
     2278
     2279In the context of \anuga, an alpha shape is used to fit a polygonal
     2280boundary around a set of points when fitting a mesh to a region. The
     2281algorithm uses a parameter $\alpha$ that can be adjusted to make the
     2282resultant shape resemble the shape suggested by intuition more
     2283closely.
     2284
     2285The following paragraphs describe the class used to model an alpha
     2286shape and some of the more important methods and attributes
     2287associated with instances of this class.
     2288
     2289\begin{classdesc}{Alpha_Shape}{points, alpha = None}
     2290Module: \code{alpha_shape}
     2291
     2292To instantiate this class the user supplies the points from which
     2293the 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$.
     2296The alpha shape is then computed and details of the required
     2297boundary 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}
     2302Module: \code{alpha_shape}
     2303
     2304This function reads points from the specified file
     2305\code{point_file}, computes the associated alpha shape (either using
     2306the specified value for \code{alpha} or, if no value is specified,
     2307automatically setting it to a value judged to be optimal} and
     2308outputs the boundary to a file named \code{boundary_file}. This
     2309output file lists the coordinates \code{x, y} of each point in the
     2310boundary, 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}
     2319Module: \code{alpha_shape}
     2320
     2321This function sets flags that govern the operation of the algorithm
     2322that 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
     2337omitted 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}.
     2344If 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
     2349if \code{n} = None). If denominator evaluates to zero or if \code{y}
     2350is 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
     2358a Numeric array. If \code{A} is already a Numeric array it will be
     2359returned unaltered. Otherwise, an attempt is made to convert it to a
     2360Numeric array. This function is necessary as \code{array(A)} can
     2361cause memory overflow.\\
     2362
     2363\code{histogram(a, bins, relative=False)} & Standard histogram. If
     2364\code{relative} is \code{True}, values will be normalised against
     2365the total and thus represent frequencies rather than counts.\\
     2366
     2367\code{create_bins(data, number_of_bins = None)} & Safely create bins
     2368for use with histogram. If data contains only one point or is
     2369constant, one bin will be created. If \code{number_of_bins} is
     2370omitted, 10 bins will be created.\\  \hline
     2371
     2372\end{tabular}
     2373
    22362374
    22372375\begin{itemize}
Note: See TracChangeset for help on using the changeset viewer.