def initTerrain(self, op, context, basePath, addonName): self.setDataDir(context, basePath, addonName) # create a sub-directory under <self.dataDir> for OSM files terrainDir = os.path.join(self.dataDir, self.terrainSubDir) self.terrainDir = terrainDir if not os.path.exists(terrainDir): os.makedirs(terrainDir) self.setAttributes(context) self.terrainSize = 3600//int(self.terrainResolution) # we are going from top to down, that's why we call reversed() self.latIntervals = tuple(reversed(Terrain.getHgtIntervals(self.minLat, self.maxLat))) self.lonIntervals = Terrain.getHgtIntervals(self.minLon, self.maxLon) missingHgtFiles = self.getMissingHgtFiles() # download missing .hgt files for missingPath in missingHgtFiles: missingFile = os.path.basename(missingPath) self.download( self.terrainUrl % (missingFile[:3], missingFile), missingPath )