Show
Ignore:
Timestamp:
02/26/12 23:30:01 (15 months ago)
Author:
jjr8
Message:

Implemented the rest of #521: Tools that generate rasters should also (optionally) generate a raster catalog

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • MGET/Branches/Jason/PythonPackage/src/GeoEco/DataProducts/NOAA/OSCAR.py

    r925 r927  
    211211        return data.reshape(data.shape[0], data.shape[2], data.shape[3]), noDataValue 
    212212 
    213     def _GetOtherTimeCoordinates(self, queryableAttributeValues): 
     213    def _GetTimeCoordsFromQueryableAttributeValues(self, queryableAttributeValues): 
    214214        if u'DateTime' not in queryableAttributeValues or not isinstance(queryableAttributeValues[u'DateTime'], datetime.datetime): 
    215             return [None, None] 
     215            return [None, None, None] 
     216        import numpy 
    216217        try: 
    217             i = self.CenterCoords['t', :].index(queryableAttributeValues[u'DateTime']) 
     218            i = numpy.where(self.CenterCoords['t', :] == queryableAttributeValues[u'DateTime'])[0][0] 
    218219        except: 
    219             return [None, None] 
    220         return [self.MinCoords['t', i], self.MaxCoords['t', i]] 
     220            return [None, None, None] 
     221        return [self.MinCoords['t', i], queryableAttributeValues[u'DateTime'], self.MaxCoords['t', i] - datetime.timedelta(seconds=1)] 
    221222 
    222223    @classmethod 
     
    322323            workspace.ImportDatasets(GridSliceCollection(grid, tQACoordType=u'center').QueryDatasets(), mode, calculateStatistics=calculateStatistics, buildPyramids=buildPyramids) 
    323324            if rasterCatalog is not None: 
    324                 workspace.ToRasterCatalog(rasterCatalog, grid.GetSpatialReference(u'ArcGIS'), tQACoordType=u'center', tCoordFunction=self._GetOtherTimeCoordinates, overwriteExisting=True) 
     325                workspace.ToRasterCatalog(rasterCatalog, grid.GetSpatialReference(u'ArcGIS'), tQACoordType=u'center', tCoordFunction=fullGrid._GetTimeCoordsFromQueryableAttributeValues, overwriteExisting=True) 
    325326        finally: 
    326327            fullGrid.Close()