Changeset 4558


Ignore:
Timestamp:
Jun 25, 2007, 1:38:05 PM (17 years ago)
Author:
duncan
Message:

removing stuff that made the sww files absolute. see ticket#173

Location:
anuga_core/source/anuga/shallow_water
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • anuga_core/source/anuga/shallow_water/data_manager.py

    r4554 r4558  
    426426        #Close
    427427        fid.close()
    428        
    429 ### FIXME Where are the tests for this object?
     428
    430429    def store_timestep(self, names):
    431430        """Store time and named quantities to file
     
    542541                                          precision = self.precision)
    543542                self.writer.quantities(fid,
    544                                        time=self.domain.time +domain.starttime
    545                                        ,
    546                                        precision=self.precision,
    547                                        stage=stage,
    548                                        xmomentum=xmomentum,
    549                                        ymomentum=ymomentum)
     543                                                 time=self.domain.time,
     544                                                 precision=self.precision,
     545                                                 stage=stage,
     546                                                 xmomentum=xmomentum,
     547                                                 ymomentum=ymomentum)
    550548            else:
    551549                # This is producing a sww that is not standard.
    552550                #Store time
    553                 time[i] = self.domain.time + domain.starttime
     551                time[i] = self.domain.time
    554552               
    555553                for name in names:
     
    47544752        """
    47554753        outfile - the name of the file that will be written
    4756         times - A list of the time slice times
     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.
    47574756        number_of_volumes - the number of triangles
    47584757        """
     
    47824781        #Start time in seconds since the epoch (midnight 1/1/1970)
    47834782
    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        
    47894783        # this is being used to seperate one number from a list.
    47904784        # what it is actually doing is sorting lists from numeric arrays.
    47914785        if type(times) is list or type(times) is ArrayType: 
    47924786            number_of_times = len(times)
    4793             times = ensure_numeric(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
    47944793        else:
    47954794            number_of_times = 0
    4796            
     4795            starttime = times
     4796            #times = ensure_numeric([])
     4797        outfile.starttime = starttime
    47974798        # dimension definitions
    47984799        outfile.createDimension('number_of_volumes', number_of_volumes)
  • anuga_core/source/anuga/shallow_water/test_data_manager.py

    r4550 r4558  
    57495749       
    57505750        time = fid.variables['time'][:]
    5751         assert allclose(time, [0.5]) # the time is absolute
    5752         assert fid.starttime == 0.0
     5751        assert allclose(time, [0.0]) # the time is relative
     5752        assert fid.starttime == 0.5
    57535753       
    57545754        fid.close()
    57555755        self.delete_mux(files)
    5756         ### print "sww_file", sww_file
     5756        #print "sww_file", sww_file
    57575757        os.remove(sww_file)
    57585758       
     
    63556355        times = fid.variables['time'][:]
    63566356       
    6357         times_actual = [0,100,200,300] # times used to be relative
    6358         times_actual = [200,300,400,500] # now they are actual
     6357        times_actual = [0,100,200,300]
    63596358       
    63606359        assert allclose(ensure_numeric(times),
Note: See TracChangeset for help on using the changeset viewer.