Skip to content

Commit f2fc83c

Browse files
author
csouton
committed
Update csv data colomn from gsheet template
1 parent b8e9157 commit f2fc83c

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

main.py

+18-1
Original file line numberDiff line numberDiff line change
@@ -363,14 +363,31 @@ def df_to_csv(df, tile: str):
363363
"""
364364

365365
'''Formating template'''
366-
df['Data'] = ''
367366
df['SpatialCoverage'] = ''
368367

369368
df = df.replace(to_replace='.TUILE.', value=tile, regex=True)
370369
df = df.replace(to_replace='.DATE\]', value=date.today().strftime('%Y-%m-%d'), regex=True)
371370
df = df.replace(to_replace='.DATE_D.', value='2015', regex=True)
372371
df = df.replace(to_replace='.DATE_F.', value='2023', regex=True)
373372

373+
'''Add zip data'''
374+
data_source = 'source:/DATA/S2/PRODUCTS/GEOFLOW/data/zip/'
375+
data_upload_source = 'uploadSource:'
376+
indice = ''
377+
temporal_coverage = ['2015', '2016', '2017', '2018', '2019', '2020', '2021', '2022', '2023']
378+
for i in range(0, df.shape[0]):
379+
indice = df.iloc[i, 0].split('_')[3] #get indice from identifier cel
380+
381+
for y in temporal_coverage:
382+
if y == temporal_coverage[-1]:
383+
data_source = data_source + indice +'_'+tile+'_'+y+".zip_\n"
384+
data_upload_source = data_upload_source + indice +'_'+tile+'_'+y+".zip_\n"
385+
else:
386+
data_source = data_source + indice + '_' + tile + '_' + y + '.zip,'
387+
data_upload_source = data_upload_source + indice +'_'+tile+'_'+y+".zip,"
388+
389+
df.iloc[i, 15] = data_source+"sourceType:other_\n"+data_upload_source+"uploadType:other_\n"+"sourceZip:false"
390+
374391
# '''concat statement with description'''
375392
# for i in range(0, df.shape[0]):
376393
# description = df.iloc[i, 2].split(':')[1]

0 commit comments

Comments
 (0)