Changeset 7185


Ignore:
Timestamp:
Jun 11, 2009, 3:28:43 PM (13 years ago)
Author:
rwilson
Message:

Initial conversion to numpy.

Location:
branches/numpy_anuga_validation/circular_island
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/numpy_anuga_validation/circular_island/get_compared_graphs.py

    r5142 r7185  
    1212#from anuga.utilities.polygon import read_polygon#, plot_polygons
    1313#from math import cos,pi,sin,tan#,sqrt
    14 #from Numeric import array, zeros, Float, allclose,resize,sqrt
    1514#from anuga.shallow_water.data_manager import csv2dict
    1615#from time import localtime, strftime, gmtime
  • branches/numpy_anuga_validation/circular_island/run_circular.py

    r5442 r7185  
    1515from anuga.abstract_2d_finite_volumes.util import file_function, sww2csv_gauges,csv2timeseries_graphs
    1616from anuga.pmesh.mesh_interface import create_mesh_from_regions
    17 from anuga.utilities.polygon import read_polygon#, plot_polygons
    18 from math import cos,pi,sin,tan#,sqrt
    19 from Numeric import array, zeros, Float, allclose,resize,sqrt
     17from anuga.utilities.polygon import read_polygon
     18from math import cos,pi,sin,tan
     19import numpy as num
    2020from anuga.shallow_water.data_manager import csv2dict
    2121from time import localtime, strftime, gmtime
    2222from anuga.utilities.system_tools import get_user_name, get_host_name
    2323from os import sep, environ, getenv
     24from anuga.config import netcdf_float
     25from Scientific.IO.NetCDF import NetCDFFile
     26
    2427#-------------------------
    2528# Create Domain from mesh
     
    5760
    5861    print 'Preparing time boundary from %s' %textversion
    59     from Numeric import array
    6062
    6163    fid = open(textversion)
     
    7072
    7173    N = len(lines)
    72     T = zeros(N, Float)  #Time
    73     Q = zeros(N, Float)  #Values
     74    T = num.zeros(N, num.float)  #Time
     75    Q = num.zeros(N, num.float)  #Values
    7476
    7577    for i, line in enumerate(lines):
     
    8284
    8385    #Create tms file
    84     from Scientific.IO.NetCDF import NetCDFFile
    85 
    8686    print 'Writing to', filename
    8787    fid = NetCDFFile(filename[:-4] + '.tms', 'w')
     
    9191    fid.starttime = 0.0
    9292    fid.createDimension('number_of_timesteps', len(T))
    93     fid.createVariable('time', Float, ('number_of_timesteps',))
     93    fid.createVariable('time', netcdf_float, ('number_of_timesteps',))
    9494    fid.variables['time'][:] = T
    9595
    96     fid.createVariable('stage', Float, ('number_of_timesteps',))
     96    fid.createVariable('stage', netcdf_float, ('number_of_timesteps',))
    9797    fid.variables['stage'][:] = Q[:]
    9898
    99     fid.createVariable('xmomentum', Float, ('number_of_timesteps',))
     99    fid.createVariable('xmomentum', netcdf_float, ('number_of_timesteps',))
    100100    fid.variables['xmomentum'][:] = 0.0
    101101
    102     fid.createVariable('ymomentum', Float, ('number_of_timesteps',))
     102    fid.createVariable('ymomentum', netcdf_float, ('number_of_timesteps',))
    103103    fid.variables['ymomentum'][:] = 0.0
    104104
     
    181181def circular_island_elevation(x,y):
    182182    water_depth = 0.32
    183     list_xy = sqrt((center_x-x)**2+(center_y-L-y)**2)
     183    list_xy = num.sqrt((center_x-x)**2+(center_y-L-y)**2)
    184184    print 'x',min(x),max(x)
    185185    print 'y',min(y),max(y)
  • branches/numpy_anuga_validation/circular_island/sqrt_table_run_circular.py

    r5442 r7185  
    1717from anuga.utilities.polygon import read_polygon#, plot_polygons
    1818from math import cos,pi,sin,tan,sqrt
    19 from Numeric import array, zeros, Float, allclose,resize
     19import numpy as num
    2020from anuga.shallow_water.data_manager import csv2dict
    2121from time import localtime, strftime, gmtime
    2222from anuga.utilities.system_tools import get_user_name, get_host_name
    2323from os import sep, environ, getenv
     24from anuga.config import netcdf_float
     25from Scientific.IO.NetCDF import NetCDFFile
     26
     27
    2428#-------------------------
    2529# Create Domain from mesh
     
    5660
    5761    print 'Preparing time boundary from %s' %textversion
    58     from Numeric import array
    5962
    6063    fid = open(textversion)
     
    6972
    7073    N = len(lines)
    71     T = zeros(N, Float)  #Time
    72     Q = zeros(N, Float)  #Values
     74    T = num.zeros(N, num.float)  #Time
     75    Q = num.zeros(N, num.float)  #Values
    7376
    7477    for i, line in enumerate(lines):
     
    8184
    8285    #Create tms file
    83     from Scientific.IO.NetCDF import NetCDFFile
    84 
    8586    print 'Writing to', filename
    8687    fid = NetCDFFile(filename[:-4] + '.tms', 'w')
     
    9091    fid.starttime = 0.0
    9192    fid.createDimension('number_of_timesteps', len(T))
    92     fid.createVariable('time', Float, ('number_of_timesteps',))
     93    fid.createVariable('time', netcdf_float, ('number_of_timesteps',))
    9394    fid.variables['time'][:] = T
    9495
    95     fid.createVariable('stage', Float, ('number_of_timesteps',))
     96    fid.createVariable('stage', netcdf_float, ('number_of_timesteps',))
    9697    fid.variables['stage'][:] = Q[:]
    9798
    98     fid.createVariable('xmomentum', Float, ('number_of_timesteps',))
     99    fid.createVariable('xmomentum', netcdf_float, ('number_of_timesteps',))
    99100    fid.variables['xmomentum'][:] = 0.0
    100101
    101     fid.createVariable('ymomentum', Float, ('number_of_timesteps',))
     102    fid.createVariable('ymomentum', netcdf_float, ('number_of_timesteps',))
    102103    fid.variables['ymomentum'][:] = 0.0
    103104
Note: See TracChangeset for help on using the changeset viewer.