Skip to content

Commit

Permalink
black
Browse files Browse the repository at this point in the history
  • Loading branch information
nanaeaubry committed Aug 15, 2024
1 parent 7271c9a commit d52d4a5
Showing 1 changed file with 110 additions and 50 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
"outputs": [],
"source": [
"# Create a GIS Connection\n",
"gis = GIS(profile='your_online_profile')"
"gis = GIS(profile=\"your_online_profile\")"
]
},
{
Expand All @@ -88,7 +88,7 @@
],
"source": [
"# Get US as a country\n",
"usa = Country.get('US')\n",
"usa = Country.get(\"US\")\n",
"type(usa)"
]
},
Expand Down Expand Up @@ -309,7 +309,7 @@
}
],
"source": [
"df.loc['Age']['analysisVariable'].unique()"
"df.loc[\"Age\"][\"analysisVariable\"].unique()"
]
},
{
Expand Down Expand Up @@ -416,7 +416,7 @@
],
"source": [
"# View a sample of the `Age` data collection\n",
"df.loc['Age'].head()"
"df.loc[\"Age\"].head()"
]
},
{
Expand Down Expand Up @@ -458,8 +458,9 @@
"outputs": [],
"source": [
"# Enriching single address as single line imput\n",
"single_address = enrich(study_areas=[\"380 New York St Redlands CA 92373\"], \n",
" data_collections=['Age'])"
"single_address = enrich(\n",
" study_areas=[\"380 New York St Redlands CA 92373\"], data_collections=[\"Age\"]\n",
")"
]
},
{
Expand Down Expand Up @@ -595,7 +596,7 @@
"outputs": [],
"source": [
"# Plot on a map\n",
"address_map = gis.map('Redlands, CA')\n",
"address_map = gis.map(\"Redlands, CA\")\n",
"address_map"
]
},
Expand Down Expand Up @@ -775,9 +776,23 @@
],
"source": [
"# Enriching multiple addresses as single line input\n",
"enrich(study_areas=[{\"address\":{\"text\":\"12 Concorde Place Toronto ON M3C 3R8\",\"sourceCountry\":\"Canada\"}},\n",
" {\"address\":{\"text\":\"380 New York St Redlands CA 92373\",\"sourceCountry\":\"USA\"}}], \n",
" data_collections=['Age'])"
"enrich(\n",
" study_areas=[\n",
" {\n",
" \"address\": {\n",
" \"text\": \"12 Concorde Place Toronto ON M3C 3R8\",\n",
" \"sourceCountry\": \"Canada\",\n",
" }\n",
" },\n",
" {\n",
" \"address\": {\n",
" \"text\": \"380 New York St Redlands CA 92373\",\n",
" \"sourceCountry\": \"USA\",\n",
" }\n",
" },\n",
" ],\n",
" data_collections=[\"Age\"],\n",
")"
]
},
{
Expand Down Expand Up @@ -894,9 +909,19 @@
}
],
"source": [
"enrich(study_areas=[{\"address\":{\"Address\":\"380 New York Street\", \n",
" \"City\":\"Redlands\", \"Region\":\"CA\", \"Postal\":92373}}], \n",
" data_collections=['Age'])"
"enrich(\n",
" study_areas=[\n",
" {\n",
" \"address\": {\n",
" \"Address\": \"380 New York Street\",\n",
" \"City\": \"Redlands\",\n",
" \"Region\": \"CA\",\n",
" \"Postal\": 92373,\n",
" }\n",
" }\n",
" ],\n",
" data_collections=[\"Age\"],\n",
")"
]
},
{
Expand Down Expand Up @@ -995,8 +1020,10 @@
}
],
"source": [
"enrich(study_areas=[\"380 New York St Redlands CA 92373\"], \n",
" analysis_variables=[\"Age.FEM45\",\"Age.FEM55\",\"Age.FEM65\"])"
"enrich(\n",
" study_areas=[\"380 New York St Redlands CA 92373\"],\n",
" analysis_variables=[\"Age.FEM45\", \"Age.FEM55\", \"Age.FEM65\"],\n",
")"
]
},
{
Expand Down Expand Up @@ -1128,8 +1155,8 @@
}
],
"source": [
"pt = Point({\"x\" : -117.1956, \"y\" : 34.0572, \"spatialReference\" : {\"wkid\" : 4326}})\n",
"enrich(study_areas=[pt], data_collections=['Age'])"
"pt = Point({\"x\": -117.1956, \"y\": 34.0572, \"spatialReference\": {\"wkid\": 4326}})\n",
"enrich(study_areas=[pt], data_collections=[\"Age\"])"
]
},
{
Expand Down Expand Up @@ -1272,10 +1299,10 @@
}
],
"source": [
"pt1 = Point({\"x\" : -122.435, \"y\" : 37.785, \"spatialReference\" : {\"wkid\" : 4326}})\n",
"pt2 = Point({\"x\" : -122.433, \"y\" : 37.734, \"spatialReference\" : {\"wkid\" : 4326}})\n",
"pt1 = Point({\"x\": -122.435, \"y\": 37.785, \"spatialReference\": {\"wkid\": 4326}})\n",
"pt2 = Point({\"x\": -122.433, \"y\": 37.734, \"spatialReference\": {\"wkid\": 4326}})\n",
"\n",
"enrich(study_areas=[pt1, pt2], data_collections=['Age'])"
"enrich(study_areas=[pt1, pt2], data_collections=[\"Age\"])"
]
},
{
Expand All @@ -1300,9 +1327,13 @@
"metadata": {},
"outputs": [],
"source": [
"line = Polyline({\"paths\":[[[-13048580,4036370],[-13046151,4036366]]],\n",
" \"spatialReference\":{\"wkid\":102100}})\n",
"enriched_line_df = enrich(study_areas=[line], data_collections=['Age'])"
"line = Polyline(\n",
" {\n",
" \"paths\": [[[-13048580, 4036370], [-13046151, 4036366]]],\n",
" \"spatialReference\": {\"wkid\": 102100},\n",
" }\n",
")\n",
"enriched_line_df = enrich(study_areas=[line], data_collections=[\"Age\"])"
]
},
{
Expand Down Expand Up @@ -1428,7 +1459,7 @@
"outputs": [],
"source": [
"# Plot on a map\n",
"line_map = gis.map('Redlands, CA')\n",
"line_map = gis.map(\"Redlands, CA\")\n",
"line_map"
]
},
Expand Down Expand Up @@ -1590,11 +1621,21 @@
}
],
"source": [
"poly = Polygon({\"rings\":[[[-117.185412,34.063170],[-122.81,37.81],\n",
" [-117.200570,34.057196],[-117.185412,34.063170]]],\n",
" \"spatialReference\":{\"wkid\":4326}})\n",
"poly = Polygon(\n",
" {\n",
" \"rings\": [\n",
" [\n",
" [-117.185412, 34.063170],\n",
" [-122.81, 37.81],\n",
" [-117.200570, 34.057196],\n",
" [-117.185412, 34.063170],\n",
" ]\n",
" ],\n",
" \"spatialReference\": {\"wkid\": 4326},\n",
" }\n",
")\n",
"\n",
"enrich(study_areas=[poly], data_collections=['Age'])"
"enrich(study_areas=[poly], data_collections=[\"Age\"])"
]
},
{
Expand Down Expand Up @@ -1637,9 +1678,13 @@
},
"outputs": [],
"source": [
"buffered = BufferStudyArea(area='380 New York St Redlands CA 92373',\n",
" radii=[1,3,5], units='Miles', overlap=False)\n",
"drive_dist_df = enrich(study_areas=[buffered], data_collections=['Age'])"
"buffered = BufferStudyArea(\n",
" area=\"380 New York St Redlands CA 92373\",\n",
" radii=[1, 3, 5],\n",
" units=\"Miles\",\n",
" overlap=False,\n",
")\n",
"drive_dist_df = enrich(study_areas=[buffered], data_collections=[\"Age\"])"
]
},
{
Expand Down Expand Up @@ -1828,8 +1873,8 @@
"outputs": [],
"source": [
"# Plot on a map\n",
"buffer_map1 = gis.map('Redlands, CA')\n",
"buffer_map1.basemap.basemap = 'dark-gray-vector'\n",
"buffer_map1 = gis.map(\"Redlands, CA\")\n",
"buffer_map1.basemap.basemap = \"dark-gray-vector\"\n",
"buffer_map1"
]
},
Expand Down Expand Up @@ -1868,7 +1913,12 @@
"source": [
"renderer_manager = buffer_map1.content.renderer(0)\n",
"smart_mapping_manager = renderer_manager.smart_mapping()\n",
"smart_mapping_manager.class_breaks_renderer(break_type=\"size\", classification_method=\"esriClassifyNaturalBreaks\", num_classes=4, field=\"buffer_radii\")"
"smart_mapping_manager.class_breaks_renderer(\n",
" break_type=\"size\",\n",
" classification_method=\"esriClassifyNaturalBreaks\",\n",
" num_classes=4,\n",
" field=\"buffer_radii\",\n",
")"
]
},
{
Expand All @@ -1894,10 +1944,13 @@
},
"outputs": [],
"source": [
"buffered = BufferStudyArea(area='380 New York St Redlands CA 92373', \n",
" radii=[5, 10], units='Minutes', \n",
" travel_mode='Driving')\n",
"drive_time_df = enrich(study_areas=[buffered], data_collections=['Age'])"
"buffered = BufferStudyArea(\n",
" area=\"380 New York St Redlands CA 92373\",\n",
" radii=[5, 10],\n",
" units=\"Minutes\",\n",
" travel_mode=\"Driving\",\n",
")\n",
"drive_time_df = enrich(study_areas=[buffered], data_collections=[\"Age\"])"
]
},
{
Expand Down Expand Up @@ -2064,8 +2117,8 @@
"outputs": [],
"source": [
"# Plot on a map\n",
"buffer_map2 = gis.map('Redlands, CA')\n",
"buffer_map2.basemap.basemap = 'gray-vector'\n",
"buffer_map2 = gis.map(\"Redlands, CA\")\n",
"buffer_map2.basemap.basemap = \"gray-vector\"\n",
"buffer_map2"
]
},
Expand Down Expand Up @@ -2104,7 +2157,12 @@
"source": [
"renderer_manager = buffer_map1.content.renderer(0)\n",
"smart_mapping_manager = renderer_manager.smart_mapping()\n",
"smart_mapping_manager.class_breaks_renderer(break_type=\"size\", classification_method=\"esriClassifyNaturalBreaks\", num_classes=3, field=\"buffer_radii\")"
"smart_mapping_manager.class_breaks_renderer(\n",
" break_type=\"size\",\n",
" classification_method=\"esriClassifyNaturalBreaks\",\n",
" num_classes=3,\n",
" field=\"buffer_radii\",\n",
")"
]
},
{
Expand Down Expand Up @@ -2134,7 +2192,7 @@
"metadata": {},
"outputs": [],
"source": [
"usa = Country.get('US')"
"usa = Country.get(\"US\")"
]
},
{
Expand All @@ -2147,7 +2205,7 @@
},
"outputs": [],
"source": [
"redlands = usa.subgeographies.states['California'].zip5['92373']"
"redlands = usa.subgeographies.states[\"California\"].zip5[\"92373\"]"
]
},
{
Expand Down Expand Up @@ -2200,7 +2258,7 @@
},
"outputs": [],
"source": [
"redlands_df = enrich(study_areas=[redlands], data_collections=['Age'] )"
"redlands_df = enrich(study_areas=[redlands], data_collections=[\"Age\"])"
]
},
{
Expand Down Expand Up @@ -2326,7 +2384,7 @@
"metadata": {},
"outputs": [],
"source": [
"zip_map = gis.map('Redlands, CA')\n",
"zip_map = gis.map(\"Redlands, CA\")\n",
"zip_map"
]
},
Expand Down Expand Up @@ -2386,7 +2444,7 @@
},
"outputs": [],
"source": [
"ca_counties = usa.subgeographies.states['California'].counties"
"ca_counties = usa.subgeographies.states[\"California\"].counties"
]
},
{
Expand Down Expand Up @@ -2613,7 +2671,7 @@
}
],
"source": [
"counties_df = enrich(study_areas=ca_counties, data_collections=['Age'])\n",
"counties_df = enrich(study_areas=ca_counties, data_collections=[\"Age\"])\n",
"counties_df.head()"
]
},
Expand Down Expand Up @@ -2844,7 +2902,9 @@
}
],
"source": [
"counties_df2 = usa.enrich(study_areas=list(ca_counties.values()), data_collections=['transportation'])\n",
"counties_df2 = usa.enrich(\n",
" study_areas=list(ca_counties.values()), data_collections=[\"transportation\"]\n",
")\n",
"counties_df2.head()"
]
},
Expand All @@ -2861,7 +2921,7 @@
"metadata": {},
"outputs": [],
"source": [
"county_map = gis.map('California')\n",
"county_map = gis.map(\"California\")\n",
"county_map"
]
},
Expand Down Expand Up @@ -2898,7 +2958,7 @@
"metadata": {},
"outputs": [],
"source": [
"county_map.legend.enabled=True"
"county_map.legend.enabled = True"
]
},
{
Expand Down

0 comments on commit d52d4a5

Please sign in to comment.