Closed peanutbutter-memory closed 1 year ago
Traceback
NameError Traceback (most recent call last)
Cell In[39], line 59
9 geographic_area = ("intersects", {"type": "Polygon",
10 "coordinates": [
11 [
(...)
51 }
52 )
54 # List all fields and choices
55 #print(rapi.print_results(rapi.get_available_fields(desired_product)))
56 #print(rapi.print_results(rapi.get_field_choices(desired_product)))
57
58 # Submit a search
---> 59 rapi.search(desired_product, filters=filter, features=geographic_area, dates=dates)
60 results = rapi.get_results()
61 # Pretty print of results for human reading:)
File ~/.virtualenvs/tc-nast/lib/python3.11/site-packages/eodms_rapi/eodms.py:3091, in EODMSRAPI.search(self, collection, filters, features, dates, result_fields, max_results)
3088 params = {'collection': self.collection}
3090 if filters is not None or features is not None or dates is not None:
-> 3091 params['query'] = self._parse_query(filters, features, dates)
3092 if self.err_occurred:
3093 return None
File ~/.virtualenvs/tc-nast/lib/python3.11/site-packages/eodms_rapi/eodms.py:1120, in EODMSRAPI._parse_query(self, filters, feats, dates)
1117 op = f[0].upper()
1118 src = f[1]
-> 1120 self.geoms = self.geo.add_geom(src)
1122 if self.geoms is None or isinstance(self.geoms, SyntaxError):
1123 self.msg = f"Geometry feature #{str(idx + 1)} could " \
1124 f"not be determined. Excluding it from search."
File ~/.virtualenvs/tc-nast/lib/python3.11/site-packages/eodms_rapi/geo.py:316, in EODMSGeo.add_geom(self, in_src)
314 if not isinstance(in_src, list):
315 try:
--> 316 eval(in_src)
317 except SyntaxError as err:
318 self.logger.warning(f"{err}")
File <string>:1
NameError: name 'n' is not defined
Fixed in release v1.5.6 (https://github.com/eodms-sgdot/py-eodms-rapi/commit/175a11239af061c7b83e00a20a497eb39ebe6955)
Attempting to replicate EODMS GUI search via Python API.
Can query
collections and available fields and choices
.Running into issue when attempting to use geometry filter (was not able to run without a geometry filter). The spatial predicate
within
orintersects
seems to not be parsed correctly; tracebacks refer to the second letter of each predicate I have tried. Attempted to contain predicate in a list but that failed too.Windows 11 running WSL 2 Ubuntu 22.04 with Python 3.11. Latest install of
py-eodms-rapi
.