Commit db050046dd9eff33fc185708ffbb8f7d24fe0d9b
1 parent
0c75436e
Exists in
rhitier-dev
Order cols even if one is missing
Showing
1 changed file
with
1 additions
and
0 deletions
Show diff stats
web/run.py
@@ -946,6 +946,7 @@ def generate_csv_contents_spz(target_slug, input_slug, started_at, stopped_at): | @@ -946,6 +946,7 @@ def generate_csv_contents_spz(target_slug, input_slug, started_at, stopped_at): | ||
946 | final_df['vtot'] = final_df.apply(lambda x: sqrt(x.vtan * x.vtan + x.vrad * x.vrad), axis=1) | 946 | final_df['vtot'] = final_df.apply(lambda x: sqrt(x.vtan * x.vtan + x.vrad * x.vrad), axis=1) |
947 | 947 | ||
948 | cols_ordered = ['vrad', 'vtan', 'vtot', 'btan', 'brad', 'temp', 'pdyn', 'dens', 'atse', 'xhee', 'yhee'] | 948 | cols_ordered = ['vrad', 'vtan', 'vtot', 'btan', 'brad', 'temp', 'pdyn', 'dens', 'atse', 'xhee', 'yhee'] |
949 | + cols_ordered = [_c for _c in cols_ordered if _c in final_df.columns] | ||
949 | final_df = final_df[cols_ordered] | 950 | final_df = final_df[cols_ordered] |
950 | final_df.index.name = 'time' | 951 | final_df.index.name = 'time' |
951 | return final_df.to_csv(date_format='%Y-%m-%dT%H:%M:%S+00:00', float_format="%.5f", | 952 | return final_df.to_csv(date_format='%Y-%m-%dT%H:%M:%S+00:00', float_format="%.5f", |