Skip to content

Instantly share code, notes, and snippets.

@tyler-austin
Last active May 30, 2017 22:46
Show Gist options
  • Save tyler-austin/1c3a63190cd433882aced39652ca687d to your computer and use it in GitHub Desktop.
Save tyler-austin/1c3a63190cd433882aced39652ca687d to your computer and use it in GitHub Desktop.
arcpy create scratch fgdb
import arcpy
def set_scratch_environment(self, scratch_dir, cpu_core):
self.core_scratch_dir = os.path.join(scratch_dir, 'scratch_{0}'.format(cpu_core))
os.mkdir(self.core_scratch_dir)
arcpy.env.scratchWorkspace = self.core_scratch_dir
arcpy.env.workspace = arcpy.env.scratchGDB
self.scratch_gdb = os.path.join(self.core_scratch_dir, 'scratch.gdb')
# Set workspace environment variables
ctx.set_scratch_environment(cfg.scratch_dir, cfg.cpu_core)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment