Command csv2obsoul fails with integer ids
The command csv2obsoul seems to assume ids are strings and for me they are ints. I was able to fix this with:
diff --git a/netatmoqc/save_data.py b/netatmoqc/save_data.py
index 958e953..a572897 100644
--- a/netatmoqc/save_data.py
+++ b/netatmoqc/save_data.py
@@ -130,13 +130,17 @@ def save_df_as_obsoul(df, fpath=None, export_params=None):
obs_date = row.time_utc.strftime("%Y%m%d")
# obs_hour must not have leading zeros for the hour
obs_hour = row.time_utc.strftime("%k%M%S").strip()
+ if type(row.id) is str:
+ row_id = row.id[:8]
+ else:
+ row_id = row.id
header = (
17, # Got this from Jelena
obs_type,
obs_code,
row.lat,
row.lon,
- "'{}'".format(row.id[:8]),
+ "'{}'".format(row_id),
obs_date,
obs_hour,
row.alt,