Ignore:
Timestamp:
Sep 15, 2005, 5:32:31 PM (19 years ago)
Author:
ole
Message:

Implemented tms file format (like sww without x, y)
Fixed broken test in sww2ers

File:
1 edited

Legend:

Unmodified
Added
Removed
  • inundation/pyvolution/util.py

    r1819 r1835  
    137137                  quantities = None,
    138138                  interpolation_points = None, verbose = False):
    139     """If quantities is not specified, derive them from domain
    140     (if that is specified)
    141 
    142 
    143     see get_netcdf_file_function
    144     """
    145 
     139    """Read time history of spatial data from NetCDF file and return
     140    a callable object.
     141
     142    If the file has extension 'sww' then it is assumed to be spatio-temporal
     143    or temporal and the callable object will have the form f(t,x,y) or f(t)
     144    depending on whether the file contains spatial data
     145
     146    If the file has extension 'tms' then it is assumed to be temporal only
     147    and the callable object will have the form f(t)
     148
     149    Either form will return interpolated values based on the input file
     150    using the underlying interpolation_function.
     151
     152    If domain is specified, model time (domain.starttime)
     153    will be checked and possibly modified.
     154   
     155    All times are assumed to be in UTC
     156
     157    All spatial information is assumed to be in UTM coordinates.
     158
     159    See Interpolation function for further documentation
     160    """
     161   
    146162
    147163    #FIXME (OLE): Should check origin of domain against that of file
     
    230246    #are present in file
    231247    missing = []
    232     for quantity in ['time'] + quantity_names:  #FIXME: Add x, y back
     248    for quantity in ['time'] + quantity_names:
    233249        if not fid.variables.has_key(quantity):
    234250            missing.append(quantity)
     
    241257
    242258    #Decide whether this data has a spatial dimension
    243     #FIXME: Let us split this up into two functions: One that reads
    244     #sww and one that reads tms (time series only)
    245     #Definitely! (Ole 25 August 2005)
    246259    spatial = True
    247260    for quantity in ['x', 'y']:
     
    249262            spatial = False
    250263
    251 
     264    if filename[-3:] == 'tms' and spatial is True:
     265        msg = 'Files of type tms must not contain spatial information'
     266        raise msg
     267
     268    if filename[-3:] == 'sww' and spatial is False:
     269        msg = 'Files of type sww must contain spatial information'       
     270        raise msg       
    252271
    253272    #Get first timestep
Note: See TracChangeset for help on using the changeset viewer.