Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Register
  • Sign in
  • N netatmoqc
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 2
    • Issues 2
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Metrics
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • iObs
  • WP2
  • Task 2.3
  • netatmoqc
  • Issues
  • #3
Closed
Open
Issue created Jan 14, 2021 by Markus Koskela@makoskelOwner

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,
Assignee
Assign to
Time tracking