In the notebook editor, you can work with content in your ArcGIS Notebooks workspace to add files to your notebook or download them to your machine. Click the Files button to open the Files pane.
Browse content in the workspace
The Files pane provides a browser for the files in your workspace. The default folder is home.
Upload content to the workspace
To work with content and resources from your machine, you must first upload your file to your notebook's workspace through the notebook editor.Once your files are uploaded, you can reference their file path in an open notebook and any other notebooks you own with filepath = /arcgis/home/folder/filename.
To upload files, complete the following steps:
- In the Files pane, browse to the /arcgis/home folder.
Note:
/arcgis/home is the workspace directory and is different from the root directory home/arcgis. - Optionally, click New folder to create a folder in the /arcgis/home workspace where you will upload content.
- Click Choose file to upload and browse to the file.
- Select the file.
The file is uploaded to the workspace.
Files that are uploaded to the notebook workspace are not stored as items in your organization and are not deleted when the notebook is deleted. To delete files, select the file in the Files pane and click Delete. If you are removed from your organization, all content in your notebook workspace is permanently deleted.
Download content from the workspace
You can save a file from the workspace to your local machine. In the notebook editor Files pane, browse to the file and select it. The file is automatically downloaded to your machine.
Set up a scratch workspace environment for use with ArcPy
The scratch workspace is intended for output data that you do not intend to maintain.
To create and use a scratch workspace environment, complete the following steps:
- Use the code below to create a scratch file geodatabase in the user workspace directory, if it does not already exist, and set the scratch geodatabase as the scratch workspace.
import arcpy if not arcpy.Exists('/arcgis/home/scratch.gdb'): arcpy.management.CreateFileGDB('/arcgis/home','scratch.gdb') arcpy.env.scratchWorkspace = '/arcgis/home/scratch.gdb'
- Use the code below to verify that the geodatabase is set as the scratch geodatabase environment.
print(arcpy.env.scratchGDB)
Create a folder to use as a scratch workspace
To create a folder to use as a scratch workspace, complete the following steps:
- Use the code below to create a folder in the user workspace, if one does not already exist, and set that folder as the user workspace.
import arcpy if not arcpy.Exists('/arcgis/home/scratch'): arcpy.management.CreateFolder('/arcgis/home', 'scratch') arcpy.env.scratchWorkspace = '/arcgis/home/scratch'
- Use the code below to verify that the folder is set as the scratch folder environment.
print(arcpy.env.scratchFolder)