Changeset 2053
- Timestamp:
- Nov 24, 2005, 9:36:57 AM (19 years ago)
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
inundation/pyvolution/data_manager.py
r2045 r2053 1694 1694 header['ydimension'] = str(cellsize) 1695 1695 header['value'] = '"' + quantity + '"' 1696 header['celltype'] = 'IEEE8ByteReal' 1696 1697 1697 1698 … … 1723 1724 1724 1725 1725 if verbose: print 'Writing %s' % ascfile1726 if verbose: print 'Writing %s' %demfile 1726 1727 NODATA_value = -9999 1727 1728 -
inundation/pyvolution/ermapper_grids.py
r1892 r2053 3 3 # from os import open, write, read 4 4 import Numeric 5 6 celltype_map = {'IEEE4ByteReal': Numeric.Float32, 'IEEE8ByteReal': Numeric.Float64} 7 5 8 6 9 def write_ermapper_grid(ofile, data, header = {}): … … 60 63 header['nrofcellsperline'] = str(data_size[1]) 61 64 62 write_ermapper_data(data,data_file) 63 write_ermapper_header(header_file,header) 65 66 header = create_default_header(header) 67 write_ermapper_header(header_file, header) 68 write_ermapper_data(data, data_file, data_format = header['celltype']) 69 64 70 65 71 def read_ermapper_grid(ifile): 66 67 72 ers_index = ifile.find('.ers') 68 73 if ers_index > 0: … … 84 89 def write_ermapper_header(ofile, header = {}): 85 90 86 header = create_default_header(header)91 #header = create_default_header(header) 87 92 # Determine if the dataset is in lats/longs or eastings/northings and set header parameters 88 93 # accordingly … … 159 164 160 165 def write_ermapper_data(grid, ofile, data_format = Numeric.Float32): 166 167 168 if isinstance(data_format, basestring): 169 #celltype_map is defined at top of code 170 if celltype_map.has_key(data_format): 171 data_format = celltype_map[data_format] 172 else: 173 msg = 'Format %s is not yet defined by celltype_map' %data_format 174 raise msg 175 176 161 177 # Convert the array to data_format (default format is Float32) 162 178 grid_as_float = grid.astype(data_format) -
production/karratha_2005/export_results.py
r1920 r2053 2 2 3 3 from pyvolution.data_manager import sww2dem 4 from pyvolution.ermapper_grids import read_ermapper_grid 4 5 5 6 … … 9 10 name = project.outputname 10 11 11 sww2dem(name, basename_out = name + '_momentum',12 #quantity = 'stage-elevation', #Depth13 quantity = '(xmomentum**2 + ymomentum**2)**0.5', #Absolute momentum12 sww2dem(name, basename_out = name, 13 quantity = 'stage-elevation', #Depth 14 #quantity = '(xmomentum**2 + ymomentum**2)**0.5', #Absolute momentum 14 15 cellsize = 50, 16 #cellsize = 500, 15 17 #cellsize = 10, 16 18 #easting_min = 465646, … … 22 24 format = 'ers') 23 25 26 27 #Check 28 29 #data = read_ermapper_grid(name) 30 #print 'Values from %s are in [%f, %f]' %(name, min(data.flat), max(data.flat))
Note: See TracChangeset
for help on using the changeset viewer.