Changeset 8147


Ignore:
Timestamp:
Mar 11, 2011, 4:02:47 PM (14 years ago)
Author:
wilsonr
Message:

Removed '@brief' comments.

Location:
trunk/anuga_core/source/anuga
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/anuga_core/source/anuga/abstract_2d_finite_volumes/util.py

    r8124 r8147  
    4444                      boundary_polygon, output_centroids)
    4545
    46 ##
    47 # @brief Replace multiple substrings in a string.
    48 # @param text The string to operate on.
    49 # @param dictionary A dict containing replacements, key->value.
    50 # @return The new string.
    5146def multiple_replace(text, dictionary):
    5247    """Multiple replace of words in text
     
    7166
    7267
    73 ##
    74 # @brief Apply arbitrary expressions to the values of a dict.
    75 # @param expression A string expression to apply.
    76 # @param dictionary The dictionary to apply the expression to.
    7768def apply_expression_to_dictionary(expression, dictionary):
    7869    """Apply arbitrary expression to values of dictionary
     
    119110
    120111
    121 ##
    122 # @brief Format a float into a string.
    123 # @param value Float value to format.
    124 # @param format The format to use (%.2f is default).
    125 # @return The formatted float as a string.
    126112def get_textual_float(value, format = '%.2f'):
    127113    """Get textual representation of floating point numbers
     
    150136            return format % float(value)
    151137
    152 ##
    153 # @brief Read gauge info from a file.
    154 # @param filename The name of the file to read.
    155 # @return A (gauges, gaugelocation, elev) tuple.
    156138def get_gauges_from_file(filename):
    157139    return gauge_get_from_file(filename)
    158140
    159141
    160 ##
    161 # @brief Check that input quantities in quantity list are legal.
    162 # @param quantity Quantity list to check.
    163 # @note Raises an exception of list is not legal.
    164142def check_list(quantity):
    165143    """ Check that input quantities in quantity list are possible
     
    181159
    182160
    183 ##
    184 # @brief Calculate velocity bearing from North.
    185 # @param uh ??
    186 # @param vh ??
    187 # @return The calculated bearing.
    188161def calc_bearing(uh, vh):
    189162    """ Calculate velocity bearing from North
     
    204177
    205178
    206 ##
    207 # @brief Create a nested sub-directory path.
    208 # @param root_directory The base diretory path.
    209 # @param directories An iterable of sub-directory names.
    210 # @return The final joined directory path.
    211 # @note If each sub-directory doesn't exist, it will be created.
    212179def add_directories(root_directory, directories):
    213180    """
     
    227194
    228195
    229 ##
    230 # @brief
    231 # @param verbose
    232 # @param kwargs
    233 # @return
    234 # @note TEMP
    235196def store_parameters(verbose=False,**kwargs):
    236197    """Temporary Interface to new location"""
     
    245206
    246207
    247 ##
    248 # @brief Remove vertices that are not associated with any triangle.
    249 # @param verts An iterable (or array) of points.
    250 # @param triangles An iterable of 3 element tuples.
    251 # @param number_of_full_nodes ??
    252 # @return (verts, triangles) where 'verts' has been updated.
    253208def remove_lone_verts(verts, triangles, number_of_full_nodes=None):
    254209    """Removes vertices that are not associated with any triangles.
     
    301256
    302257
    303 ##
    304 # @brief Compute centroid values from vertex values
    305 # @param x Values at vertices of triangular mesh.
    306 # @param triangles Nx3 integer array pointing to vertex information.
    307 # @return [N] array of centroid values.
    308258def get_centroid_values(x, triangles):
    309259    """Compute centroid values from vertex values
     
    351301
    352302
    353 ##
    354 # @brief Plot time series from CSV files.
    355 # @param directories_dic
    356 # @param output_dir
    357 # @param base_name
    358 # @param plot_numbers
    359 # @param quantities
    360 # @param extra_plot_name
    361 # @param assess_all_csv_files
    362 # @param create_latex
    363 # @param verbose
    364 # @note Assumes that 'elevation' is in the CSV file(s).
    365303def csv2timeseries_graphs(directories_dic={},
    366304                          output_dir='',
     
    779717    if verbose: log.critical('Finished closing plots')
    780718
    781 ##
    782 # @brief Return min and max of an iterable.
    783 # @param list The iterable to return min & max of.
    784 # @return (min, max) of 'list'.
    785719def get_min_max_values(list=None):
    786720    """
     
    793727
    794728
    795 ##
    796 # @brief Get runup around a point in a CSV file.
    797 # @param gauge_filename gauge file name.
    798 # @param sww_filename SWW file name.
    799 # @param runup_filename Name of file to report into.
    800 # @param size ??
    801 # @param verbose ??
    802729def get_runup_data_for_locations_from_file(gauge_filename,
    803730                                           sww_filename,
     
    851778        file.close()
    852779
    853 ##
    854 # @brief ??
    855 # @param  ??
    856 # @param gauge_file ??
    857 # @param out_name ??
    858 # @param quantities ??
    859 # @param verbose ??
    860 # @param use_cache ??
    861780def sww2csv_gauges(sww_file,
    862781                   gauge_file,
     
    949868                   output_centroids)                   
    950869   
    951 ##
    952 # @brief Get a wave height at a certain depth given wave height at another depth.
    953 # @param d1 The first depth.
    954 # @param d2 The second depth.
    955 # @param h1 Wave ampitude at d1
    956 # @param verbose True if this function is to be verbose.
    957 # @return The wave height at d2.
    958870def greens_law(d1, d2, h1, verbose=False):
    959871    """Green's Law
     
    998910       
    999911
    1000 ##
    1001 # @brief Get the square-root of a value.
    1002 # @param s The value to get the square-root of.
    1003 # @return The square-root of 's'.
    1004912def square_root(s):
    1005913    return sqrt(s)
  • trunk/anuga_core/source/anuga/geospatial_data/geospatial_data.py

    r8124 r8147  
    3232
    3333
    34 ##
    35 # @brief ??
    3634class Geospatial_data:
    3735
    38     ##
    39     # @brief
    40     # @param data_points Mx2 iterable of tuples or array of x,y coordinates.
    41     # @param attributes Associated values for each data point.
    42     # @param geo_reference ??
    43     # @param default_attribute_name ??
    44     # @param file_name
    45     # @param latitudes ??
    46     # @param longitudes ??
    47     # @param points_are_lats_longs True if points are lat/long, not UTM.
    48     # @param max_read_lines Size of block to read, if blocking.
    49     # @param load_file_now True if blocking but we eant to read file now.
    50     # @param verbose True if this class instance is verbose.
    5136    def __init__(self,
    5237                 data_points=None, # this can also be a points file name
     
    196181                        # print 'data as a pts NetCDF format'
    197182
    198     ##
    199     # @brief Return length of the points set.
    200183    def __len__(self):
    201184        return len(self.data_points)
    202185
    203     ##
    204     # @brief Return a string representation of the points set.
    205186    def __repr__(self):
    206187        return str(self.get_data_points(absolute=True))
    207188
    208     ##
    209     # @brief Check data points.
    210     # @param data_points Points data to check and store in instance.
    211     # @note Throws ValueError exception if no data.
    212189    def check_data_points(self, data_points):
    213190        """Checks data points"""
     
    223200                assert self.data_points.shape[1] == 2
    224201
    225     ##
    226     # @brief Check and assign attributes data.
    227     # @param attributes Dictionary or scalar to save as .attributes.
    228     # @note Throws exception if unable to convert dict keys to numeric.
    229202    def set_attributes(self, attributes):
    230203        """Check and assign attributes dictionary"""
     
    249222        self.attributes = attributes
    250223
    251     ##
    252     # @brief Set the georeference of geospatial data.
    253     # @param geo_reference The georeference data to set.
    254     # @note Will raise exception if param not instance of Geo_reference.
    255224    def set_geo_reference(self, geo_reference):
    256225        """Set the georeference of geospatial data.
     
    281250        self.geo_reference = geo_reference
    282251
    283     ##
    284     # @brief Set default attribute name.
    285     # @param default_attribute_name The default to save.
    286252    def set_default_attribute_name(self, default_attribute_name):
    287253        self.default_attribute_name = default_attribute_name
    288254
    289     ##
    290     # @brief Set the instance verbose flag.
    291     # @param verbose The value to save.
    292     # @note Will raise exception if param is not True or False.
    293255    def set_verbose(self, verbose=False):
    294256        if verbose in [False, True]:
     
    298260            raise Exception(msg)
    299261
    300     ##
    301     # @brief Clip geospatial data by a given polygon.
    302     # @param polygon The polygon to clip with.
    303     # @param closed True if points on clip boundary are not included in result.
    304     # @param verbose True if this function is verbose.
    305262    def clip(self, polygon, closed=True, verbose=False):
    306263        """Clip geospatial data by a polygon
     
    335292        return clipped_G
    336293
    337     ##
    338     # @brief Clip points data by polygon, return points outside polygon.
    339     # @param polygon The polygon to clip with.
    340     # @param closed True if points on clip boundary are not included in result.
    341     # @param verbose True if this function is verbose.
    342294    def clip_outside(self, polygon, closed=True, verbose=False):
    343295        """Clip geospatial date by a polygon, keeping data OUTSIDE of polygon
     
    367319        return clipped_G
    368320
    369     ##
    370     # @brief Get instance geo_reference data.
    371321    def get_geo_reference(self):
    372322        return self.geo_reference
    373323
    374     ##
    375     # @brief Get coordinates for all data points as an Nx2 array.
    376     # @param absolute If True, return UTM, else relative to xll/yll corners.
    377     # @param geo_reference If supplied, points are relative to it.
    378     # @param as_lat_long If True, return points as lat/lon.
    379     # @param isSouthHemisphere If True, return lat/lon points in S.Hemi.
    380     # @return A set of data points, in appropriate form.
    381324    def get_data_points(self,
    382325                        absolute=True,
     
    422365            return self.data_points
    423366
    424     ##
    425     # @brief Get value for attribute name.
    426     # @param attribute_name Name to get value for.
    427     # @note If name passed is None, return default attribute value.
    428367    def get_attributes(self, attribute_name=None):
    429368        """Return values for one named attribute.
     
    448387        return self.attributes[attribute_name]
    449388
    450     ##
    451     # @brief Get all instance attributes.
    452     # @return The instance attribute dictionary, or None if no attributes.
    453389    def get_all_attributes(self):
    454390        """Return values for all attributes.
     
    458394        return self.attributes
    459395
    460     ##
    461     # @brief Override __add__() to allow addition of geospatial objects.
    462     # @param self This object.
    463     # @param other The second object.
    464     # @return The new geospatial object.
    465396    def __add__(self, other):
    466397        """Returns the addition of 2 geospatial objects,
     
    518449        return Geospatial_data(new_points, new_attributes, new_geo_ref)
    519450
    520     ##
    521     # @brief Override the addition case where LHS isn't geospatial object.
    522     # @param self This object.
    523     # @param other The second object.
    524     # @return The new geospatial object.
    525451    def __radd__(self, other):
    526452        """Handle cases like None + Geospatial_data(...)"""
     
    532458################################################################################
    533459
    534     ##
    535     # @brief Import a .txt, .csv or .pts points data file.
    536     # @param file_name
    537     # @param delimiter
    538     # @param verbose True if this function is to be verbose.
    539     # @note Will throw IOError or SyntaxError if there is a problem.
    540460    def import_points_file(self, file_name, delimiter=None, verbose=False):
    541461        """ load an .txt, .csv or .pts file
     
    581501        self.geo_reference = geo_reference
    582502
    583     ##
    584     # @brief Write points data to a file (.csv or .pts).
    585     # @param file_name Path to file to write.
    586     # @param absolute ??
    587     # @param as_lat_long ??
    588     # @param isSouthHemisphere ??
    589503    def export_points_file(self, file_name, absolute=True,
    590504                           as_lat_long=False, isSouthHemisphere=True):
     
    638552            raise IOError(msg)
    639553
    640     ##
    641     # @brief Get a subset of data that is referred to by 'indices'.
    642     # @param indices A list of indices to select data subset with.
    643     # @return A geospatial object containing data subset.
    644554    def get_sample(self, indices):
    645555        """ Returns a object which is a subset of the original
     
    667577        return Geospatial_data(sampled_points, sampled_attributes)
    668578
    669     ##
    670     # @brief Split one geospatial object into two.
    671     # @param factor Relative size to make first result object.
    672     # @param seed_num Random 'seed' - used only for unit test.
    673     # @param verbose True if this function is to be verbose.
    674     # @note Points in each result object are selected randomly.
    675579    def split(self, factor=0.5, seed_num=None, verbose=False):
    676580        """Returns two geospatial_data object, first is the size of the 'factor'
     
    766670        return G1, G2
    767671
    768     ##
    769     # @brief Allow iteration over this object.
    770672    def __iter__(self):
    771673        """Read in the header, number_of_points and save the
     
    817719        return self
    818720
    819     ##
    820     # @brief Read another block into the instance.
    821721    def next(self):
    822722        """read a block, instanciate a new geospatial and return it"""
     
    916816                 'The attribute values must be numeric.\n')
    917817
    918 ##
    919 # @brief ??
    920 # @param latitudes ??
    921 # @param longitudes ??
    922 # @param geo_reference ??
    923 # @param data_points ??
    924 # @param points_are_lats_longs ??
    925 # @note IS THIS USED???
    926818def _set_using_lat_long(latitudes,
    927819                        longitudes,
     
    966858
    967859
    968 ##
    969 # @brief Read a .pts data file.
    970 # @param file_name Path to file to read.
    971 # @param verbose True if this function is to be verbose.
    972 # @return (pointlist, attributes, geo_reference)
    973860def _read_pts_file(file_name, verbose=False):
    974861    """Read .pts NetCDF file
     
    1017904
    1018905
    1019 ##
    1020 # @brief Read a .csv data file.
    1021 # @param file_name Path to the .csv file to read.
    1022 # @param verbose True if this function is to be verbose.
    1023906def _read_csv_file(file_name, verbose=False):
    1024907    """Read .csv file
     
    1050933
    1051934
    1052 ##
    1053 # @brief Read a .csv file header.
    1054 # @param file_pointer Open descriptor of the file to read.
    1055 # @param delimiter Header line delimiter string, split on this string.
    1056 # @param verbose True if this function is to be verbose.
    1057 # @return A tuple of (<cleaned header string>, <input file_pointer>)
    1058 
    1059935CSV_DELIMITER = ','
    1060936
     
    1071947    return header, file_pointer
    1072948
    1073 ##
    1074 # @brief Read a .csv file, with blocking.
    1075 # @param file_pointer Open descriptor of the file to read.
    1076 # @param header List of already read .csv header fields.
    1077 # @param delimiter Delimiter string header was split on.
    1078 # @param max_read_lines The max number of lines to read before blocking.
    1079 # @param verbose True if this function is to be verbose.
    1080 # @note Will throw IndexError, SyntaxError exceptions.
    1081949def _read_csv_file_blocking(file_pointer,
    1082950                            header,
     
    11601028
    11611029
    1162 ##
    1163 # @brief Read a .pts file header.
    1164 # @param fid Handle to the open .pts file.
    1165 # @param verbose True if the function is to be verbose.
    1166 # @return (geo_reference, keys, fid.dimensions['number_of_points'])
    1167 # @note Will throw IOError and AttributeError exceptions.
    11681030def _read_pts_file_header(fid, verbose=False):
    11691031    '''Read the geo_reference and number_of_points from a .pts file'''
     
    11871049
    11881050
    1189 ##
    1190 # @brief Read the body of a .pts file, with blocking.
    1191 # @param fid Handle to already open file.
    1192 # @param start_row Start row index of points to return.
    1193 # @param fin_row End row index of points to return.
    1194 # @param keys Iterable of keys to return.
    1195 # @return Tuple of (pointlist, attributes).
    11961051def _read_pts_file_blocking(fid, start_row, fin_row, keys):
    11971052    '''Read the body of a .pts file.'''
     
    12061061
    12071062
    1208 ##
    1209 # @brief Write a .pts data file.
    1210 # @param file_name Path to the file to write.
    1211 # @param write_data_points Data points to write.
    1212 # @param write_attributes Attributes to write.
    1213 # @param write_geo_reference Georef to write.
    12141063def _write_pts_file(file_name,
    12151064                    write_data_points,
     
    12641113
    12651114
    1266 ##
    1267 # @brief Write a .csv data file.
    1268 # @param file_name Path to the file to write.
    1269 # @param write_data_points Data points to write.
    1270 # @param write_attributes Attributes to write.
    1271 # @param as_lat_long True if points are lat/lon, else x/y.
    1272 # @param delimiter The CSV delimiter to use.
    12731115def _write_csv_file(file_name,
    12741116                    write_data_points,
     
    13111153
    13121154
    1313 ##
    1314 # @brief Write a URS file.
    1315 # @param file_name The path of the file to write.
    1316 # @param points
    1317 # @param delimiter
    13181155def _write_urs_file(file_name, points, delimiter=' '):
    13191156    """Write a URS format file.
     
    13351172
    13361173
    1337 ##
    1338 # @brief ??
    1339 # @param point_atts ??
    1340 # @return ??
    13411174def _point_atts2array(point_atts):
    13421175    point_atts['pointlist'] = num.array(point_atts['pointlist'], num.float)
     
    13491182
    13501183
    1351 ##
    1352 # @brief Convert geospatial object to a points dictionary.
    1353 # @param geospatial_data The geospatial object to convert.
    1354 # @return A points dictionary.
    13551184def geospatial_data2points_dictionary(geospatial_data):
    13561185    """Convert geospatial data to points_dictionary"""
     
    13701199
    13711200
    1372 ##
    1373 # @brief Convert a points dictionary to a geospatial object.
    1374 # @param points_dictionary A points dictionary to convert.
    13751201def points_dictionary2geospatial_data(points_dictionary):
    13761202    """Convert points_dictionary to geospatial data object"""
     
    13921218
    13931219
    1394 ##
    1395 # @brief Ensure that points are in absolute coordinates.
    1396 # @param points A list or array of points to check, or geospatial object.
    1397 # @param geo_reference If supplied,
    1398 # @return ??
    13991220def ensure_absolute(points, geo_reference=None):
    14001221    """Ensure that points are in absolute coordinates.
     
    14401261
    14411262
    1442 ##
    1443 # @brief
    1444 # @param points
    1445 # @param geo_reference
    1446 # @return A geospatial object.
    14471263def ensure_geospatial(points, geo_reference=None):
    14481264    """Convert various data formats to a geospatial_data instance.
     
    14841300
    14851301
    1486 ##
    1487 # @brief
    1488 # @param data_file
    1489 # @param alpha_list
    1490 # @param mesh_file
    1491 # @param boundary_poly
    1492 # @param mesh_resolution
    1493 # @param north_boundary
    1494 # @param south_boundary
    1495 # @param east_boundary
    1496 # @param west_boundary
    1497 # @param plot_name
    1498 # @param split_factor
    1499 # @param seed_num
    1500 # @param cache
    1501 # @param verbose
    15021302def find_optimal_smoothing_parameter(data_file,
    15031303                                     alpha_list=None,
     
    16981498
    16991499
    1700 ##
    1701 # @brief
    1702 # @param data_file
    1703 # @param alpha_list
    1704 # @param mesh_file
    1705 # @param boundary_poly
    1706 # @param mesh_resolution
    1707 # @param north_boundary
    1708 # @param south_boundary
    1709 # @param east_boundary
    1710 # @param west_boundary
    1711 # @param plot_name
    1712 # @param split_factor
    1713 # @param seed_num
    1714 # @param cache
    1715 # @param verbose
    17161500def old_find_optimal_smoothing_parameter(data_file,
    17171501                                         alpha_list=None,
  • trunk/anuga_core/source/anuga/utilities/test_numerical_tools.py

    r8124 r8147  
    467467#        t(num.array('abc', num.float), False)
    468468
    469     ##
    470     # @brief Test to see if ensure_numeric() behaves as we expect.
    471     # @note Under Numeric ensure_numeric() *always* returned a copy (bug).
    472     #       Under numpy it copies only when it has to.
    473469    def test_ensure_numeric_copy(self):
     470        """Test to see if ensure_numeric() behaves as we expect.
     471
     472        Under Numeric ensure_numeric() *always* returned a copy (bug).
     473        Under numpy it copies only when it has to.
     474        """
     475
    474476        #####
    475477        # Make 'points' a _list_ of coordinates.
Note: See TracChangeset for help on using the changeset viewer.