Skip to content

Commit

Permalink
update auth with GEE in notebook
Browse files Browse the repository at this point in the history
  • Loading branch information
2320sharon committed Oct 6, 2023
1 parent 7aae354 commit 9d17656
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions seg2map.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,21 @@
"metadata": {},
"outputs": [],
"source": [
"import ee\n",
"from google.auth import exceptions as google_auth_exceptions\n",
"\n",
"try:\n",
" ee.Initialize()\n",
"except google_auth_exceptions.RefreshError as exception:\n",
" print(\"Please authenticate with Google:\\n\")\n",
"except google_auth_exceptions.RefreshError:\n",
" print(\"Please refresh your Google authentication token.\\n\")\n",
" ee.Authenticate()\n",
" ee.Initialize()\n",
"except ee.EEException:\n",
" print(\"Please authenticate with Google Earth Engine:\\n\")\n",
" ee.Authenticate()\n",
" ee.Initialize()\n",
"except FileNotFoundError:\n",
" print(\"Credentials file not found. Please authenticate with Google Earth Engine:\\n\")\n",
" ee.Authenticate()\n",
" ee.Initialize()"
]
Expand Down Expand Up @@ -97,6 +108,14 @@
"models_ui = UI_Models()\n",
"models_ui.create_dashboard()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "080c0b88-db97-4fcf-9e39-0e12a447c0b9",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand All @@ -115,7 +134,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.9"
"version": "3.10.13"
}
},
"nbformat": 4,
Expand Down

0 comments on commit 9d17656

Please sign in to comment.