WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit 574a97d

Browse files
authored
Merge pull request #100 from GeoscienceAustralia/update/timestamp_in_path
update filepath with timestamp
2 parents 1e659d8 + cf65032 commit 574a97d

File tree

3 files changed

+13
-16
lines changed

3 files changed

+13
-16
lines changed

sar_pipeline/aws/metadata/odc.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
import datetime
2+
3+
14
def get_odc_product_name(product, collection_number, polarisations):
25
"""get the odc product name. WARNING this must align with
36
the DEA product name at indexing into the datacube.
@@ -31,9 +34,7 @@ def make_rtc_s1_s3_subpath(
3134
collection_number: int,
3235
burst_polarisations: list,
3336
burst_id: str,
34-
year: str,
35-
month: str,
36-
day: str,
37+
burst_st: datetime.datetime,
3738
):
3839
"""Structure for the RTC_S1 product sub-folders. These include
3940
information about when the burst was acquired.
@@ -48,24 +49,24 @@ def make_rtc_s1_s3_subpath(
4849
list of burst polarisations
4950
burst_id : str
5051
burst_id. e.g. t028_059507_iw2
51-
year : str
52-
year of burst acquisition
53-
month : str
54-
month of burst acquisition
55-
day : str
56-
day of burst acquisition
52+
burst_st : datetime.datetime
53+
The starting datetime for the the burst acquisition
5754
5855
Returns
5956
-------
6057
str
6158
path to the s3 bucket subfolder
6259
e.g. s3_project_folder/ga_s1_nrb_iw_vv_c1/t028_059507_iw2/2022/01/01
6360
"""
61+
6462
# get the odc product name which includes the collection number
63+
burst_st_fmt = burst_st.strftime(
64+
"%Y%m%dT%H%M%S"
65+
) # formatted timestamp without UTC 'Z'
6566
odc_product_name = get_odc_product_name(
6667
"RTC_S1", collection_number, burst_polarisations
6768
)
68-
return f"{s3_project_folder}/{odc_product_name}/{burst_id}/{year}/{month:02d}/{day:02d}"
69+
return f"{s3_project_folder}/{odc_product_name}/{burst_id}/{burst_st.year}/{burst_st.month:02d}/{burst_st.day:02d}/{burst_st_fmt}"
6970

7071

7172
def make_rtc_s1_static_s3_subpath(

sar_pipeline/aws/metadata/stac.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,7 @@ def _make_s3_subfolder(self):
170170
collection_number=self.collection_number,
171171
burst_polarisations=self.polarisations,
172172
burst_id=self.burst_id,
173-
year=self.start_dt.year,
174-
month=self.start_dt.month,
175-
day=self.start_dt.day,
173+
burst_st=self.start_dt,
176174
)
177175

178176
elif self.product == "RTC_S1_STATIC":

sar_pipeline/aws/preparation/burst_utils.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -226,9 +226,7 @@ def check_burst_product_h5_exists_in_s3(
226226
collection_number=collection_number,
227227
burst_polarisations=burst_polarisations,
228228
burst_id=burst_id,
229-
year=burst_st.year,
230-
month=burst_st.month,
231-
day=burst_st.day,
229+
burst_st=burst_st,
232230
)
233231
# assume the product exists if there is a .h5 file
234232
logging.info(f"searching s3 folder : {s3_product_subpath}")

0 commit comments

Comments
 (0)