Skip to content

Commit

Permalink
Merge pull request #75 from ocefpaf/default_query
Browse files Browse the repository at this point in the history
use defaults when nothing is provided
  • Loading branch information
ocefpaf authored Oct 13, 2023
2 parents 29284a3 + 5a79d3e commit 4618507
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions gliderpy/fetchers.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,12 @@ def to_pandas(self):

def query(
self,
min_lat,
max_lat,
min_lon,
max_lon,
min_time,
max_time,
min_lat=None,
max_lat=None,
min_lon=None,
max_lon=None,
min_time=None,
max_time=None,
delayed=False,
):
"""
Expand All @@ -119,6 +119,14 @@ def query(
:param max_time: end time, can be datetime object or string
:return: search query with argument constraints applied
"""
# FIXME: The time constrain could be better implemented by just dropping it instead.
min_time = min_time if min_time else "1970-01-01"
max_time = max_time if max_time else "2038-01-19"
min_lat = min_lat if min_lat else -90.0
max_lat = max_lat if max_lat else 90.0
min_lon = min_lon if min_lon else -180.0
max_lon = max_lon if max_lon else 180.0

self.fetcher.constraints = {
"time>=": min_time,
"time<=": max_time,
Expand Down

0 comments on commit 4618507

Please sign in to comment.