Example #1
0
    def reduceGrid(self):
##
## For some reason CMT reduced the grid of the modis data
### i am guessing to match the agreed swelter grid        
##        


        gridLong = self.modisLong[ self.yOffset:\
                                   self.yOffset+self.nYReduced,\
                                   self.xOffset:\
                                   self.xOffset+self.nXReduced]
        gridLat = self.modisLat[ self.yOffset:\
                                  self.yOffset+self.nYReduced,\
                                  self.xOffset:\
                                  self.xOffset+self.nXReduced]

        self.redLong = gridLong.reshape( self.nYReduced * \
                                         self.nXReduced)
        self.redLat = gridLat.reshape( self.nYReduced * \
                                       self.nXReduced)
        

        if self.verbose:
            print("****************************")        
            printUsual( self.redLong)
            print( self.x0Ascat - self.dXYAscat / 2.0,\
                   self.x0Ascat + self.dXYAscat / 2.0\
                   + self.nXAscat * self.dXYAscat)
            print("****************************")
            printUsual( self.redLat)
            print( self.y0Ascat - self.dXYAscat / 2.0,\
                   self.y0Ascat + self.dXYAscat / 2.0\
                   + self.nYAscat * self.dXYAscat)
            print("****************************")        
Example #2
0
    cropGrid = np.zeros( ( p.nTimesIn, p.nYOut, p.nXOut ), np.float32 )
    cropCount = np.zeros( ( p.nTimesIn, p.nYOut, p.nXOut ), np.float32 )

    otherGrid = np.zeros( ( p.nTimesIn, p.nYOut, p.nXOut ), np.float32 )
    otherCount = np.zeros( ( p.nTimesIn, p.nYOut, p.nXOut ), np.float32 )
    
    count = 0
    for year in p.years:

        leap = isLeap(year)
        for month in p.months:
            for day in daysAsNumbers( month, leap ):
##
##

                print( count, p.nTimesIn)
                
                outputGrid[ count, :, : ], outputCount[ count, :, : ],\
                forestGrid[ count, :, : ], forestCount[ count, :, : ],\
                urbanGrid[ count, :, : ], urbanCount[ count, :, : ],\
                cropGrid[ count, :, : ], cropCount[ count, :, : ],\
                otherGrid[ count, :, : ], otherCount[ count, :, : ]\
                            = readInput()


                if  outputGrid[ count, :, : ].max() > 0.0:
                    printUsual( outputGrid[ count, :, : ] )
                count += 1

    writeCDF()