- Timestamp:
- Jun 30, 2009, 2:07:41 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/source/anuga/abstract_2d_finite_volumes/ermapper_grids.py
r6161 r7276 2 2 3 3 # from os import open, write, read 4 import Numericas num5 6 celltype_map = {'IEEE4ByteReal': num. Float32, 'IEEE8ByteReal': num.Float64}4 import numpy as num 5 6 celltype_map = {'IEEE4ByteReal': num.float32, 'IEEE8ByteReal': num.float64} 7 7 8 8 … … 11 11 write_ermapper_grid(ofile, data, header = {}): 12 12 13 Function to write a 2D Numeric array to an ERMapper grid. There are a series of conventions adopted within13 Function to write a 2D numeric array to an ERMapper grid. There are a series of conventions adopted within 14 14 this code, specifically: 15 15 1) The registration coordinate for the data is the SW (or lower-left) corner of the data 16 16 2) The registration coordinates refer to cell centres 17 3) The data is a 2D Numeric array with the NW-most data in element (0,0) and the SE-most data in element (N,M)17 3) The data is a 2D numeric array with the NW-most data in element (0,0) and the SE-most data in element (N,M) 18 18 where N is the last line and M is the last column 19 19 4) There has been no testng of the use of a rotated grid. Best to keep data in an NS orientation … … 163 163 return header 164 164 165 def write_ermapper_data(grid, ofile, data_format = num.Float32):165 def write_ermapper_data(grid, ofile, data_format=num.float32): 166 166 167 167 … … 193 193 194 194 195 def read_ermapper_data(ifile, data_format = num. Float32):195 def read_ermapper_data(ifile, data_format = num.float32): 196 196 # open input file in a binary format and read the input string 197 197 fid = open(ifile,'rb') … … 199 199 fid.close() 200 200 201 # convert input string to required format (Note default format is num. Float32)201 # convert input string to required format (Note default format is num.float32) 202 202 grid_as_float = num.fromstring(input_string,data_format) 203 203 return grid_as_float
Note: See TracChangeset
for help on using the changeset viewer.