Skip to content

Commit

Permalink
Merge pull request #100 from c-hydro/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
ltrotter authored Sep 4, 2024
2 parents 0f27d4a + 33d7246 commit 63092d1
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
25 changes: 20 additions & 5 deletions door/data_sources/earthdata/cmr_downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@
import itertools
import sys
import numpy as np
from datetime import datetime, timedelta

from osgeo import gdal
from datetime import datetime
from typing import Optional

from ...base_downloaders import DOORDownloader
from ...utils.auth import get_credentials
Expand Down Expand Up @@ -71,11 +70,27 @@ def get_credentials(self, url: str) -> str:

return self.credentials

def get_last_published_ts(self, bounds: BoundingBox = BoundingBox(-180, -90, 180, 90), expected_tiles: int = 1) -> ts.TimeRange:
def get_last_published_ts(self,
bounds: Optional[BoundingBox] = None,
expected_tiles: Optional[int] = None) -> ts.TimeRange:

"""
Get the last published date for the dataset.
"""
#global_bounds = BoundingBox(-180, -90, 180, 90)
# get the space bounds
if bounds is None:
if hasattr(self, 'bounds'):
bounds = self.bounds
else:
raise ValueError('No space bounds specified')

# get the number of tiles
if expected_tiles is None:
if hasattr(self, 'destination'):
expected_tiles = self.destination.ntiles
else:
raise ValueError('No expected number of tiles specified')

now = datetime.now()
all_times = ts.TimeRange(self.start, now)
all_timesteps = self._get_timesteps(all_times)
Expand Down
2 changes: 1 addition & 1 deletion door/tools

0 comments on commit 63092d1

Please sign in to comment.