Changeset 1026


Ignore:
Timestamp:
08/28/12 15:02:21 (5 years ago)
Author:
jjr8
Message:

Fixed miscellaneous bugs

Location:
MGET/Branches/Jason/PythonPackage/src/GeoEco
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • MGET/Branches/Jason/PythonPackage/src/GeoEco/ArcGIS.py

    r909 r1026  
    463463            d = gp.Describe(path) 
    464464            isCorrectType = d is not None and d.DataType.lower() in correctTypes 
     465            isCorrectType = isCorrectType or (u'rasterdataset' in correctTypes and os.path.isfile(path) and path.lower().endswith('.img'))      # Seemingly randomly, gp.Describe does not work correctly with .img files. 
    465466        if not exists: 
    466467            Logger.Debug(_(u'The %(type)s %(path)s does not exist.') % {u'type': typeDisplayName, u'path': path}) 
  • MGET/Branches/Jason/PythonPackage/src/GeoEco/BatchProcessing.py

    r387 r1026  
    765765                    allOutputsExist = True 
    766766                    for j in range(len(outputParamNames)): 
    767                         (exists, correctType) = existenceFunctions[i](outputsList[i][j]) 
    768                         if not exists: 
    769                             allOutputsExist = False 
    770                             break 
    771                         if not correctType: 
    772                             if len(inputParamNames) > 1: 
    773                                 Logger.RaiseException(ValueError(_(u'The output %(output)s specified for input combination [%(input)s] already exists but it is not a %(type)s, so it cannot be accepted as a valid output. Please delete this object yourself or remove it from your list of outputs.') % {u'input': key, u'output': outputsList[i][j], u'type': methodMetadata.GetArgumentByName(outputParamNames[j]).Type.TypeDisplayName})) 
    774                             else: 
    775                                 Logger.RaiseException(ValueError(_(u'The output %(output)s specified for input %(input)s already exists but it is not a %(type)s, so it cannot be accepted as a valid output. Please delete this object yourself or remove it from your list of outputs.') % {u'input': key, u'output': outputsList[i][j], u'type': methodMetadata.GetArgumentByName(outputParamNames[j]).Type.TypeDisplayName})) 
     767                        if outputsList[i][j] is not None: 
     768                            (exists, correctType) = existenceFunctions[i](outputsList[i][j]) 
     769                            if not exists: 
     770                                allOutputsExist = False 
     771                                break 
     772                            if not correctType: 
     773                                if len(inputParamNames) > 1: 
     774                                    Logger.RaiseException(ValueError(_(u'The output %(output)s specified for input combination [%(input)s] already exists but it is not a %(type)s, so it cannot be accepted as a valid output. Please delete this object yourself or remove it from your list of outputs.') % {u'input': key, u'output': outputsList[i][j], u'type': methodMetadata.GetArgumentByName(outputParamNames[j]).Type.TypeDisplayName})) 
     775                                else: 
     776                                    Logger.RaiseException(ValueError(_(u'The output %(output)s specified for input %(input)s already exists but it is not a %(type)s, so it cannot be accepted as a valid output. Please delete this object yourself or remove it from your list of outputs.') % {u'input': key, u'output': outputsList[i][j], u'type': methodMetadata.GetArgumentByName(outputParamNames[j]).Type.TypeDisplayName})) 
    776777 
    777778                    if allOutputsExist: 
  • MGET/Branches/Jason/PythonPackage/src/GeoEco/Datasets/Virtual.py

    r1022 r1026  
    10501050        slicesToRead = [] 
    10511051        for i, d in enumerate(self.GetLazyPropertyValue('PhysicalDimensions')): 
    1052             offset = self._SliceList[self.Dimensions.index(d)].start 
     1052            if not self.GetLazyPropertyValue('PhysicalDimensionsFlipped')[i]: 
     1053                offset = self._SliceList[self.Dimensions.index(d)].start 
     1054            else: 
     1055                offset = self._Grid.Shape[i] - self._SliceList[self.Dimensions.index(d)].stop 
    10531056            slicesToRead.append(slice(sliceList[i].start + offset, sliceList[i].stop + offset, sliceList[i].step)) 
    10541057             
     
    10661069        slicesToWrite = [] 
    10671070        for i, d in enumerate(self.GetLazyPropertyValue('PhysicalDimensions')): 
    1068             offset = self._SliceList[self.Dimensions.index(d)].start 
     1071            if not self.GetLazyPropertyValue('PhysicalDimensionsFlipped')[i]: 
     1072                offset = self._SliceList[self.Dimensions.index(d)].start 
     1073            else: 
     1074                offset = self._Grid.Shape[i] - self._SliceList[self.Dimensions.index(d)].stop 
    10691075            slicesToWrite.append(slice(sliceList[i].start + offset, sliceList[i].stop + offset, sliceList[i].step)) 
    10701076 
     
    32963302            if len(self.Dimensions) == 2: 
    32973303                slices = [(sliceList[0], sliceList[1])] 
    3298             elif len(self.Dimensions) == 2: 
    3299                 slices = [(d, sliceList[1], sliceList[2]) for d in range(sliceList[0])] 
     3304            elif len(self.Dimensions) == 3: 
     3305                slices = [(d, sliceList[1], sliceList[2]) for d in range(sliceList[0].start, sliceList[0].stop)] 
    33003306            else: 
    3301                 slices = [(d1, d2, sliceList[2], sliceList[3]) for d1 in range(sliceList[0]) for d2 in range(sliceList[1])] 
     3307                slices = [(d1, d2, sliceList[2], sliceList[3]) for d1 in range(sliceList[0].start, sliceList[0].stop) for d2 in range(sliceList[1].start, sliceList[1].stop)] 
    33023308 
    33033309            for s in slices: 
    3304                 inpaintedFile = os.path.join(self._TempDir, 'slice_%s_inpainted.dat' % '_'.join(map(str, slices[:len(self.Dimensions) - 2]))) 
     3310                inpaintedFile = os.path.join(self._TempDir, 'slice_%s_inpainted.dat' % '_'.join(map(str, s[:len(self.Dimensions) - 2]))) 
    33053311                if not os.path.exists(inpaintedFile): 
    33063312                    self._LogDebug(_(u'%(class)s 0x%(id)08X: Creating %(inpaintedFile)s from slice %(slice)r of %(dn)s.'), {u'class': self.__class__.__name__, u'id': id(self), u'inpaintedFile': inpaintedFile, u'slice': slices, u'dn': self._Grid.DisplayName}) 
     
    33083314                    # Write this 2D slice to the temporary directory. 
    33093315 
    3310                     holesFile = os.path.join(self._TempDir, 'slice_%s.dat' % '_'.join(map(str, slices[:len(self.Dimensions) - 2]))) 
     3316                    holesFile = os.path.join(self._TempDir, 'slice_%s.dat' % '_'.join(map(str, s[:len(self.Dimensions) - 2]))) 
    33113317 
    33123318                    if self.Dimensions == u'yx': 
     
    33733379 
    33743380        for s in slices: 
    3375             inpaintedFile = os.path.join(self._TempDir, 'slice_%s_inpainted.dat' % '_'.join(map(str, slices[:len(self.Dimensions) - 2]))) 
    3376             data.__setitem__(s, numpy.fromfile(inpaintedFile, str(self.DataType)).reshape(self.Shape[-2], self.Shape[-1]).__getitem__((s[-2], s[-1]))) 
     3381            inpaintedFile = os.path.join(self._TempDir, 'slice_%s_inpainted.dat' % '_'.join(map(str, s[:len(self.Dimensions) - 2]))) 
     3382            inpaintedSlice = numpy.fromfile(inpaintedFile, str(self.DataType)).reshape(self.Shape[-2], self.Shape[-1]) 
     3383 
     3384            if len(self.Dimensions) == 2: 
     3385                data.__setitem__((slice(None, None, None), slice(None, None, None)), inpaintedSlice.__getitem__(s[-2:])) 
     3386            elif len(self.Dimensions) == 3: 
     3387                data.__setitem__((slice(s[0] - slices[0][0], s[0] - slices[0][0] + 1, None), slice(None, None, None), slice(None, None, None)), inpaintedSlice.__getitem__(s[-2:])) 
     3388            else: 
     3389                data.__setitem__((slice(s[0] - slices[0][0], s[0] - slices[0][0] + 1, None), slice(s[1] - slices[1][0], s[1] - slices[1][0] + 1, None), slice(None, None, None), slice(None, None, None)), inpaintedSlice.__getitem__(s[-2:])) 
    33773390 
    33783391        # Return successfully. 
Note: See TracChangeset for help on using the changeset viewer.