###################################################################
# UPDATE STS
###################################################################

if replace:
    MESSAGE("reading original time series")
    try:
        ots = Sgts(ts_dir=path_pck, read=True, verbose=verbose)
    except:
        ots = Sgts(ts_dir=path_pos, read=True, verbose=verbose)

    MESSAGE("%d time series read" % ots.n())
    MESSAGE("merging original and new time series")

    i = 1
    for code in sorted(sts.lcode()):
        MESSAGE("merging time series for %s %04d / %04d " %
                (code, i, len(sts.lcode())))
        # insert the created ts
        if ots.has_ts(code):
            ots.__dict__[code] = ots.__dict__[code].insert_ts(
                sts.__dict__[code], rounding='hour', data='xyz', overlap=True)
        # calculates .data from .data_xyz
        ots.__dict__[code].xyz2neu(corr=True)
        i = i + 1

    sts = ots.copy()

else:
    MESSAGE("reordering date in times series")
    sts.gts('reorder')
Esempio n. 2
0
# TESTS FOR gts subpackage

from pyacs.gts.Sgts import Sgts as Sgts
import numpy as np
from pyacs.gts.lib.outliers import find_outliers_sliding_window

dir_test = 'data/ts'

dir_output = 'output'

# Reading ts files
ts = Sgts(dir_test)

# select site

code = ts.lcode()[0]

# test plot basic
ts.__dict__[code].plot(save=dir_output + '/' + code + '_01.png',
                       verbose=True,
                       title='ex_01: raw time series')

# test outliers percentage
ts.__dict__[code]\
.find_outliers_percentage()\
.plot(save=dir_output+'/'+code+'_02.png',verbose=True, title='ex_02: outliers (percentage method)')

# test outliers smoothing time windows
ts.__dict__[code]\
.find_outliers_sliding_window()\
.plot(save=dir_output+'/'+code+'_03.png',verbose=True, title='ex_03: outliers (sliding window method)')