Changeset 2045
- Timestamp:
- Nov 21, 2005, 1:49:50 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
inundation/pyvolution/data_manager.py
r2038 r2045 1427 1427 easting_max = None, 1428 1428 northing_min = None, 1429 northing_max = None, 1429 northing_max = None, 1430 expand_search = False, #To avoid intractable situations (This will be fixed when least_squares gets redesigned) 1430 1431 verbose = False, 1431 1432 origin = None, … … 1529 1530 1530 1531 1532 #FIXME: Refactor using code from file_function.statistics 1533 #Something like print swwstats(swwname) 1534 if verbose: 1535 x = fid.variables['x'][:] 1536 y = fid.variables['y'][:] 1537 times = fid.variables['time'][:] 1538 print '------------------------------------------------' 1539 print 'Statistics of SWW file:' 1540 print ' Name: %s' %swwfile 1541 print ' Reference:' 1542 print ' Lower left corner: [%f, %f]'\ 1543 %(xllcorner, yllcorner) 1544 print ' Start time: %f' %fid.starttime[0] 1545 print ' Extent:' 1546 print ' x [m] in [%f, %f], len(x) == %d'\ 1547 %(min(x.flat), max(x.flat), len(x.flat)) 1548 print ' y [m] in [%f, %f], len(y) == %d'\ 1549 %(min(y.flat), max(y.flat), len(y.flat)) 1550 print ' t [s] in [%f, %f], len(t) == %d'\ 1551 %(min(times), max(times), len(times)) 1552 print ' Quantities [SI units]:' 1553 for name in ['stage', 'xmomentum', 'ymomentum', 'elevation']: 1554 q = fid.variables[name][:].flat 1555 print ' %s in [%f, %f]' %(name, min(q), max(q)) 1556 1557 1558 1559 1560 1531 1561 #Get quantity and reduce if applicable 1532 1562 if verbose: print 'Processing quantity %s' %quantity … … 1539 1569 1540 1570 q = apply_expression_to_dictionary(quantity, quantity_dict) 1571 1541 1572 1542 1573 … … 1555 1586 assert len(q.shape) == 1 1556 1587 assert q.shape[0] == number_of_points 1588 1589 1590 if verbose: 1591 print 'Processed values for %s are in [%f, %f]' %(quantity, min(q), max(q)) 1557 1592 1558 1593 … … 1625 1660 1626 1661 interp = Interpolation(vertex_points, volumes, grid_points, alpha=0.0, 1627 precrop = False, expand_search = True, 1662 precrop = False, 1663 expand_search = expand_search, 1628 1664 verbose = verbose) 1665 1666 1629 1667 1630 1668 #Interpolate using quantity values 1631 1669 if verbose: print 'Interpolating' 1632 1670 grid_values = interp.interpolate(q).flat 1671 1672 if verbose: 1673 print 'Interpolated values are in [%f, %f]' %(min(grid_values), 1674 max(grid_values)) 1633 1675 1634 1676 if format.lower() == 'ers': … … 2297 2339 outfile.variables['x'][:] = x - xllcorner 2298 2340 outfile.variables['y'][:] = y - yllcorner 2299 outfile.variables['z'][:] = z 2300 outfile.variables['elevation'][:] = z #FIXME HACK2341 outfile.variables['z'][:] = z #FIXME HACK 2342 outfile.variables['elevation'][:] = z 2301 2343 outfile.variables['time'][:] = times #Store time relative 2302 2344 outfile.variables['volumes'][:] = volumes.astype(Int32) #On Opteron 64 … … 2323 2365 i += 1 2324 2366 2325 2367 #outfile.close() 2368 2369 #FIXME: Refactor using code from file_function.statistics 2370 #Something like print swwstats(swwname) 2326 2371 if verbose: 2327 2372 x = outfile.variables['x'][:] 2328 2373 y = outfile.variables['y'][:] 2374 times = outfile.variables['time'][:] 2329 2375 print '------------------------------------------------' 2330 2376 print 'Statistics of output file:' … … 2348 2394 2349 2395 2350 2351 outfile.close() 2396 outfile.close() 2397 2352 2398 2353 2399
Note: See TracChangeset
for help on using the changeset viewer.