Changeset 844


Ignore:
Timestamp:
Feb 8, 2005, 1:00:02 PM (20 years ago)
Author:
ole
Message:

Cleaned up and simplified data manager + getters and setters in domain

Location:
inundation/ga/storm_surge/pyvolution
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • inundation/ga/storm_surge/pyvolution/config.py

    r566 r844  
    4444rho_w = 1023   #Fluid density [kg/m^3] (rho_w = 1023 for salt water)
    4545
    46        
    47 
    48 
    4946
    5047
     
    5956
    6057if sys.platform == 'win32':
    61     data_dir = 'C:\grohm_output'
     58    default_datadir = 'C:\grohm_output'
    6259else:   
    63     data_dir = os.path.expanduser('~'+os.sep+'grohm_output')
     60    default_datadir = os.path.expanduser('~'+os.sep+'grohm_output')
    6461
    6562
  • inundation/ga/storm_surge/pyvolution/data_manager.py

    r839 r844  
    123123
    124124       
    125 def create_filename(filename, format, size, time=None):
     125def create_filename(datadir, filename, format, size=None, time=None):
    126126
    127127    import os
    128     from config import data_dir
    129 
     128    #from config import data_dir
    130129           
    131     FN = check_dir(data_dir) + filename + '_size%d' %size
     130    FN = check_dir(datadir) + filename
     131   
     132    if size is not None:           
     133        FN += '_size%d' %size
    132134
    133135    if time is not None:
     
    138140   
    139141
    140 def get_files(filename, format, size):
     142def get_files(datadir, filename, format, size):
    141143    """Get all file (names) with gven name, size and format
    142144    """
     
    145147
    146148    import os
    147     from config import data_dir
    148 
     149    #from config import data_dir
    149150           
    150     dir = check_dir(data_dir)
     151    dir = check_dir(datadir)
    151152
    152153    pattern = dir + os.sep + filename + '_size=%d*.%s' %(size, format)
     
    168169
    169170        #Create filename
    170         self.filename = create_filename(domain.get_name(), extension, len(domain))
     171        #self.filename = create_filename(domain.get_datadir(),
     172        #       domain.get_name(), extension, len(domain))
     173       
     174        self.filename = create_filename(domain.get_datadir(),
     175                        domain.get_name(), extension)   
     176               
    171177        self.timestep = 0
    172178        self.number_of_volumes = len(domain)
     
    629635
    630636    #Get NetCDF
    631     FN = create_filename(basefilename, 'sww', size)
     637    FN = create_filename('.', basefilename, 'sww', size)
    632638    print 'Reading from ', FN
    633639    fid = NetCDFFile(FN, 'r')  #Open existing file for read
     
    653659       
    654660    #Write obj for bathymetry
    655     FN = create_filename(basefilename, 'obj', size)       
     661    FN = create_filename('.', basefilename, 'obj', size)       
    656662    write_obj(FN,xx,yy,zz)
    657663
     
    671677        #Write obj for variable data
    672678        #FN = create_filename(basefilename, 'obj', size, time=t)
    673         FN = create_filename(basefilename[:5], 'obj', size, time=t)   
     679        FN = create_filename('.', basefilename[:5], 'obj', size, time=t)   
    674680        write_obj(FN,xx,yy,zz)
    675681
     
    677683def dat2obj(basefilename):
    678684    """Convert line based data output to obj
     685    FIXME: Obsolete?
    679686    """
    680687
  • inundation/ga/storm_surge/pyvolution/domain.py

    r819 r844  
    6868        self.starttime = None
    6969       
    70         #Checkpointing         
     70        #Checkpointing and storage             
     71        from config import default_datadir
     72        self.datadir = default_datadir
    7173        self.filename = 'domain'
    7274        self.checkpoint = False
     
    311313        self.filename = name   
    312314
     315    def get_datadir(self):
     316        return self.datadir     
     317                       
     318    def set_datadir(self, name):
     319        self.datadir = name     
     320
     321       
     322
    313323    #def set_defaults(self):
    314324    #    """Set default values for uninitialised quantities.
     
    336346        """
    337347
    338         #import data_manager
    339348        from config import min_timestep, max_timestep, epsilon
    340349
  • inundation/ga/storm_surge/pyvolution/generic_boundary_conditions.py

    r835 r844  
    123123
    124124    No spatial info assumed.
    125     FIXME: Soon to be Obsolete
    126125    """
    127126
  • inundation/ga/storm_surge/pyvolution/test_generic_boundary_conditions.py

    r843 r844  
    179179
    180180
    181     def test_fileboundary_time_and_space(self):
    182         """Test that boundary values can be read from file and interpolated
    183         Include both time and space
    184         """
    185 
    186         from domain import Domain
    187         from quantity import Quantity
    188 
    189        
    190         #Create sww file of simple propagation from left to right
    191         #through rectangular domain: domain1
    192        
    193         #Create an oblique domain,
    194         #rectangular with left side at an angle but fully contained within
    195         #previous rectangular domain and called it domain2
    196        
    197         #Use output from domain1 as spatio-temporal boundary for domain2
    198         #and verify that results at right hand side are close. 
    199 
    200        
    201        
    202        
    203         #print 'File boundary_time_and_space not yet implemented'
    204 
    205181    def test_fileboundary_exception(self):
    206182        """Test that boundary object complians if number of
  • inundation/ga/storm_surge/pyvolution/util.py

    r842 r844  
    110110    time only, i.e  no spatial dependency!!!!!
    111111    When that is needed we can use the least_squares interpolation.
     112   
     113    #FIXME: This should work with netcdf (e.g. sww) and thus render the
     114    #spatio-temporal boundary condition in shallow water fully general
    112115    """
    113116
Note: See TracChangeset for help on using the changeset viewer.