-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add acquisition date to subsetted granules
- Loading branch information
1 parent
6ad64a7
commit 0c708ac
Showing
3 changed files
with
22 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from datetime import datetime | ||
|
||
def get_date_from_gedi_fn(granule_name): | ||
""" | ||
Transforms Julian Date present in the GEDI Filenames by default into | ||
a date string with format YYYY/mm/dd (e.g. 2024/03/06) | ||
Args - | ||
granule_name: str | ||
Returns - | ||
date_sec (date_section) str in format YYYY/mm/dd | ||
""" | ||
filename = granule_name.split("/")[-1] | ||
julian_date = filename.split("_")[2][0:7] | ||
date_sec = datetime.strptime(julian_date, "%Y%j").date() | ||
date_sec = date_sec.strftime("%Y/%m/%d") | ||
return date_sec |