Skip to content

Commit

Permalink
update version date
Browse files Browse the repository at this point in the history
  • Loading branch information
Enovotny committed Oct 3, 2023
1 parent 4d71894 commit f0e979f
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/cumulus_geoproc/utils/cgdal.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,12 @@ def findsubset(ds: gdal.Dataset, subset_params):


def getVersionDate(
ds: gdal.Dataset, src_path, metaVar: str, fileDateFormat: str, filedateSearch
ds: gdal.Dataset,
src_path,
metaVar: str,
fileDateFormat: str,
filedateSearch,
MetaDate=True,
):
"""Get the Version date of the grid
Parameters
Expand All @@ -412,6 +417,8 @@ def getVersionDate(
format string for data in filename i.e. %Y%m%d_%H%M
filedateSearch: regular expression operation
regular expression operation to find date in filename
MetaDate: Boolean
Defaul = True. Use date from file metadata. If false it will only look at file.
Returns
-------
Expand All @@ -423,7 +430,7 @@ def getVersionDate(
# get the version
date_created = ds.GetMetadataItem(metaVar)
date_created_match = re.search("\\d+", date_created)
if date_created_match:
if date_created_match and MetaDate:
version_datetime = datetime.fromtimestamp(int(date_created_match[0])).replace(
tzinfo=timezone.utc
)
Expand Down

0 comments on commit f0e979f

Please sign in to comment.