Ignore:
Timestamp:
Feb 18, 2009, 2:44:41 PM (14 years ago)
Author:
rwilson
Message:

Ongoing conversion changes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/numpy/anuga/load_mesh/loadASCII.py

    r6304 r6360  
    5353    Following lines:  <segment #> <vertex #>  <vertex #> [boundary tag]
    5454"""
     55
    5556##FIXME (DSG-DSG) Is the dict format mentioned above a list of a numeric array?
    5657#  Needs to be defined
     
    5859
    5960from string import  find, rfind
    60 import numpy as num
    6161from os.path import splitext
     62import exceptions
    6263
    6364from anuga.coordinate_transforms.geo_reference import Geo_reference, TITLE, \
    6465                                                      TitleError
    65 
    66 from Scientific.IO.NetCDF import NetCDFFile
    6766from anuga.config import netcdf_mode_r, netcdf_mode_w, netcdf_mode_a
    6867from anuga.config import netcdf_float, netcdf_char, netcdf_int
    6968
    70 import exceptions
     69from Scientific.IO.NetCDF import NetCDFFile
     70
     71import numpy as num
    7172
    7273
     
    8788
    8889    Note: will throw an IOError if it can't load the file.
    89     Catch these!
    9090    """
    9191
     
    149149# @brief Read a mesh file into a dictionary.
    150150# @param ofile Path of the file to read.
    151 # @return Data dictionary from the mesh (.tsh) file.
     151# @return Points dictionary from the mesh (.tsh) file.
    152152def _read_tsh_file(ofile):
    153153    """Read the text file format for meshes"""
     
    164164
    165165##
    166 # @brief ??
     166# @brief Read triangulation data from a file, leave file open.
    167167# @param fd An open descriptor of the file to read.
    168168# @return A dictionary ...
     
    264264
    265265##
    266 # @brief
     266# @brief Read a mesh outline file.
    267267# @param fd An open descriptor of the file to read.
    268 # @return A dictionary ...
     268# @return A Points dictionary.
    269269# @note If file has no mesh info, an empty dict will be returned.
    270270def _read_outline(fd):
     
    393393
    394394    return meshDict
    395 
    396 
    397 ##
    398 # @brief Clean up a line with delimited fields.
    399 # @param line The string to be cleaned.
    400 # @param delimiter String used a delimiter when splitting 'line'.
    401 # @return A list of delimited fields with white-space removed from ends.
    402 # @note Will also remove any field that was originally ''.
    403 def clean_line(line, delimiter):
    404     """Clean up a line - return fields with end space removed."""
    405 
    406     line = line.strip()
    407     numbers = line.split(delimiter)
    408     i = len(numbers) - 1
    409     while i >= 0:
    410         if numbers[i] == '':
    411             numbers.pop(i)
    412         else:
    413             numbers[i] = numbers[i].strip()
    414 
    415         i += -1
    416 
    417     return numbers
    418395
    419396
     
    649626        num.array(mesh['vertex_attribute_titles'], num.character)
    650627    mesh['segments'] = num.array(mesh['segments'], IntType)
     628    print ("Before num.array(), mesh['segment_tags']=%s"
     629           % str(mesh['segment_tags']))
    651630    mesh['segment_tags'] = num.array(mesh['segment_tags'], num.character)
     631    print ("After num.array(), mesh['segment_tags']=%s"
     632           % str(mesh['segment_tags']))
     633    print "mesh['segment_tags'].shape=%s" % str(mesh['segment_tags'].shape)
    652634    mesh['triangles'] = num.array(mesh['triangles'], IntType)
    653635    mesh['triangle_tags'] = num.array(mesh['triangle_tags'])
     
    967949    fd.close()
    968950
    969 
    970951################################################################################
    971952#  IMPORT/EXPORT POINTS FILES
Note: See TracChangeset for help on using the changeset viewer.