Commit aeded9d6 authored by Paulo Medeiros's avatar Paulo Medeiros
Browse files

Shorten string station IDs using last 8 chars

It seems that the previously used method to shorten string station IDs
would not produce unique IDs in some cases.
parent 5179a0d2
......@@ -111,28 +111,12 @@ def mslp2sp_coeff(alt):
)
def remove_str_prefix(string, prefix):
"""Remove prefix from string."""
if string.startswith(prefix):
rtn = string[len(prefix) :]
else:
rtn = string
return rtn
@np.vectorize
def shorten_stat_id(stat_id):
"""Shorten station ID to length 8."""
if not isinstance(stat_id, str):
return stat_id
# Try first to produce IDs consistent with what Roel does in Netatmo.jl,
# to be comparable, as there's already people using Netatmo.jl.
new_id = stat_id[9:17]
if len(new_id) != 8:
# Use the strategy originally adapted in netatmoqc if the new ID
# is shorter than expected
new_id = remove_str_prefix(stat_id, prefix="enc:16:")
return new_id[:8]
return stat_id[-8:]
def read_netatmo_csv(
......
......@@ -7,7 +7,7 @@
[tool.poetry]
name = "netatmoqc"
version = "0.3.4"
version = "0.3.5"
description = "Use machine learning clustering methods to perform quality control over NetAtmo data"
authors = [
"Paulo V. C. Medeiros <paulo.medeiros@smhi.se>"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment