Mercurial > repos > siwaa > redelac_stics_e
comparison redelacPlanExpander.py @ 5:996b8019f5d5 draft
"planemo upload for repository https://forgemia.inra.fr/redelac/redelac-toolbox/-/tree/79e760a19b89e9a2045855e21a9ed1eba52061da/tools/REDELACplanExpander commit 79e760a19b89e9a2045855e21a9ed1eba52061da-dirty"
| author | siwaa |
|---|---|
| date | Tue, 17 Feb 2026 16:03:29 +0000 |
| parents | a7463ad6a389 |
| children | 40595ca55c78 |
comparison
equal
deleted
inserted
replaced
| 4:a7463ad6a389 | 5:996b8019f5d5 |
|---|---|
| 194 | 194 |
| 195 tmpDf['fstation'] = \ | 195 tmpDf['fstation'] = \ |
| 196 tmpDf['maille_drias'].astype(str) + '_' + \ | 196 tmpDf['maille_drias'].astype(str) + '_' + \ |
| 197 tmpDf['horizon '].astype(str) + '_sta.xml' | 197 tmpDf['horizon '].astype(str) + '_sta.xml' |
| 198 | 198 |
| 199 # Updating the fclim1 column | 199 # Updating the fclim1 column |
| 200 # alias =CONCATENATE($E2;".";YEAR(R2)) | 200 # alias =CONCATENATE($E2;".";YEAR(R2)) |
| 201 | 201 |
| 202 tmpDf['fclim1'] = \ | 202 tmpDf['fclim1'] = \ |
| 203 tmpDf['maille_drias'].astype(str) + '.' + \ | 203 tmpDf['maille_drias'].astype(str) + '.' + \ |
| 204 pd.to_datetime(tmpDf['Début'], dayfirst = True).dt.year.astype(str) | 204 pd.to_datetime(tmpDf['Début'], dayfirst = True).dt.year.astype(str) |
| 222 | 222 |
| 223 listOfSuccess = [x for x in listOfSuccessWithNA if not x.endswith('NA')] | 223 listOfSuccess = [x for x in listOfSuccessWithNA if not x.endswith('NA')] |
| 224 | 224 |
| 225 nbL = len(listOfSuccess) | 225 nbL = len(listOfSuccess) |
| 226 | 226 |
| 227 # fixing first station before to save | 227 # fixing stations before to save |
| 228 | 228 |
| 229 fi = 0 | 229 fi = 0 |
| 230 | 230 |
| 231 expandedDf.reset_index(inplace = True) | 231 expandedDf.reset_index(inplace = True) |
| 232 | 232 |
| 233 for succ in listOfSuccess: | 233 for succ in listOfSuccess: |
| 234 | 234 |
| 235 li = expandedDf[expandedDf['id_simu'] == succ].index.max() | 235 li = expandedDf[expandedDf['id_simu'] == succ].index.max() |
| 236 | 236 |
| 237 expandedDf.loc[fi:li - 1, 'fstation'] = expandedDf['fstation'][fi + 5] | 237 # 10 as ref should be reminded |
| 238 expandedDf.loc[fi:li - 1, 'fstation'] = expandedDf['fstation'][fi + 10] | |
| 238 | 239 |
| 239 fi = li + 1 | 240 fi = li + 1 |
| 240 | 241 |
| 241 expandedDf.drop(['ucs', 'Code_plante', 'Fichier_plante_STICS'], axis = 1, inplace = True) | 242 expandedDf.drop(['ucs', 'Code_plante', 'Fichier_plante_STICS'], axis = 1, inplace = True) |
| 242 expandedDf.to_csv(expandedPlanFileName, index=False, sep = ';') | 243 expandedDf.to_csv(expandedPlanFileName, index=False, sep = ';') |
