Ignore:
Timestamp:
Nov 6, 2008, 4:42:14 PM (16 years ago)
Author:
rwilson
Message:

NumPy? conversion.

Location:
anuga_core/source_numpy_conversion/anuga/visualiser
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • anuga_core/source_numpy_conversion/anuga/visualiser/offline.py

    r4325 r5913  
    1 from Numeric import array, Float, ravel, zeros
     1import numpy
    22from Scientific.IO.NetCDF import NetCDFFile
    33from Tkinter import Button, E, Tk, W, Label, StringVar, Scale, HORIZONTAL
     
    8080        else:
    8181            N_vert = len(fin.variables[quantityName])
    82         x = ravel(array(fin.variables['x'], Float))
    83         y = ravel(array(fin.variables['y'], Float))
     82        x = numpy.ravel(numpy.array(fin.variables['x'], numpy.float))
     83        y = numpy.ravel(numpy.array(fin.variables['y'], numpy.float))
    8484        if dynamic is True:
    85             q = array(fin.variables[quantityName][frameNumber], Float)
    86         else:
    87             q = ravel(array(fin.variables[quantityName], Float))
     85            q = numpy.array(fin.variables[quantityName][frameNumber], numpy.float)
     86        else:
     87            q = numpy.ravel(numpy.array(fin.variables[quantityName], numpy.float))
    8888
    8989        q *= self.height_zScales[quantityName]
     
    123123        for q in filter(lambda n:n != 'x' and n != 'y' and n != 'z' and n != 'time' and n != 'volumes', fin.variables.keys()):
    124124            if len(fin.variables[q].shape) == 1: # Not a time-varying quantity
    125                 quantities[q] = ravel(array(fin.variables[q], Float))
     125                quantities[q] = numpy.ravel(numpy.array(fin.variables[q], numpy.float))
    126126            else: # Time-varying, get the current timestep data
    127                 quantities[q] = array(fin.variables[q][self.frameNumber], Float)
     127                quantities[q] = numpy.array(fin.variables[q][self.frameNumber], numpy.float)
    128128        fin.close()
    129129        return quantities
  • anuga_core/source_numpy_conversion/anuga/visualiser/realtime.py

    r4897 r5913  
    1 from Numeric import Float, zeros, shape
     1import numpy
    22from Tkinter import Button, E, Tk, W
    33from threading import Event
     
    4747
    4848        # Also build vert_index - a list of the x & y values of each vertex
    49         self.vert_index = zeros((N_vert,2), Float)
     49        self.vert_index = numpy.zeros((N_vert,2), numpy.float)
    5050        for n in range(N_tri):
    5151            self.vtk_cells.InsertNextCell(3)
     
    5656    def update_height_quantity(self, quantityName, dynamic=True):
    5757        N_vert = len(self.source.get_vertex_coordinates())
    58         qty_index = zeros(N_vert, Float)
     58        qty_index = numpy.zeros(N_vert, numpy.float)
    5959        triangles = self.source.get_triangles()
    6060        vertex_values, _ = self.source.get_quantity(quantityName).get_vertex_values(xy=False, smooth=False)
Note: See TracChangeset for help on using the changeset viewer.