Skip to content

Instantly share code, notes, and snippets.

@phobson
Last active October 28, 2015 23:15
Show Gist options
  • Save phobson/affdf80db837e7786391 to your computer and use it in GitHub Desktop.
Save phobson/affdf80db837e7786391 to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"import arcpy\n",
"\n",
"class Flooder(object):\n",
" def __init__(self):\n",
" self.label = \"1 - Create Flood Scenarios\"\n",
" self.description = \"\"\n",
" self.canRunInBackground = True\n",
" \n",
" def isLicensed(self):\n",
" return True\n",
"\n",
" def updateParameters(self, parameters): \n",
" polygons = parameters[0]\n",
" tgcol = parameters[1]\n",
" try:\n",
" print(\"using list of integers\")\n",
" polygons.parameterDependencies = [1]\n",
" except:\n",
" print(\"that failed, try a list integers as strings\")\n",
" polygons.parameterDependencies = [\"1\"]\n",
" print(\"yup that worked #slowclap\")\n",
" \n",
"\n",
" def getParameterInfo(self):\n",
" polygons = arcpy.Parameter(displayName=\"Zones\", name=\"polygons\",\n",
" datatype=\"DEFeatureClass\", parameterType=\"Required\", \n",
" direction=\"Input\")\n",
"\n",
" tidegate_column = arcpy.Parameter(displayName=\"ID column\", name=\"tidegate_column\",\n",
" datatype=\"Field\", parameterType=\"Required\", \n",
" direction=\"Input\")\n",
"\n",
" return [polygons, tidegate_column]\n"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"using list of integers\n",
"that failed, try a list integers as strings\n",
"yup that worked #slowclap\n"
]
}
],
"source": [
"f = Flooder()\n",
"p = f.getParameterInfo()\n",
"f.updateParameters(p)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 2",
"language": "python",
"name": "python2"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.10"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment