Changeset 2488


Ignore:
Timestamp:
Mar 7, 2006, 10:44:45 AM (18 years ago)
Author:
jack
Message:

Fixed assertion failures in read_ASCII and read_NetCDF due to
typechecking not taking care of single element arrays correctly.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • inundation/coordinate_transforms/geo_reference.py

    r2381 r2488  
    7575        self.zone = infile.zone[0]
    7676
    77        
     77        # Fix some assertion failures
     78        if type(self.zone) == ArrayType and self.zone.shape == ():
     79            self.zone = self.zone[0]
     80        if type(self.xllcorner) == ArrayType and self.xllcorner.shape == ():
     81            self.xllcorner = self.xllcorner[0]
     82        if type(self.yllcorner) == ArrayType and self.yllcorner.shape == ():
     83            self.yllcorner = self.yllcorner[0]
     84
    7885        assert (type(self.xllcorner) == types.FloatType or\
    7986                type(self.xllcorner) == types.IntType)
     
    102109        self.yllcorner = float(fd.readline())
    103110           
    104        
     111        # Fix some assertion failures
     112        if(type(self.zone) == ArrayType and self.zone.shape == ()):
     113            self.zone = self.zone[0]
     114        if type(self.xllcorner) == ArrayType and self.xllcorner.shape == ():
     115            self.xllcorner = self.xllcorner[0]
     116        if type(self.yllcorner) == ArrayType and self.yllcorner.shape == ():
     117            self.yllcorner = self.yllcorner[0]
     118   
    105119        assert (type(self.xllcorner) == types.FloatType)
    106120        assert (type(self.yllcorner) == types.FloatType)
Note: See TracChangeset for help on using the changeset viewer.