Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VV,VH VALUES, SENTINEL-1 APIError #217

Closed
nadjagbr opened this issue May 19, 2023 · 1 comment
Closed

VV,VH VALUES, SENTINEL-1 APIError #217

nadjagbr opened this issue May 19, 2023 · 1 comment

Comments

@nadjagbr
Copy link

nadjagbr commented May 19, 2023

Hi, I am currently working on a project in Microsoft Planetary Hub, where I want to use vh and vv data.
Before, I was able to download the data, however, this doesn't work anymore.
I pasted my code and the error I receive. Can someone help me out?

CODE:

Function call to extract VV,VH Values

time_slice = "2020-03-20/2020-03-21"
assests = ['vh','vv']
vh_vv = []
for coordinates in tqdm(hi2):
vh_vv.append(get_sentinel_data(coordinates,time_slice,assests))
vh_vv_data = pd.DataFrame(vh_vv,columns =['vh','vv'])

ERROR:

APIError Traceback (most recent call last)
Cell In[12], line 6
4 vh_vv = []
5 for coordinates in tqdm(hi2):
----> 6 vh_vv.append(get_sentinel_data(coordinates,time_slice,assests))
7 vh_vv_data = pd.DataFrame(vh_vv,columns =['vh','vv'])

Cell In[3], line 20, in get_sentinel_data(latlong, time_slice, assets)
14 catalog = pystac_client.Client.open(
15 "https://planetarycomputer.microsoft.com/api/stac/v1"
16 )
17 search = catalog.search(
18 collections=["sentinel-1-rtc"], bbox=bbox_of_interest, datetime=time_of_interest
19 )
---> 20 items = list(search.get_all_items())
21 bands_of_interest = assets
22 data = stac_load([items[0]], patch_url=pc.sign, bbox=bbox_of_interest).isel(time=0)

File /srv/conda/envs/notebook/lib/python3.10/site-packages/pystac_client/item_search.py:844, in ItemSearch.get_all_items(self)
832 """DEPRECATED
833
834 .. deprecated:: 0.4.0
(...)
838 item_collection : ItemCollection
839 """
840 warnings.warn(
841 "get_all_items() is deprecated, use item_collection() instead.",
842 DeprecationWarning,
843 )
--> 844 return self.item_collection()

File /srv/conda/envs/notebook/lib/python3.10/site-packages/pystac_client/item_search.py:745, in ItemSearch.item_collection(self)
737 """
738 Get the matching items as a :py:class:pystac.ItemCollection.
739
740 Return:
741 ItemCollection: The item collection
742 """
743 # Bypass the cache here, so that we can pass preserve_dict
744 # without mutating what's in the cache.
--> 745 feature_collection = self.item_collection_as_dict.wrapped(self)
746 # already signed in item_collection_as_dict
747 return ItemCollection.from_dict(
748 feature_collection, preserve_dict=False, root=self.client
749 )

File /srv/conda/envs/notebook/lib/python3.10/site-packages/pystac_client/item_search.py:766, in ItemSearch.item_collection_as_dict(self)
753 """
754 Get the matching items as an item-collection-like dict.
755
(...)
763 Dict : A GeoJSON FeatureCollection
764 """
765 features = []
--> 766 for page in self._stac_io.get_pages(
767 self.url, self.method, self.get_parameters()
768 ):
769 for feature in page["features"]:
770 features.append(feature)

File /srv/conda/envs/notebook/lib/python3.10/site-packages/pystac_client/stac_api_io.py:248, in StacApiIO.get_pages(self, url, method, parameters)
236 def get_pages(
237 self,
238 url: str,
239 method: Optional[str] = None,
240 parameters: Optional[Dict[str, Any]] = None,
241 ) -> Iterator[Dict[str, Any]]:
242 """Iterator that yields dictionaries for each page at a STAC paging
243 endpoint, e.g., /collections, /search
244
245 Return:
246 Dict[str, Any] : JSON content from a single page
247 """
--> 248 page = self.read_json(url, method=method, parameters=parameters)
249 if not (page.get("features") or page.get("collections")):
250 return None

File /srv/conda/envs/notebook/lib/python3.10/site-packages/pystac/stac_io.py:202, in StacIO.read_json(self, source, *args, **kwargs)
185 def read_json(self, source: HREF, *args: Any, **kwargs: Any) -> Dict[str, Any]:
186 """Read a dict from the given source.
187
188 See :func:StacIO.read_text <pystac.StacIO.read_text> for usage of
(...)
200 given source.
201 """
--> 202 txt = self.read_text(source, *args, **kwargs)
203 return self.json_loads(txt)

File /srv/conda/envs/notebook/lib/python3.10/site-packages/pystac_client/stac_api_io.py:123, in StacApiIO.read_text(self, source, *args, **kwargs)
121 href = str(source)
122 if _is_url(href):
--> 123 return self.request(href, *args, **kwargs)
124 else:
125 with open(href) as f:

File /srv/conda/envs/notebook/lib/python3.10/site-packages/pystac_client/stac_api_io.py:171, in StacApiIO.request(self, href, method, headers, parameters)
169 raise APIError(str(err))
170 if resp.status_code != 200:
--> 171 raise APIError.from_response(resp)
172 try:
173 return resp.content.decode("utf-8")

APIError: <html](http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'%3E%3Chtml) xmlns='http://www.w3.org/1999/xhtml'><meta content='text/html; charset=utf-8' http-equiv='content-type'/><style type='text/css'>body {font-family:Arial; margin-left:40px; }img { border:0 none; }#content { margin-left: auto; margin-right: auto }#message h2 { font-size: 20px; font-weight: normal; color: #000000; margin: 34px 0px 0px 0px }#message p { font-size: 13px; color: #000000; margin: 7px 0px 0px0px}#errorref { font-size: 11px; color: #737373; margin-top: 41px }</style><title>Service unavailable</title>

Our services aren't available right now

We're working to restore all services as soon as possible. Please check back soon.

0z7dmZAAAAAASLWvzFwctTo1U2A1bi6uMQlJVMzBFREdFMDQwNgA5MjdhYmZhNi0xOWY2LTRhZjEtYTA5ZC1jOTU5ZDlhMWU2NDQ=

@TomAugspurger
Copy link

TomAugspurger commented May 19, 2023

Thanks for the report. This looks like microsoft/planetary-computer-apis#176. Follow along there and stac-utils/pystac-client#520 for updates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants