comparison redelacxlsx2csv.py @ 2:3dfb066dcdab draft default tip

"planemo upload for repository https://forgemia.inra.fr/redelac/redelac-toolbox/-/tree/e8749ba309ff18daeaea5c4a9e7ee4b7448bd58d/tools/REDELACxlsx2csv commit e8749ba309ff18daeaea5c4a9e7ee4b7448bd58d-dirty"
author siwaa
date Fri, 05 Dec 2025 16:12:55 +0000
parents b91beff0963c
children
comparison
equal deleted inserted replaced
1:b91beff0963c 2:3dfb066dcdab
5 redelacUSMsOutputFile = sys.argv[2] 5 redelacUSMsOutputFile = sys.argv[2]
6 redelacTecOutputFile = sys.argv[3] 6 redelacTecOutputFile = sys.argv[3]
7 redelacIniOutputFile = sys.argv[4] 7 redelacIniOutputFile = sys.argv[4]
8 redelacStationOutputFile = sys.argv[5] 8 redelacStationOutputFile = sys.argv[5]
9 redelacListe_plantesOutputFile = sys.argv[6] 9 redelacListe_plantesOutputFile = sys.argv[6]
10 redelacSuccessionsOutputFile = sys.argv[7]
10 11
11 # loading 12 # loading
12 13
13 USMsPdf = pd.read_excel(redelacXlsxInputFile, engine = 'openpyxl', sheet_name='USMs', keep_default_na=False, na_filter = False) 14 USMsPdf = pd.read_excel(redelacXlsxInputFile, engine = 'openpyxl', sheet_name='USMs', keep_default_na=False, na_filter = False)
14 TecPdf = pd.read_excel(redelacXlsxInputFile, engine = 'openpyxl', sheet_name='Tec') 15 TecPdf = pd.read_excel(redelacXlsxInputFile, engine = 'openpyxl', sheet_name='Tec')
15 IniPdf = pd.read_excel(redelacXlsxInputFile, engine = 'openpyxl', sheet_name='Ini') 16 IniPdf = pd.read_excel(redelacXlsxInputFile, engine = 'openpyxl', sheet_name='Ini')
16 StationPdf = pd.read_excel(redelacXlsxInputFile, engine = 'openpyxl', sheet_name='Station') 17 StationPdf = pd.read_excel(redelacXlsxInputFile, engine = 'openpyxl', sheet_name='Station')
17 Liste_plantesPdf = pd.read_excel(redelacXlsxInputFile, engine = 'openpyxl', sheet_name='Liste_plantes') 18 Liste_plantesPdf = pd.read_excel(redelacXlsxInputFile, engine = 'openpyxl', sheet_name='Liste_plantes')
19 Successions = pd.read_excel(redelacXlsxInputFile, engine = 'openpyxl', sheet_name='liste_USMs')
18 20
19 # sanityzing 21 # sanityzing
20 22
21 julCol = [x for x in TecPdf.columns if x.startswith('jul')] 23 julCol = [x for x in TecPdf.columns if x.startswith('jul')]
22 24
23 TecPdf[julCol] = TecPdf[julCol].astype('Int64') 25 TecPdf[julCol] = TecPdf[julCol].astype('Int64')
24 26
25 USMsPdf['fclim1'] = USMsPdf['fclim1'].astype('string') 27
26 USMsPdf['fclim2'] = USMsPdf['fclim1'].astype('string') 28
29 USMsPdf['fclim1'] = USMsPdf['fclim1'].apply(lambda x: format(x, ".4f")).astype('string')
30 USMsPdf['fclim2'] = USMsPdf['fclim2'].apply(lambda x: format(x, ".4f")).astype('string')
27 USMsPdf['rcp'] = USMsPdf['rcp'].astype('string') 31 USMsPdf['rcp'] = USMsPdf['rcp'].astype('string')
28 32
29 USMsPdf['Début'] = pd.to_datetime(USMsPdf['Début'], dayfirst = True) 33 USMsPdf['Début'] = pd.to_datetime(USMsPdf['Début'], dayfirst = True)
30 USMsPdf['Fin'] = pd.to_datetime(USMsPdf['Fin'], dayfirst = True) 34 USMsPdf['Fin'] = pd.to_datetime(USMsPdf['Fin'], dayfirst = True)
31 35
36 USMsPdf.to_csv(redelacUSMsOutputFile, sep=';', date_format='%d/%m/%Y', decimal = ',', index=False) 40 USMsPdf.to_csv(redelacUSMsOutputFile, sep=';', date_format='%d/%m/%Y', decimal = ',', index=False)
37 TecPdf.to_csv(redelacTecOutputFile, sep=';', date_format='%d/%m/%Y', decimal = ',', float_format='%.2f', index=False) 41 TecPdf.to_csv(redelacTecOutputFile, sep=';', date_format='%d/%m/%Y', decimal = ',', float_format='%.2f', index=False)
38 IniPdf.to_csv(redelacIniOutputFile, sep=';', date_format='%d/%m/%Y', decimal = ',', index=False) 42 IniPdf.to_csv(redelacIniOutputFile, sep=';', date_format='%d/%m/%Y', decimal = ',', index=False)
39 StationPdf.to_csv(redelacStationOutputFile, sep=';', date_format='%d/%m/%Y', decimal = ',', index=False) 43 StationPdf.to_csv(redelacStationOutputFile, sep=';', date_format='%d/%m/%Y', decimal = ',', index=False)
40 Liste_plantesPdf.to_csv(redelacListe_plantesOutputFile, sep=';', date_format='%d/%m/%Y', decimal = ',', index=False) 44 Liste_plantesPdf.to_csv(redelacListe_plantesOutputFile, sep=';', date_format='%d/%m/%Y', decimal = ',', index=False)
45 Successions.to_csv(redelacSuccessionsOutputFile, sep=';', index=False)