import clr clr.AddReference('DHI.Solutions.TimeseriesManager.Tools.Processing') from DHI.Solutions.TimeseriesManager.Tools.Processing import * clr.AddReference('DHI.Solutions.Generic') from DHI.Solutions.Generic import * def FilterDischarges(): """ """ inputGroupPath = "/Discharge" outputGroupPath = "/Discharge_QC" tsmod = app.Modules.Get("Time Series Manager") inputGroup = tsmod.TimeSeriesGroupList.Fetch(inputGroupPath) q = Query(); q.Add(QueryElement('GroupId', inputGroup.Id, QueryOperator.Eq)); tsList = tsmod.TimeSeriesList.Fetch(q) for ts in tsList: tool = app.Tools.CreateNew('Quality flag filter') tool.InputItems.Add(ts) tool.FlagOption = FilteringOptions.Delete_flagged_time_steps tool.QualityFlag = "Out of Range Q" tool.ProcessCopy = False tool.Execute() outputtsTS = tool.OutputItems[0] ts1 = tsmod.TimeSeriesList.Fetch(outputGroupPath + "/" + ts.Name) ts1.DeleteAll() ts1.Add(outputtsTS.GetAll())