def get_lines_cols(self, filePath): fileSettings = utilities.get_file_settings(filePath) if fileSettings is not None: smallTile = fileSettings.fileextrainfo_set.filter(name='smallTile') if len(smallTile) == 1: # grid tile rowSize = fileSettings.fileextrainfo_set.get( name='nLines').string colSize = fileSettings.fileextrainfo_set.get( name='nCols').string elif len(smallTile) == 0: # continental tile areaName = utilities.get_tile_name(filePath) ulTile = fileSettings.fileextrainfo_set.get( name='%s_upper_left_tile' % areaName).string ulTileFile = filePath.replace(areaName, ulTile) ulSettings = utilities.get_file_settings(ulTileFile) lrTile = fileSettings.fileextrainfo_set.get( name='%s_lower_right_tile' % areaName).string lrTileFile = filePath.replace(areaName, lrTile) lrSettings = utilities.get_file_settings(lrTileFile) ulH, ulV = self.get_h_v(ulTileFile) lrH, lrV = self.get_h_v(lrTileFile) ulNLines = int( ulSettings.fileextrainfo_set.get(name='nLines').string) ulNCols = int( ulSettings.fileextrainfo_set.get(name='nCols').string) rowSize = (lrV - ulV + 1) * ulNLines colSize = (lrH - ulH + 1) * ulNCols return rowSize, colSize
def get_bounds(self, filePath, pixelSize): fileSettings = utilities.get_file_settings(filePath) if fileSettings is not None: smallTile = fileSettings.fileextrainfo_set.filter(name='smallTile') if len(smallTile) == 1: # it's a grid tile minx, miny, maxx, maxy = self._get_tile_bbox(filePath, fileSettings, pixelSize) elif len(smallTile) == 0: # it's a continental tile areaName = utilities.get_tile_name(filePath) ulTile = fileSettings.fileextrainfo_set.get(name='%s_upper_left_tile' % areaName).string ulTileFile = filePath.replace(areaName, ulTile) ulSettings = utilities.get_file_settings(ulTileFile) lrTile = fileSettings.fileextrainfo_set.get(name='%s_lower_right_tile' % areaName).string lrTileFile = filePath.replace(areaName, lrTile) lrSettings = utilities.get_file_settings(lrTileFile) ulBBox = self._get_tile_bbox(ulTileFile, ulSettings, pixelSize) lrBBox = self._get_tile_bbox(lrTileFile, lrSettings, pixelSize) minx = ulBBox[0] miny = lrBBox[1] maxx = lrBBox[2] maxy = ulBBox[3] return minx, miny, maxx, maxy
def get_bounds(self, filePath, pixelSize): fileSettings = utilities.get_file_settings(filePath) if fileSettings is not None: smallTile = fileSettings.fileextrainfo_set.filter(name='smallTile') if len(smallTile) == 1: # it's a grid tile minx, miny, maxx, maxy = self._get_tile_bbox( filePath, fileSettings, pixelSize) elif len(smallTile) == 0: # it's a continental tile areaName = utilities.get_tile_name(filePath) ulTile = fileSettings.fileextrainfo_set.get( name='%s_upper_left_tile' % areaName).string ulTileFile = filePath.replace(areaName, ulTile) ulSettings = utilities.get_file_settings(ulTileFile) lrTile = fileSettings.fileextrainfo_set.get( name='%s_lower_right_tile' % areaName).string lrTileFile = filePath.replace(areaName, lrTile) lrSettings = utilities.get_file_settings(lrTileFile) ulBBox = self._get_tile_bbox(ulTileFile, ulSettings, pixelSize) lrBBox = self._get_tile_bbox(lrTileFile, lrSettings, pixelSize) minx = ulBBox[0] miny = lrBBox[1] maxx = lrBBox[2] maxy = ulBBox[3] return minx, miny, maxx, maxy
def get_lines_cols(self, filePath): fileSettings = utilities.get_file_settings(filePath) if fileSettings is not None: smallTile = fileSettings.fileextrainfo_set.filter(name='smallTile') if len(smallTile) == 1: # grid tile rowSize = fileSettings.fileextrainfo_set.get(name='nLines').string colSize = fileSettings.fileextrainfo_set.get(name='nCols').string elif len(smallTile) == 0: # continental tile areaName = utilities.get_tile_name(filePath) ulTile = fileSettings.fileextrainfo_set.get(name='%s_upper_left_tile' % areaName).string ulTileFile = filePath.replace(areaName, ulTile) ulSettings = utilities.get_file_settings(ulTileFile) lrTile = fileSettings.fileextrainfo_set.get(name='%s_lower_right_tile' % areaName).string lrTileFile = filePath.replace(areaName, lrTile) lrSettings = utilities.get_file_settings(lrTileFile) ulH, ulV = self.get_h_v(ulTileFile) lrH, lrV = self.get_h_v(lrTileFile) ulNLines = int(ulSettings.fileextrainfo_set.get(name='nLines').string) ulNCols = int(ulSettings.fileextrainfo_set.get(name='nCols').string) rowSize = (lrV - ulV + 1) * ulNLines colSize = (lrH - ulH + 1) * ulNCols return rowSize, colSize