Changeset 4550
- Timestamp:
- Jun 20, 2007, 5:13:57 PM (17 years ago)
- Location:
- anuga_core/source/anuga/shallow_water
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/source/anuga/shallow_water/data_manager.py
r4548 r4550 426 426 #Close 427 427 fid.close() 428 428 429 ### FIXME Where are the tests for this object? 429 430 def store_timestep(self, names): 430 431 """Store time and named quantities to file … … 541 542 precision = self.precision) 542 543 self.writer.quantities(fid, 543 time=self.domain.time, 544 precision=self.precision, 545 stage=stage, 546 xmomentum=xmomentum, 547 ymomentum=ymomentum) 544 time=self.domain.time +domain.starttime 545 , 546 precision=self.precision, 547 stage=stage, 548 xmomentum=xmomentum, 549 ymomentum=ymomentum) 548 550 else: 549 551 # This is producing a sww that is not standard. 550 552 #Store time 551 time[i] = self.domain.time 553 time[i] = self.domain.time + domain.starttime 552 554 553 555 for name in names: … … 4752 4754 """ 4753 4755 outfile - the name of the file that will be written 4754 times - A list of the time slice times OR a start time 4755 Note, if a list is given the info will be made relative. 4756 times - A list of the time slice times 4756 4757 number_of_volumes - the number of triangles 4757 4758 """ … … 4781 4782 #Start time in seconds since the epoch (midnight 1/1/1970) 4782 4783 4784 # Values used to be relative, so a start time was important 4785 # It may not be needed anymore. 4786 # though there is probably code that reads it. 4787 outfile.starttime = 0 4788 4783 4789 # this is being used to seperate one number from a list. 4784 4790 # what it is actually doing is sorting lists from numeric arrays. 4785 4791 if type(times) is list or type(times) is ArrayType: 4786 4792 number_of_times = len(times) 4787 times = ensure_numeric(times) 4788 if number_of_times == 0: 4789 starttime = 0 4790 else: 4791 starttime = times[0] 4792 times = times - starttime #Store relative times 4793 times = ensure_numeric(times) 4793 4794 else: 4794 4795 number_of_times = 0 4795 starttime = times 4796 #times = ensure_numeric([]) 4797 outfile.starttime = starttime 4796 4798 4797 # dimension definitions 4799 4798 outfile.createDimension('number_of_volumes', number_of_volumes) -
anuga_core/source/anuga/shallow_water/test_data_manager.py
r4541 r4550 5749 5749 5750 5750 time = fid.variables['time'][:] 5751 assert allclose(time, [0. 0]) # the time is relative5752 assert fid.starttime == 0. 55751 assert allclose(time, [0.5]) # the time is absolute 5752 assert fid.starttime == 0.0 5753 5753 5754 5754 fid.close() 5755 5755 self.delete_mux(files) 5756 # print "sww_file", sww_file5756 ### print "sww_file", sww_file 5757 5757 os.remove(sww_file) 5758 5758 … … 6355 6355 times = fid.variables['time'][:] 6356 6356 6357 times_actual = [0,100,200,300] 6357 times_actual = [0,100,200,300] # times used to be relative 6358 times_actual = [200,300,400,500] # now they are actual 6358 6359 6359 6360 assert allclose(ensure_numeric(times),
Note: See TracChangeset
for help on using the changeset viewer.