Skip to content

Commit a9de0a9

Browse files
authored
Merge pull request #39 from eodms-sgdot/development
Fixed Maximum Cloud Cover Field
2 parents b48fc0e + 8df634c commit a9de0a9

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

eodms_cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
__license__ = 'MIT License'
3232
__description__ = 'Script used to search, order and download imagery from ' \
3333
'the EODMS using the REST API (RAPI) service.'
34-
__version__ = '3.2.2'
34+
__version__ = '3.3.1'
3535
__maintainer__ = 'Kevin Ballantyne'
3636
__email__ = 'eodms-sgdot@nrcan-rncan.gc.ca'
3737

scripts/utils.py

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ def _parse_filters(self, filters, coll_id=None):
317317

318318
filt = filt.upper()
319319

320-
if not any(x in filt for x in self.operators):
320+
if all(x not in filt for x in self.operators):
321321
print(f"Filter '{filt}' entered incorrectly.")
322322
continue
323323

@@ -338,13 +338,21 @@ def _parse_filters(self, filters, coll_id=None):
338338

339339
if key not in coll_fields.get_eod_fieldnames():
340340
err = f"Filter '{key}' is not available for Collection " \
341-
f"'{coll_id}'."
341+
f"'{coll_id}'."
342342
self.print_msg(f"WARNING: {err}")
343343
self.logger.warning(err)
344344
continue
345345

346346
fld = coll_fields.get_field(key).get_rapi_id()
347347

348+
# Modified operator if maximum or minimum
349+
if key.lower().find('maximum') > -1 and \
350+
fld.lower().find('maximum') == -1:
351+
op = "<="
352+
elif key.lower().find('minimum') > -1 and \
353+
fld.lower().find('minimum') == -1:
354+
op = ">="
355+
348356
val = filt_split[1].strip()
349357
val = val.replace('"', '').replace("'", '')
350358

@@ -1262,8 +1270,8 @@ def query_entries(self, collections, **kwargs):
12621270
# Parse filters
12631271
if filters:
12641272

1265-
# print(f"self.coll_id: {self.coll_id}")
1266-
# print(f"filters.keys(): {filters.keys()}")
1273+
print(f"self.coll_id: {self.coll_id}")
1274+
print(f"filters.keys(): {filters.keys()}")
12671275

12681276
if self.coll_id in filters.keys():
12691277
coll_filts = filters[self.coll_id]
@@ -1286,10 +1294,8 @@ def query_entries(self, collections, **kwargs):
12861294
if av_fields is None:
12871295
return None
12881296

1289-
for k in filt_parse.keys():
1290-
if k in av_fields['results']:
1291-
result_fields.append(k)
1292-
1297+
result_fields.extend(k for k in filt_parse.keys()
1298+
if k in av_fields['results'])
12931299
# Send a query to the EODMSRAPI object
12941300
print(f"\nSending query to EODMSRAPI with the following "
12951301
f"parameters:")

0 commit comments

Comments
 (0)