I have historical tags that are secondly. I'd like to slice down to the current month (from midnight on the first of the month to now() and resample the tag (like pandas.DataFrame.resample() in Python3) to a 1min rolling mean and a 15min rolling mean. Following that, I'll need to run some calculations on each set, but will need the sets themselves for other things.
What's the best way to go about this? I know exactly how to do this in Python3/pandas, but getting it done within the ignition ecosystem isn't clear to me. I've been up and down this forum and Inductive University and can't seem to find an answer that makes sense for my uses. Any assistance is much appreciated.
Your best bet is probably going to be to encapsulate the logic to perform the tag history aggregation you want, via system.tag.queryTagHistory.
I would recommend leaving the start and end date as inputs to your script, but encapsulating most/all of the other history query parameters in the script.
Then, you have a few options.
I would personally recommend a gateway scheduled script that writes out to particular memory tag(s) that holds the aggregated dataset(s).
Or, if you want to have the call to the script "closer" to the final tag, you could potentially use the runScript expression function in an expression tag to run your project library script and return the results directly.
Thanks very much. I have few scripts running now on Scheduled that write dataset Memory tags, these tags feed some plots I needed. That's the first part. Now need to work on slicing data to current month AND need separate slices for a certain time period on weekdays.