I made a new CoastSeg env on Windows and I'm getting an error when I run this cell
try:
try:
list_of_inputs=check_images_available_selected_ROI(selected_ROI)
list_of_inputs
if list_of_inputs == []:
print("Error: No ROIs were selected. Please click a valid ROI on the map")
except ee.EEException as exception:
print(exception)
raise AuthenticationError
except AuthenticationError:
handle_AuthenticationError()
2022-02-03 15:12:20.946567
---------------------------------------------------------------------------
EEException Traceback (most recent call last)
~\github_clones\CoastSeg\notebooks\coastsat\SDS_download.py in check_images_available(inputs)
388 try:
--> 389 ee.ImageCollection('LANDSAT/LT05/C01/T1_TOA')
390 except:
~\Anaconda3\envs\new_coastseg\lib\site-packages\ee\computedobject.py in __call__(cls, *args, **kwargs)
31 else:
---> 32 return type.__call__(cls, *args, **kwargs)
33
~\Anaconda3\envs\new_coastseg\lib\site-packages\ee\imagecollection.py in __init__(self, args)
37 """
---> 38 self.initialize()
39
~\Anaconda3\envs\new_coastseg\lib\site-packages\ee\imagecollection.py in initialize(cls)
71 if not cls._initialized:
---> 72 super(ImageCollection, cls).initialize()
73 apifunction.ApiFunction.importApi(
~\Anaconda3\envs\new_coastseg\lib\site-packages\ee\collection.py in initialize(cls)
31 if not cls._initialized:
---> 32 apifunction.ApiFunction.importApi(cls, 'Collection', 'Collection')
33 apifunction.ApiFunction.importApi(
~\Anaconda3\envs\new_coastseg\lib\site-packages\ee\apifunction.py in importApi(cls, target, prefix, type_name, opt_prepend)
182 """
--> 183 cls.initialize()
184 prepend = opt_prepend or ''
~\Anaconda3\envs\new_coastseg\lib\site-packages\ee\apifunction.py in initialize(cls)
153 if not cls._api:
--> 154 signatures = data.getAlgorithms()
155 api = {}
~\Anaconda3\envs\new_coastseg\lib\site-packages\ee\data.py in getAlgorithms()
980 try:
--> 981 call = _get_cloud_api_resource().projects().algorithms().list(
982 parent=_get_projects_path(), prettyPrint=False)
~\Anaconda3\envs\new_coastseg\lib\site-packages\ee\data.py in _get_cloud_api_resource()
288 raise ee_exception.EEException(
--> 289 'Earth Engine client library not initialized. Run `ee.Initialize()`')
290 return _cloud_api_resource
EEException: Earth Engine client library not initialized. Run `ee.Initialize()`
During handling of the above exception, another exception occurred:
RefreshError Traceback (most recent call last)
~\AppData\Local\Temp\2\ipykernel_14904\1530565413.py in <module>
1 try:
2 try:
----> 3 list_of_inputs=check_images_available_selected_ROI(selected_ROI)
4 list_of_inputs
5 if list_of_inputs == []:
~\AppData\Local\Temp\2\ipykernel_14904\1653218588.py in check_images_available_selected_ROI(selected_ROI)
34 inputs = {'polygon': polygon, 'dates': dates, 'sat_list': sat_list, 'sitename': sitename, 'filepath':filepath}
35 # before downloading the images, check how many images are available for your inputs
---> 36 SDS_download.check_images_available(inputs)
37 list_of_inputs.append(inputs)
38 return list_of_inputs
~\github_clones\CoastSeg\notebooks\coastsat\SDS_download.py in check_images_available(inputs)
389 ee.ImageCollection('LANDSAT/LT05/C01/T1_TOA')
390 except:
--> 391 ee.Initialize()
392
393 print('Images available between %s and %s:'%(inputs['dates'][0],inputs['dates'][1]), end='\n')
~\Anaconda3\envs\new_coastseg\lib\site-packages\ee\__init__.py in Initialize(credentials, opt_url, cloud_api_key, http_transport, project)
121 cloud_api_key=cloud_api_key,
122 project=project,
--> 123 http_transport=http_transport)
124 # Initialize the dynamically loaded functions on the objects that want them.
125 ApiFunction.initialize()
~\Anaconda3\envs\new_coastseg\lib\site-packages\ee\data.py in initialize(credentials, api_base_url, tile_base_url, cloud_api_base_url, cloud_api_key, project, http_transport)
197 _http_transport = http_transport
198
--> 199 _install_cloud_api_resource()
200
201 if project is not None:
~\Anaconda3\envs\new_coastseg\lib\site-packages\ee\data.py in _install_cloud_api_resource()
271 headers_supplier=_make_request_headers,
272 response_inspector=_handle_profiling_response,
--> 273 http_transport=_http_transport)
274
275 _cloud_api_resource_raw = _cloud_api_utils.build_cloud_resource(
~\Anaconda3\envs\new_coastseg\lib\site-packages\ee\_cloud_api_utils.py in build_cloud_resource(api_base_url, api_key, credentials, timeout, headers_supplier, response_inspector, http_transport, raw)
149 requestBuilder=request_builder,
150 model=alt_model,
--> 151 cache_discovery=False)
152 resource._baseUrl = api_base_url
153 return resource
~\Anaconda3\envs\new_coastseg\lib\site-packages\googleapiclient\_helpers.py in positional_wrapper(*args, **kwargs)
129 elif positional_parameters_enforcement == POSITIONAL_WARNING:
130 logger.warning(message)
--> 131 return wrapped(*args, **kwargs)
132
133 return positional_wrapper
~\Anaconda3\envs\new_coastseg\lib\site-packages\googleapiclient\discovery.py in build(serviceName, version, http, discoveryServiceUrl, developerKey, model, requestBuilder, credentials, cache_discovery, cache, client_options, adc_cert_path, adc_key_path, num_retries, static_discovery, always_use_jwt_access)
294 developerKey,
295 num_retries=num_retries,
--> 296 static_discovery=static_discovery,
297 )
298 service = build_from_document(
~\Anaconda3\envs\new_coastseg\lib\site-packages\googleapiclient\discovery.py in _retrieve_discovery_doc(url, http, cache_discovery, serviceName, version, cache, developerKey, num_retries, static_discovery)
418 # Note that it will already raise an error if we don't get a 2xx response
419 req = HttpRequest(http, HttpRequest.null_postproc, actual_url)
--> 420 resp, content = req.execute(num_retries=num_retries)
421
422 try:
~\Anaconda3\envs\new_coastseg\lib\site-packages\googleapiclient\_helpers.py in positional_wrapper(*args, **kwargs)
129 elif positional_parameters_enforcement == POSITIONAL_WARNING:
130 logger.warning(message)
--> 131 return wrapped(*args, **kwargs)
132
133 return positional_wrapper
~\Anaconda3\envs\new_coastseg\lib\site-packages\googleapiclient\http.py in execute(self, http, num_retries)
929 method=str(self.method),
930 body=self.body,
--> 931 headers=self.headers,
932 )
933
~\Anaconda3\envs\new_coastseg\lib\site-packages\googleapiclient\http.py in _retry_request(http, num_retries, req_type, sleep, rand, uri, method, *args, **kwargs)
188 try:
189 exception = None
--> 190 resp, content = http.request(uri, method, *args, **kwargs)
191 # Retry on SSL errors and socket timeout errors.
192 except _ssl_SSLError as ssl_error:
~\Anaconda3\envs\new_coastseg\lib\site-packages\google_auth_httplib2.py in request(self, uri, method, body, headers, redirections, connection_type, **kwargs)
207 request_headers = headers.copy() if headers is not None else {}
208
--> 209 self.credentials.before_request(self._request, method, uri, request_headers)
210
211 # Check if the body is a file-like stream, and if so, save the body
~\Anaconda3\envs\new_coastseg\lib\site-packages\google\auth\credentials.py in before_request(self, request, method, url, headers)
131 # the http request.)
132 if not self.valid:
--> 133 self.refresh(request)
134 self.apply(headers)
135
~\Anaconda3\envs\new_coastseg\lib\site-packages\google\oauth2\credentials.py in refresh(self, request)
308 scopes=scopes,
309 rapt_token=self._rapt_token,
--> 310 enable_reauth_refresh=self._enable_reauth_refresh,
311 )
312
~\Anaconda3\envs\new_coastseg\lib\site-packages\google\oauth2\reauth.py in refresh_grant(request, token_uri, refresh_token, client_id, client_secret, scopes, rapt_token, enable_reauth_refresh)
345
346 if not response_status_ok:
--> 347 _client._handle_error_response(response_data)
348 return _client._handle_refresh_grant_response(response_data, refresh_token) + (
349 rapt_token,
~\Anaconda3\envs\new_coastseg\lib\site-packages\google\oauth2\_client.py in _handle_error_response(response_data)
58 error_details = json.dumps(response_data)
59
---> 60 raise exceptions.RefreshError(error_details, response_data)
61
62
RefreshError: ('invalid_grant: Token has been expired or revoked.', {'error': 'invalid_grant', 'error_description': 'Token has been expired or revoked.'})