Changeset 7820 for trunk/anuga_core/source/anuga/utilities/sww_merge.py
- Timestamp:
- Jun 11, 2010, 11:42:42 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/anuga_core/source/anuga/utilities/sww_merge.py
r7819 r7820 1 """ 2 Merge a list of .sww files together into a single file. 3 """ 4 1 5 import numpy as num 2 6 from anuga.utilities.numerical_tools import ensure_numeric … … 11 15 """ 12 16 Merge a list of sww files into a single file. 17 18 May be useful for parallel runs. Note that some advanced information 19 and custom quantities may not be exported. 13 20 """ 14 21 … … 81 88 82 89 for q in dynamic_quantities: 83 q_values = ensure_numeric(out_d_quantities[quantity])84 x = q_values.astype(netcdf_float)85 fido.variables[q] = x86 90 q_values = out_d_quantities[q] 91 for i, time_slice in enumerate(q_values): 92 fido.variables[q][i] = num.array(time_slice, netcdf_float) 93 87 94 # This updates the _range values 88 95 q_range = fido.variables[q + Write_sww.RANGE][:] … … 98 105 99 106 100 from anuga.abstract_2d_finite_volumes.mesh_factory import rectangular, \101 rectangular_cross102 from anuga.shallow_water.shallow_water_domain import Domain103 from anuga.file.sww import SWW_file104 from anuga.abstract_2d_finite_volumes.generic_boundary_conditions import \105 Dirichlet_boundary106 107 Bd = Dirichlet_boundary([0.5, 0., 0.])108 109 # Create shallow water domain110 domain = Domain(*rectangular_cross(2, 2))111 domain.set_name('test1')112 domain.set_quantity('elevation', 2)113 domain.set_quantity('stage', 5)114 domain.set_boundary({'left': Bd, 'right': Bd, 'top': Bd, 'bottom': Bd})115 for t in domain.evolve(yieldstep=0.5, finaltime=1):116 pass117 118 domain = Domain(*rectangular(3, 3))119 domain.set_name('test2')120 domain.set_quantity('elevation', 3)121 domain.set_quantity('stage', 50)122 domain.set_boundary({'left': Bd, 'right': Bd, 'top': Bd, 'bottom': Bd})123 for t in domain.evolve(yieldstep=0.5, finaltime=1):124 pass125 126 sww_merge(['test1.sww', 'test2.sww'], 'test_out.sww', verbose = True)
Note: See TracChangeset
for help on using the changeset viewer.