public class GTSHelper
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
GTSHelper.BinarySearchTickChoice
Option for the binarySearchTick function.
|
| Constructor and Description |
|---|
GTSHelper() |
| Modifier and Type | Method and Description |
|---|---|
static java.util.List<GeoTimeSerie> |
apply(WarpScriptBinaryOp op,
java.util.Collection<GeoTimeSerie> op1,
java.util.Collection<GeoTimeSerie> op2,
java.util.Collection<java.lang.String> bylabels)
Deprecated.
|
static GeoTimeSerie |
applyNAryFunction(WarpScriptNAryFunction function,
java.util.Map<java.lang.String,java.lang.String> commonlabels,
java.util.List<GeoTimeSerie>... subseries) |
static java.util.List<java.lang.Number> |
bbox(GeoTimeSerie gts) |
static int |
binarySearchTick(GeoTimeSerie gts,
int fromIndex,
int toIndex,
long timestamp,
GTSHelper.BinarySearchTickChoice tickChoice)
Gives the index of the first/last/arbitrary instance of the given timestamp in a sorted GTS.
|
static int |
binarySearchTick(GeoTimeSerie gts,
long timestamp,
GTSHelper.BinarySearchTickChoice tickChoice) |
static java.util.List<GeoTimeSerie> |
booleanGTSSplit(GeoTimeSerie gts,
boolean shrink) |
static void |
booleanNot(GeoTimeSerie gts) |
static java.util.BitSet |
booleanValues(GeoTimeSerie gts) |
static GeoTimeSerie |
bSAX(GeoTimeSerie gts,
int alphabetSize,
int wordLen,
int windowLen,
boolean standardizePAA)
Produces a String GTS whose values are the encoded bSAX words of the sequence starting at each tick.
|
static GeoTimeSerie |
bucketize(GeoTimeSerie gts,
long bucketspan,
int bucketcount,
long lastbucket,
java.lang.Object aggregator,
long maxbuckets,
WarpScriptStack stack) |
static GeoTimeSerie |
bucketize(GeoTimeSerie gts,
long bucketspan,
int bucketcount,
long lastbucket,
WarpScriptBucketizerFunction aggregator,
long maxbuckets)
Converts a Geo Time Serie into a bucketized version.
|
static java.lang.String |
buildSelector(GeoTimeSerie gts,
boolean forSearch) |
static java.lang.String |
buildSelector(Metadata metadata,
boolean forSearch)
Build a string representation of Metadata suitable for selection (via FIND/FETCH).
|
static java.util.List<GeoTimeSerie> |
chunk(GeoTimeSerie gts,
long lastchunk,
long chunkwidth,
long chunkcount,
java.lang.String chunklabel,
boolean keepempty)
Splits a GTS in 'chunks' of equal time length.
|
static java.util.List<GeoTimeSerie> |
chunk(GeoTimeSerie gts,
long lastchunk,
long chunkwidth,
long chunkcount,
java.lang.String chunklabel,
boolean keepempty,
long overlap) |
static java.util.List<GTSEncoder> |
chunk(GTSEncoder encoder,
long lastchunk,
long chunkwidth,
long chunkcount,
java.lang.String chunklabel,
boolean keepempty,
long overlap) |
static long |
classId(byte[] key,
GeoTimeSerie gts)
Compute the class Id of a Geo Time Serie instance.
|
static long |
classId(byte[] key,
java.lang.String name)
Compute a class Id (metric name Id) using SipHash and the given key.
|
static long |
classId(long[] key,
java.lang.String name) |
static long |
classId(long k0,
long k1,
java.lang.String name) |
static void |
clear(GeoTimeSerie gts)
Removes all values from a GTS instance by setting its value count to 0
and its type to UNDEFINED
|
static java.util.Map<java.lang.String,java.lang.String> |
commonAttributes(java.util.List<GeoTimeSerie> lgts)
Find common attributes, taking into account keys and values, in a list of GTSs.
|
static java.util.List<GeoTimeSerie> |
commonTicks(java.util.List<GeoTimeSerie> series)
Return shrinked versions of the input GTS containing only the ticks which have
values in all input GTS.
|
static GeoTimeSerie |
compact(GeoTimeSerie gts,
boolean preserveRanges)
Compact a GeoTimeSerie instance by removing measurements which have the same
value/location/elevation as the previous one.
|
static int |
compareAllAtTick(GeoTimeSerie gts,
int index1,
int index2)
Compare data in a GTS at given indexes.
|
static GeoTimeSerie |
compensateResets(GeoTimeSerie gts,
boolean resethigher)
Compensate resets by computing an offset each time a value decreased between two ticks.
|
static void |
copy(GeoTimeSerie src,
int srcPos,
GeoTimeSerie dest,
int destPos,
int length)
Copy the specified part of a GTS to an other specified part of GTS.
|
static void |
copyGeo(GeoTimeSerie from,
GeoTimeSerie to)
Copy geo infos (location + elevation) from GTS 'from' into GTS 'to'
Only infos for matching ticks with values in 'to' will be copied
|
static GeoTimeSerie |
cprob(GeoTimeSerie gts,
java.lang.String separator)
Compute conditional probabilities given a GTS considering the values as the concatenation
of given events plus the event for which we want to compute the probability, separated by 'separator'.
|
static GeoTimeSerie |
crop(GeoTimeSerie gts)
Crops a bucketized GTS so it spans the largest interval with actual values.
|
static GeoTimeSerie |
dedup(GeoTimeSerie gts)
Remove duplicate ticks from the GeoTimeSerie instance.
|
static GeoTimeSerie |
detect(GeoTimeSerie gts,
int alphabetSize,
int wordLen,
int windowLen,
java.util.Collection<java.lang.String> patterns,
boolean standardizePAA)
Detect patterns in a Geo Time Serie instance.
|
static java.util.List<GeoTimeSerie> |
doubleExponentialSmoothing(GeoTimeSerie gts,
double alpha,
double beta)
Perform a double exponential smoothing on the input GTS.
|
static double[] |
doubleValues(GeoTimeSerie gts) |
static void |
dump(GTSEncoder encoder,
java.io.PrintWriter pw) |
static long |
elevationAtIndex(GeoTimeSerie gts,
int idx)
Return the elevation in a GeoTimeSerie at a given index
|
static long |
elevationAtTick(GeoTimeSerie gts,
long tick)
Return the elevation in a Geo Time Serie at a given timestamp.
|
static void |
encodeName(java.lang.StringBuilder sb,
java.lang.String name) |
static void |
encodeValue(java.lang.StringBuilder sb,
java.lang.Object value) |
static java.util.List<GeoTimeSerie> |
fill(GeoTimeSerie gtsa,
GeoTimeSerie gtsb,
WarpScriptFillerFunction filler)
This function fills the gaps in two GTS so they end up with identical ticks
|
static void |
fillGTSIds(byte[] bytes,
int offset,
long classId,
long labelsId) |
static GeoTimeSerie |
fillnext(GeoTimeSerie gts)
Fill missing values/locations/elevations in a bucketized GTS with the next
encountered one.
|
static GeoTimeSerie |
fillprevious(GeoTimeSerie gts)
Fill missing values/locations/elevations in a bucketized GTS with the previously
encountered one.
|
static GeoTimeSerie |
fillticks(GeoTimeSerie gts,
long location,
long elevation,
java.lang.Object value,
long[] ticks)
Fill the given ticks in a GTS with the elements provided.
|
static GeoTimeSerie |
fillvalue(GeoTimeSerie gts,
long location,
long elevation,
java.lang.Object value)
Fill missing values/locations/elevations in a bucketized GTS with the
given location/elevation/value.
|
static long |
firsttick(GeoTimeSerie gts)
Return the first tick in the GTS instance.
|
static GeoTimeSerie |
fullsort(GeoTimeSerie gts)
Sort the GTS by respectively by tick, value, location and elevation.
|
static GeoTimeSerie |
fullsort(GeoTimeSerie gts,
boolean reversed)
Sort the GTS by respectively by tick, value, location and elevation.
|
static GTSEncoder |
fullsort(GTSEncoder encoder,
boolean reversed) |
static GTSEncoder |
fullsort(GTSEncoder encoder,
boolean reversed,
long baseTimestamp)
Sort an encoder
|
static GeoTimeSerie |
fuse(java.util.Collection<GeoTimeSerie> chunks) |
static boolean |
geointersects(com.geoxp.GeoXPLib.GeoXPShape shape,
GeoTimeSerie gts) |
static boolean |
geowithin(com.geoxp.GeoXPLib.GeoXPShape shape,
GeoTimeSerie gts) |
static int |
getBucketCount(GeoTimeSerie gts) |
static long |
getBucketSpan(GeoTimeSerie gts) |
static long[] |
getElevations(GeoTimeSerie gts)
Return an array with a copy of the locations of the given GTS.
|
static int[] |
getFirstLastTicks(long[] ticks) |
static long |
getLastBucket(GeoTimeSerie gts) |
static java.lang.Object |
getLastValue(GeoTimeSerie gts)
Return the value of the most recent tick in this GTS.
|
static long[] |
getLocations(GeoTimeSerie gts)
Return an array with a copy of the locations of the given GTS.
|
static long[] |
getOriginalElevations(GeoTimeSerie gts) |
static long[] |
getOriginalLocations(GeoTimeSerie gts) |
static long[] |
getTicks(GeoTimeSerie gts)
Return an array with a copy of the ticks of the given GTS.
|
static double[] |
getValuesAsDouble(GeoTimeSerie gts)
Return an array with a copy of the GTS values as doubles
|
static GeoTimeSerie.TYPE |
getValueType(java.lang.Object value) |
static long |
gtsId(long[] key,
long classId,
long labelsId)
Compute a gts Id from given classId/labelsId.
|
static java.lang.String |
gtsIdToString(long classId,
long labelsId) |
static java.lang.String |
gtsIdToString(long classId,
long labelsId,
boolean intern) |
static java.lang.Object |
highest(GeoTimeSerie gts)
Handy method to compute the maximum elevation of a GTS instance.
|
static int |
indexAtTick(GeoTimeSerie gts,
long tick) |
static GeoTimeSerie |
integrate(GeoTimeSerie gts,
double initialValue)
'Integrate' a GTS, considering the value at each tick is a rate of change per second.
|
static void |
internalizeStrings(Metadata meta)
Transform a Metadata instance by 'intern'ing all of its strings.
|
static boolean |
isBucketized(GeoTimeSerie gts) |
static boolean |
isNormal(GeoTimeSerie gts,
int buckets,
double pcterror,
boolean bessel)
Determine if a GTS' values are normally distributed.
|
static GeoTimeSerie |
isonormalize(GeoTimeSerie gts)
Normalize a GTS, replacing X by (X-MEAN)/(MAX-MIN) or 1.0
|
static boolean |
isReversed(GeoTimeSerie gts)
Tell if a GTS instance is considered reversed.
|
static boolean |
isSorted(GeoTimeSerie gts)
Tell if a GTS instance is considered sorted.
|
static double |
kurtosis(GeoTimeSerie gts,
boolean bessel) |
static long |
labelsId_slow(byte[] key,
java.util.Map<java.lang.String,java.lang.String> labels) |
static long |
labelsId(byte[] key,
GeoTimeSerie gts)
Compute the labels Id of a GeoTimeSerie instance.
|
static long |
labelsId(byte[] key,
java.util.Map<java.lang.String,java.lang.String> labels)
Compute a labels Id (unique hash of labels) using SipHash and the given key.
|
static long |
labelsId(long[] sipkey,
java.util.Map<java.lang.String,java.lang.String> labels) |
static long |
labelsId(long sipkey0,
long sipkey1,
java.util.Map<java.lang.String,java.lang.String> labels) |
static void |
labelsToString(java.lang.StringBuilder sb,
java.util.Map<java.lang.String,java.lang.String> labels,
boolean expose) |
static long |
lasttick(GeoTimeSerie gts)
Return the last tick in the GTS instance.
|
static long |
locationAtIndex(GeoTimeSerie gts,
int idx)
Return the location in a GeoTimeSerie at a given index.
|
static long |
locationAtTick(GeoTimeSerie gts,
long tick)
Return the location in a Geo Time Serie at a given timestamp.
|
static GeoTimeSerie |
locationSort(GeoTimeSerie gts) |
static long[] |
longValues(GeoTimeSerie gts) |
static void |
lowess_stl(GeoTimeSerie fromGTS,
GeoTimeSerie toGTS,
int neighbours,
int degree,
int jump,
double[] weights,
double[] rho)
Version of LOWESS used in stl
|
static java.lang.Object |
lowest(GeoTimeSerie gts)
Handy method to compute the minimum elevation of a GTS instance.
|
static GeoTimeSerie |
lttb(GeoTimeSerie gts,
int threshold,
boolean timebased) |
static java.util.List<GeoTimeSerie> |
map(GeoTimeSerie gts,
java.lang.Object mapper,
long prewindow,
long postwindow,
long occurrences,
boolean reversed,
int step,
boolean overrideTick,
WarpScriptStack stack) |
static java.util.List<GeoTimeSerie> |
map(GeoTimeSerie gts,
java.lang.Object mapper,
long prewindow,
long postwindow,
long occurrences,
boolean reversed,
int step,
boolean overrideTick,
WarpScriptStack stack,
java.util.List<java.lang.Long> outputTicks) |
static java.util.List<GeoTimeSerie> |
map(GeoTimeSerie gts,
java.lang.Object mapper,
long prewindow,
long postwindow,
long occurrences,
boolean reversed,
int step,
boolean overrideTick,
WarpScriptStack stack,
java.util.List<java.lang.Long> outputTicks,
boolean dedup)
Apply a mapper on a GeoTimeSerie instance and produce a new
GTS instance with the result of the mapper application.
|
static java.util.List<GeoTimeSerie> |
map(GeoTimeSerie gts,
WarpScriptMapperFunction mapper,
long prewindow,
long postwindow) |
static java.util.List<GeoTimeSerie> |
map(GeoTimeSerie gts,
WarpScriptMapperFunction mapper,
long prewindow,
long postwindow,
long occurrences,
boolean reversed) |
static java.util.List<GeoTimeSerie> |
map(GeoTimeSerie gts,
WarpScriptMapperFunction mapper,
long prewindow,
long postwindow,
long occurrences,
boolean reversed,
int step,
boolean overrideTick) |
static java.lang.Object |
max(GeoTimeSerie gts)
Handy method to compute the max value of a GTS instance.
|
static GeoTimeSerie |
merge(GeoTimeSerie base,
GeoTimeSerie gts)
Merge 'gts' into 'base'.
|
static GeoTimeSerie |
mergeViaEncoders(java.util.List<GeoTimeSerie> series)
Merge GeoTimeSerie instances using GTSEncoders.
|
static void |
metadataToString(java.lang.StringBuilder sb,
java.lang.String name,
java.util.Map<java.lang.String,java.lang.String> labels,
boolean expose) |
static java.lang.Object |
min(GeoTimeSerie gts)
Handy method to compute the min value of a GTS instance.
|
static void |
multiProvision(GeoTimeSerie gts,
GeoTimeSerie.TYPE fallbackType,
int numberOfValuesToAdd,
int provisionSize)
Provision GTS arrays for several values.
|
static double[] |
musigma(GeoTimeSerie gts,
boolean bessel) |
static GeoTimeSerie |
normalize(GeoTimeSerie gts)
Normalize a GTS, replacing X by (X-MIN)/(MAX-MIN) or 1.0
|
static int |
nticks(GeoTimeSerie gts)
Return the number of ticks in a GTS instance.
|
static int |
nvalues(GeoTimeSerie gts)
Return the number of values in a GTS instance.
|
static GeoTimeSerie |
onlybuckets(GeoTimeSerie gts)
Removes non-bucket points of a bucketized GTS
|
static GTSEncoder |
parse_regexp(GTSEncoder encoder,
java.lang.String str,
java.util.Map<java.lang.String,java.lang.String> extraLabels)
Parses a string representation of a measurement and return a single valued GTS
|
static GTSEncoder |
parse(GTSEncoder encoder,
java.lang.String str) |
static GTSEncoder |
parse(GTSEncoder encoder,
java.lang.String str,
java.util.Map<java.lang.String,java.lang.String> extraLabels,
java.lang.Long now) |
static GTSEncoder |
parse(GTSEncoder encoder,
java.lang.String str,
java.util.Map<java.lang.String,java.lang.String> extraLabels,
java.lang.Long now,
long maxValueSize) |
static GTSEncoder |
parse(GTSEncoder encoder,
java.lang.String str,
java.util.Map<java.lang.String,java.lang.String> extraLabels,
java.lang.Long now,
long maxValueSize,
java.util.concurrent.atomic.AtomicBoolean parsedAttributes) |
static GTSEncoder |
parse(GTSEncoder encoder,
java.lang.String str,
java.util.Map<java.lang.String,java.lang.String> extraLabels,
java.lang.Long now,
long maxValueSize,
java.util.concurrent.atomic.AtomicBoolean parsedAttributes,
java.lang.Long maxpast,
java.lang.Long maxfuture,
java.util.concurrent.atomic.AtomicLong ignoredCount,
boolean deltaAttributes) |
static GTSEncoder |
parse(GTSEncoder encoder,
java.lang.String str,
java.util.Map<java.lang.String,java.lang.String> extraLabels,
java.lang.Long now,
long maxValueSize,
java.util.concurrent.atomic.AtomicBoolean parsedAttributes,
java.lang.Long maxpast,
java.lang.Long maxfuture,
java.util.concurrent.atomic.AtomicLong ignoredCount,
boolean deltaAttributes,
long timeshift) |
static GTSEncoder |
parseJSON(GTSEncoder encoder,
java.lang.String str,
java.util.Map<java.lang.String,java.lang.String> extraLabels,
java.lang.Long now) |
static java.util.Map<java.lang.String,java.lang.String> |
parseLabels(int initialCapacity,
java.lang.String str)
Parses the string representation of labels.
|
static java.util.Map<java.lang.String,java.lang.String> |
parseLabels(java.lang.String str) |
static java.util.LinkedHashMap<java.lang.String,java.lang.String> |
parseLabelsSelectors(java.lang.String selectors)
Parse labels selectors and return a map of label name to selector.
|
static java.lang.Object |
parseValue_regexp(java.lang.String valuestr) |
static java.lang.Object |
parseValue(java.lang.String valuestr) |
static java.util.Map<java.util.Map<java.lang.String,java.lang.String>,java.util.List<GeoTimeSerie>> |
partition(java.util.Collection<GeoTimeSerie> series,
java.util.Collection<java.lang.String> bylabels)
Partition a collection of Geo Time Serie instances into equivalence classes.
|
static java.util.List<GeoTimeSerie> |
partitionAndApply(java.lang.Object function,
WarpScriptStack stack,
WarpScriptStack.Macro validator,
java.util.Collection<java.lang.String> bylabels,
java.util.List<GeoTimeSerie>... series)
Apply a function (either a filter or n-ary op) onto collections of GTS instances.
|
static java.util.Map<java.util.Map<java.lang.String,java.lang.String>,java.util.List<GeoTimeSerie>> |
partitionAndApplyUnflattened(java.lang.Object function,
WarpScriptStack stack,
WarpScriptStack.Macro validator,
java.util.Collection<java.lang.String> bylabels,
java.util.List<GeoTimeSerie>... series)
Apply a function or filter GTS and keep the results ventilated per equivalence class
This function has the side effect of unsetting classId/labelsId
|
static java.util.Map<java.lang.String,java.util.regex.Pattern> |
patternsFromSelectors(java.lang.String classLabelsSelectionString)
Return patterns for matching class and labels
The class selector is associated with the 'null' key.
|
static double |
pointwise_lowess(GeoTimeSerie gts,
int idx,
long tick,
int q,
int p,
double[] weights,
double[] rho,
double[] beta) |
static double |
pointwise_lowess(GeoTimeSerie gts,
int idx,
long tick,
int q,
int p,
double[] weights,
double[] rho,
double[] beta,
boolean reversed)
Compute local weighted regression at given tick
|
static GeoTimeSerie |
prob(GeoTimeSerie gts)
Convert a GTS into a GTS of the probability associated with the value present at each tick.
|
static GeoTimeSerie |
quantize(GeoTimeSerie gts,
double[] bounds,
java.lang.Object[] values) |
static java.util.List<GeoTimeSerie> |
reduce(WarpScriptReducerFunction reducer,
java.util.Collection<GeoTimeSerie> series,
java.util.Collection<java.lang.String> bylabels) |
static java.util.List<GeoTimeSerie> |
reduce(WarpScriptReducerFunction reducer,
java.util.Collection<GeoTimeSerie> series,
java.util.Collection<java.lang.String> bylabels,
boolean overrideTick) |
static java.util.Map<java.util.Map<java.lang.String,java.lang.String>,java.util.List<GeoTimeSerie>> |
reduceUnflattened(WarpScriptReducerFunction reducer,
java.util.Collection<GeoTimeSerie> series,
java.util.Collection<java.lang.String> bylabels) |
static java.util.Map<java.util.Map<java.lang.String,java.lang.String>,java.util.List<GeoTimeSerie>> |
reduceUnflattened(WarpScriptReducerFunction reducer,
java.util.Collection<GeoTimeSerie> series,
java.util.Collection<java.lang.String> bylabels,
boolean overrideTick) |
static GeoTimeSerie |
relabel(GeoTimeSerie gts,
java.util.Map<java.lang.String,java.lang.String> newlabels)
Modify the labels of a GTS instance.
|
static GTSEncoder |
relabel(GTSEncoder encoder,
java.util.Map<java.lang.String,java.lang.String> newlabels) |
static void |
removeValue(GeoTimeSerie gts,
long timestamp,
boolean all)
Remove a datapoint from a GTS.
|
static GeoTimeSerie |
rename(GeoTimeSerie gts,
java.lang.String name)
Rename the given Geo Time Serie instance.
|
static void |
reset(GeoTimeSerie gts) |
static GeoTimeSerie |
rlowess(GeoTimeSerie gts,
int q,
int r,
long d,
int p) |
static GeoTimeSerie |
rlowess(GeoTimeSerie gts,
int q,
int r,
long d,
int p,
double[] weights,
double[] rho,
boolean inplace)
Compute fast and robust version of LOWESS on a Geo Time Series,
with a polynomial fit of degree p > 0.
|
static void |
setBucketCount(GeoTimeSerie gts,
int bucketcount) |
static void |
setBucketSpan(GeoTimeSerie gts,
long bucketspan) |
static void |
setElevationAtIndex(GeoTimeSerie gts,
int idx,
long elevation)
Set the elevation at a specific index in the GTS
|
static void |
setLastBucket(GeoTimeSerie gts,
long lastbucket) |
static void |
setLocationAtIndex(GeoTimeSerie gts,
int idx,
long location)
Set the location at a specific index in the GTS
|
static int |
setValue(GeoTimeSerie gts,
long timestamp,
long geoxppoint,
long elevation,
java.lang.Object value,
boolean overwrite)
Add a measurement at the given timestamp/location/elevation
FIXME(hbs): If performance is bad due to autoboxing, we can always split addValue by type
and have 4 methods instead of 1.
|
static int |
setValue(GeoTimeSerie gts,
long timestamp,
long geoxppoint,
java.lang.Object value) |
static int |
setValue(GeoTimeSerie gts,
long timestamp,
java.lang.Object value) |
static void |
shrink(GeoTimeSerie gts)
Shrink the internal arrays of this GTS so their length matches
the number of values.
|
static void |
shrink(GeoTimeSerie gts,
double ratio) |
static GeoTimeSerie |
shrinkTo(GeoTimeSerie gts,
int newsize)
Reduce the number of values in a GTS.
|
static GTSEncoder |
shrinkTo(GTSEncoder encoder,
int newsize)
Shrink an encoder to at most a given number of values.
|
static GeoTimeSerie |
singleExponentialSmoothing(GeoTimeSerie gts,
double alpha)
Perform exponential smoothing on a numeric GTS.
|
static double |
skewness(GeoTimeSerie gts,
boolean bessel) |
static GeoTimeSerie |
slowmerge(GeoTimeSerie base,
GeoTimeSerie gts,
boolean overwrite)
Merge 'gts' into 'base' the slow way, i.e.
|
static GeoTimeSerie |
sort(GeoTimeSerie gts)
Sort the values (and associated locations/elevations) by order of ascending ticks.
|
static GeoTimeSerie |
sort(GeoTimeSerie gts,
boolean reversed)
Sort the values (and associated locations/elevations) by order of their ticks
|
static GeoTimeSerie |
sortedMerge(GeoTimeSerie base,
GeoTimeSerie gts)
Merge 2 GTSs into one sorted GTS, with values from gts overwriting values from base.
|
static GTSEncoder |
sortedMerge(java.util.List<java.lang.Object> params,
boolean reversed)
Merge sorted GTS or encoders
|
static int[] |
sortIndices(long[] values,
boolean reversed)
Return an array of indices sorted in the order of the matching value in the 'values' array.
|
static GeoTimeSerie |
standardize(GeoTimeSerie gts)
Standardize a numeric GeoTimeSerie
|
static GeoTimeSerie |
standardize(GeoTimeSerie gts,
double mean,
double sd) |
static double |
standardizedMoment(int moment,
GeoTimeSerie gts,
boolean bessel) |
static java.util.List<GeoTimeSerie> |
stl(GeoTimeSerie gts,
int buckets_per_period,
int inner,
int outer,
int neighbour_s,
int degree_s,
int jump_s,
int neighbour_l,
int degree_l,
int jump_l,
int neighbour_t,
int degree_t,
int jump_t,
int neighbour_p,
int degree_p,
int jump_p)
Compute STL i.e.
|
static long[] |
stringToGTSId(java.lang.String s) |
static java.lang.String[] |
stringValues(GeoTimeSerie gts) |
static GeoTimeSerie |
subCycleSerie(GeoTimeSerie gts,
long lastbucket,
int buckets_per_period,
boolean overwrite) |
static GeoTimeSerie |
subCycleSerie(GeoTimeSerie gts,
long lastbucket,
int buckets_per_period,
boolean overwrite,
GeoTimeSerie subgts)
Return a new GeoTimeSerie instance containing only the values of 'gts'
that fall under timestamps that are bound by the same modulo class.
|
static GeoTimeSerie |
subSerie(GeoTimeSerie gts,
long starttimestamp,
long stoptimestamp,
boolean overwrite) |
static GeoTimeSerie |
subSerie(GeoTimeSerie gts,
long starttimestamp,
long stoptimestamp,
boolean overwrite,
boolean copyLabels,
GeoTimeSerie subgts)
Return a new GeoTimeSerie instance containing only the value of 'gts'
which fall between 'starttimestamp' (inclusive) and 'stoptimestamp' (inclusive)
The resulting GTS instance will be sorted.
|
static long |
tickAtIndex(GeoTimeSerie gts,
int idx)
Return the tick at a given index in a GeoTimeSerie.
|
static GeoTimeSerie |
tickindex(GeoTimeSerie gts)
Produces a GTS instance similar to the original one except
that its ticks will have been modified to reflect their index
int the sequence, starting at 0.
|
static GTSEncoder |
tickindex(GTSEncoder encoder) |
static java.util.Iterator<java.lang.Long> |
tickIterator(GeoTimeSerie gts,
boolean reversed)
Return an iterator on the GeoTimeSerie ticks.
|
static java.util.List<java.lang.Long> |
tickList(GeoTimeSerie gts)
Return a list with the ticks in a GeoTimeSerie.
|
static java.lang.String |
tickToString(long timestamp,
long location,
long elevation,
java.lang.Object value) |
static java.lang.String |
tickToString(java.lang.StringBuilder clslbls,
long timestamp,
long location,
long elevation,
java.lang.Object value)
Return a string representation of a GTS measurement at 'tick'
|
static GeoTimeSerie |
timeclip(GeoTimeSerie gts,
long start,
long end)
Return a GTS which is a subset of the input GTS with only those ticks which
fall between start and end (both inclusive).
|
static GTSEncoder |
timeclip(GTSEncoder encoder,
long start,
long end)
Clip a GTSEncoder
|
static GeoTimeSerie |
timescale(GeoTimeSerie gts,
double scale)
Multiply the ticks of a GTS instance by a factor.
|
static GeoTimeSerie |
timeshift(GeoTimeSerie gts,
long delta)
Shifts a GTS instance by the given time delta.
|
static java.util.List<GeoTimeSerie> |
timesplit(GeoTimeSerie gts,
long quietperiod,
int minvalues,
java.lang.String labelname)
Split a GTS into multiple GTS by cutting in 'quiet zones', i.e.
|
static void |
unbucketize(GeoTimeSerie gts) |
static byte[] |
unpackGTSId(java.math.BigInteger bi)
Convert a GTS Id packed as a BigInteger into an array of bytes
containing classId/labelsId in big endian representation
|
static byte[] |
unpackGTSId(java.lang.String s) |
static long[] |
unpackGTSIdLongs(java.lang.String s) |
static java.lang.Object |
valueAtIndex(GeoTimeSerie gts,
int idx)
Return the value in a GTS instance at a given index.
|
static java.lang.Object |
valueAtTick(GeoTimeSerie gts,
long tick)
Return the value in a Geo Time Serie at a given timestamp.
|
static java.util.Map<java.lang.Object,java.lang.Long> |
valueHistogram(GeoTimeSerie gts)
Build an occurrence count by value for the given time serie.
|
static java.util.Map<java.lang.Object,java.lang.Long> |
valueHistogram(GTSEncoder encoder)
Build an occurrence count by value for the given GTS Encoder.
|
static java.util.Iterator<java.lang.String> |
valueRepresentationIterator(GeoTimeSerie gts) |
static GeoTimeSerie |
valueSort(GeoTimeSerie gts) |
static GeoTimeSerie |
valueSort(GeoTimeSerie gts,
boolean reversed) |
public static final GeoTimeSerie sort(GeoTimeSerie gts, boolean reversed)
gts - The GeoTimeSerie instance to sortreversed - If true, the ticks will be sorted from most recent to leastpublic static final GeoTimeSerie sort(GeoTimeSerie gts)
gts - GeoTimeSerie instance to sortpublic static final GeoTimeSerie fullsort(GeoTimeSerie gts)
gts - The GTS instance to be sorted.public static final GeoTimeSerie fullsort(GeoTimeSerie gts, boolean reversed)
gts - The GTS instance to be sorted.reversed - Whether to reverse the order of the returned list.public static GTSEncoder fullsort(GTSEncoder encoder, boolean reversed) throws java.io.IOException
java.io.IOExceptionpublic static GTSEncoder fullsort(GTSEncoder encoder, boolean reversed, long baseTimestamp) throws java.io.IOException
java.io.IOExceptionpublic static final int binarySearchTick(GeoTimeSerie gts, long timestamp, GTSHelper.BinarySearchTickChoice tickChoice)
public static final int binarySearchTick(GeoTimeSerie gts, int fromIndex, int toIndex, long timestamp, GTSHelper.BinarySearchTickChoice tickChoice)
gts - The GTS in which the timestamp is searchedtimestamp - The searched timestamppublic static final GeoTimeSerie valueSort(GeoTimeSerie gts, boolean reversed)
public static final GeoTimeSerie valueSort(GeoTimeSerie gts)
public static final java.util.Iterator<java.lang.Long> tickIterator(GeoTimeSerie gts, boolean reversed)
gts - GeoTimeSerie instance for which to return an iteratorreversed - If true, ticks will be returned from most recent to oldestpublic static java.util.List<GeoTimeSerie> booleanGTSSplit(GeoTimeSerie gts, boolean shrink)
public static GeoTimeSerie locationSort(GeoTimeSerie gts)
public static int compareAllAtTick(GeoTimeSerie gts, int index1, int index2)
gts - The GTS to get the data form.index1 - The first index to get the data at in the GTS.index2 - The second index to get the data at in the GTS.public static long tickAtIndex(GeoTimeSerie gts, int idx)
gts - GeoTimeSerie instance to get the tick from.idx - Index of the tick.public static java.util.List<java.lang.Long> tickList(GeoTimeSerie gts)
public static int indexAtTick(GeoTimeSerie gts, long tick)
public static java.lang.Object valueAtTick(GeoTimeSerie gts, long tick)
gts - GeoTimeSerie instance from which to extract valuetick - Timestamp at which to read the valuepublic static java.lang.Object valueAtIndex(GeoTimeSerie gts, int idx)
gts - GeoTimeSerie instance from which to extract the value.idx - Index at which to read the value.public static long locationAtTick(GeoTimeSerie gts, long tick)
gts - GeoTimeSerie instance from which to extract locationtick - Timestamp at which to read the locationpublic static long locationAtIndex(GeoTimeSerie gts, int idx)
gts - GeoTimeSerie instance from which to extract the location.idx - Index at which to read the location.public static void setLocationAtIndex(GeoTimeSerie gts, int idx, long location)
gts - GeoTimeSerie instance to be modified.idx - Index at which to write the location.location - Location as HHCode to write.public static long elevationAtTick(GeoTimeSerie gts, long tick)
gts - GeoTimeSerie instance from which to extract elevationtick - Timestamp at which to read the elevationpublic static void setElevationAtIndex(GeoTimeSerie gts, int idx, long elevation)
gts - GeoTimeSerie instance to be modified.idx - Index at which to write the elevation.elevation - Elevation to write.public static long elevationAtIndex(GeoTimeSerie gts, int idx)
gts - GeoTimeSerie instance from which to extract elevation.idx - Index at which to read the elevationpublic static void removeValue(GeoTimeSerie gts, long timestamp, boolean all)
gts - The GTS to altertimestamp - The timestamp at which to remove the valueall - Boolean indicating whether or not we should remove all occurrences or simply the first one foundpublic static final int setValue(GeoTimeSerie gts, long timestamp, long geoxppoint, long elevation, java.lang.Object value, boolean overwrite)
gts - GeoTimeSerie instance to which the measurement must be addedtimestamp - Timestamp in microseconds of the measurementgeoxppoint - Location of measurement as a GeoXPPointelevation - Elevation of measurement in millimetersvalue - Value of measurementoverwrite - Flag indicating whether or not to overwrite a previous measurement done at the same timestamppublic static final int setValue(GeoTimeSerie gts, long timestamp, long geoxppoint, java.lang.Object value)
public static final int setValue(GeoTimeSerie gts, long timestamp, java.lang.Object value)
public static final void multiProvision(GeoTimeSerie gts, GeoTimeSerie.TYPE fallbackType, int numberOfValuesToAdd, int provisionSize)
gts - The GTS instance to provision space for.numberOfValuesToAdd - Minimum available space in arrays for new data.provisionSize - Array length increase in case arrays are too small.public static final GeoTimeSerie subSerie(GeoTimeSerie gts, long starttimestamp, long stoptimestamp, boolean overwrite, boolean copyLabels, GeoTimeSerie subgts)
gts - GeoTimeSerie from which to extract values.starttimestamp - Oldest timestamp to consider (in microseconds)stoptimestamp - Most recent timestamp to consider (in microseconds)overwrite - Should we overwrite measurements which occur at the same timestamp to only keep the last one added.copyLabels - If true, labels will be copied from the original GTS to the subserie.public static final GeoTimeSerie subSerie(GeoTimeSerie gts, long starttimestamp, long stoptimestamp, boolean overwrite)
public static final GeoTimeSerie subCycleSerie(GeoTimeSerie gts, long lastbucket, int buckets_per_period, boolean overwrite, GeoTimeSerie subgts) throws WarpScriptException
gts - GeoTimeSerie from which to extract values. It must be bucketized.lastbucket - Most recent timestamp to consider (in microseconds)buckets_per_period - Number of buckets of the input gts that sum up to a bucket for the sub cycle gtsoverwrite - Should we overwrite measurements which occur at the same timestamp to only keep the last one added.WarpScriptExceptionpublic static final GeoTimeSerie subCycleSerie(GeoTimeSerie gts, long lastbucket, int buckets_per_period, boolean overwrite) throws WarpScriptException
WarpScriptExceptionpublic static final GeoTimeSerie bucketize(GeoTimeSerie gts, long bucketspan, int bucketcount, long lastbucket, WarpScriptBucketizerFunction aggregator, long maxbuckets) throws WarpScriptException
gts - Geo Time Serie to bucketizebucketspan - Width of bucket (time interval) in microsecondsbucketcount - Number of buckets to uselastbucket - Timestamp of the end of the last bucket of the resulting GTS. If 0, 'lastbucket' will be set to the last timestamp of 'gts'.aggregator - Function used to aggregate values/locations/elevationsWarpScriptExceptionpublic static final GeoTimeSerie bucketize(GeoTimeSerie gts, long bucketspan, int bucketcount, long lastbucket, java.lang.Object aggregator, long maxbuckets, WarpScriptStack stack) throws WarpScriptException
WarpScriptExceptionpublic static void unbucketize(GeoTimeSerie gts)
public static GTSEncoder parse_regexp(GTSEncoder encoder, java.lang.String str, java.util.Map<java.lang.String,java.lang.String> extraLabels) throws java.text.ParseException, java.io.IOException
str - String representation to parsejava.text.ParseException - if a parsing error occurredjava.io.IOExceptionpublic static GTSEncoder parseJSON(GTSEncoder encoder, java.lang.String str, java.util.Map<java.lang.String,java.lang.String> extraLabels, java.lang.Long now) throws java.io.IOException, java.text.ParseException
java.io.IOExceptionjava.text.ParseExceptionpublic static GTSEncoder parse(GTSEncoder encoder, java.lang.String str, java.util.Map<java.lang.String,java.lang.String> extraLabels, java.lang.Long now) throws java.text.ParseException, java.io.IOException
java.text.ParseExceptionjava.io.IOExceptionpublic static GTSEncoder parse(GTSEncoder encoder, java.lang.String str, java.util.Map<java.lang.String,java.lang.String> extraLabels, java.lang.Long now, long maxValueSize) throws java.text.ParseException, java.io.IOException
java.text.ParseExceptionjava.io.IOExceptionpublic static GTSEncoder parse(GTSEncoder encoder, java.lang.String str, java.util.Map<java.lang.String,java.lang.String> extraLabels, java.lang.Long now, long maxValueSize, java.util.concurrent.atomic.AtomicBoolean parsedAttributes) throws java.text.ParseException, java.io.IOException
java.text.ParseExceptionjava.io.IOExceptionpublic static GTSEncoder parse(GTSEncoder encoder, java.lang.String str, java.util.Map<java.lang.String,java.lang.String> extraLabels, java.lang.Long now, long maxValueSize, java.util.concurrent.atomic.AtomicBoolean parsedAttributes, java.lang.Long maxpast, java.lang.Long maxfuture, java.util.concurrent.atomic.AtomicLong ignoredCount, boolean deltaAttributes) throws java.text.ParseException, java.io.IOException
java.text.ParseExceptionjava.io.IOExceptionpublic static GTSEncoder parse(GTSEncoder encoder, java.lang.String str, java.util.Map<java.lang.String,java.lang.String> extraLabels, java.lang.Long now, long maxValueSize, java.util.concurrent.atomic.AtomicBoolean parsedAttributes, java.lang.Long maxpast, java.lang.Long maxfuture, java.util.concurrent.atomic.AtomicLong ignoredCount, boolean deltaAttributes, long timeshift) throws java.text.ParseException, java.io.IOException
java.text.ParseExceptionjava.io.IOExceptionpublic static GTSEncoder parse(GTSEncoder encoder, java.lang.String str) throws java.text.ParseException, java.io.IOException
java.text.ParseExceptionjava.io.IOExceptionpublic static java.lang.Object parseValue(java.lang.String valuestr)
throws java.text.ParseException
java.text.ParseExceptionpublic static java.lang.Object parseValue_regexp(java.lang.String valuestr)
throws java.text.ParseException
java.text.ParseExceptionpublic static java.util.Map<java.lang.String,java.lang.String> parseLabels(int initialCapacity,
java.lang.String str)
throws java.text.ParseException
java.text.ParseException - if a label name is incorrect.public static java.util.Map<java.lang.String,java.lang.String> parseLabels(java.lang.String str)
throws java.text.ParseException
java.text.ParseExceptionpublic static final long classId(byte[] key,
java.lang.String name)
key - 128 bits SipHash key to usename - Name of metric to hashpublic static final long classId(long[] key,
java.lang.String name)
public static final long classId(long k0,
long k1,
java.lang.String name)
public static final long gtsId(long[] key,
long classId,
long labelsId)
public static final long classId(byte[] key,
GeoTimeSerie gts)
key - 128 bits SipHash key to usegts - GeoTimeSerie instance for which to compute the classIdpublic static final long labelsId(byte[] key,
java.util.Map<java.lang.String,java.lang.String> labels)
key - 128 bit SipHash key to uselabels - Map of label names to label valuespublic static final long labelsId(long[] sipkey,
java.util.Map<java.lang.String,java.lang.String> labels)
public static final long labelsId(long sipkey0,
long sipkey1,
java.util.Map<java.lang.String,java.lang.String> labels)
public static final long labelsId_slow(byte[] key,
java.util.Map<java.lang.String,java.lang.String> labels)
public static final long labelsId(byte[] key,
GeoTimeSerie gts)
key - 128 bits SipHash key to usegts - GeoTimeSerie instance for which to compute the labels Idpublic static byte[] unpackGTSId(java.math.BigInteger bi)
bi - Packed GTS ID.public static byte[] unpackGTSId(java.lang.String s)
public static long[] unpackGTSIdLongs(java.lang.String s)
public static java.lang.String gtsIdToString(long classId,
long labelsId)
public static java.lang.String gtsIdToString(long classId,
long labelsId,
boolean intern)
public static long[] stringToGTSId(java.lang.String s)
public static void fillGTSIds(byte[] bytes,
int offset,
long classId,
long labelsId)
public static final java.util.LinkedHashMap<java.lang.String,java.lang.String> parseLabelsSelectors(java.lang.String selectors)
throws java.text.ParseException
selectors - Selectors following the syntax NAME<TYPE>VALUE,NAME<TYPE>VALUE,... to be parsed.java.text.ParseExceptionpublic static java.util.Map<java.lang.String,java.util.regex.Pattern> patternsFromSelectors(java.lang.String classLabelsSelectionString)
throws java.text.ParseException
classLabelsSelectionString - A string representation of a class/labels selectorjava.text.ParseException - when classLabelsSelectionString is not representing a selector.public static java.util.Iterator<java.lang.String> valueRepresentationIterator(GeoTimeSerie gts)
public static java.lang.String tickToString(java.lang.StringBuilder clslbls,
long timestamp,
long location,
long elevation,
java.lang.Object value)
public static java.lang.String tickToString(long timestamp,
long location,
long elevation,
java.lang.Object value)
public static void encodeValue(java.lang.StringBuilder sb,
java.lang.Object value)
public static void encodeName(java.lang.StringBuilder sb,
java.lang.String name)
public static GeoTimeSerie slowmerge(GeoTimeSerie base, GeoTimeSerie gts, boolean overwrite)
base - GTS instance into which other values should be mergedgts - GTS instance whose values/locations/elevations should be merged.overwrite - Flag indicating whether or not to overwrite existing value at identical timestamppublic static GeoTimeSerie merge(GeoTimeSerie base, GeoTimeSerie gts)
base - GTS instance into which other values should be mergedgts - GTS instance whose values/locations/elevations should be merged.public static GeoTimeSerie mergeViaEncoders(java.util.List<GeoTimeSerie> series) throws java.io.IOException
series - List of series to merge, the first one will be considered the base. Its metadata will be used.java.io.IOExceptionpublic static GeoTimeSerie sortedMerge(GeoTimeSerie base, GeoTimeSerie gts)
base - The GTS used as a referencegts - The GTS whose data is to be merged with that of base.java.lang.RuntimeException - when GTSs are not of the same type and base is not empty.public static GTSEncoder sortedMerge(java.util.List<java.lang.Object> params, boolean reversed) throws WarpScriptException
WarpScriptExceptionpublic static GeoTimeSerie fillprevious(GeoTimeSerie gts)
gts - GeoTimeSerie to fillpublic static GeoTimeSerie fillnext(GeoTimeSerie gts)
gts - GeoTimeSerie to fillpublic static GeoTimeSerie fillvalue(GeoTimeSerie gts, long location, long elevation, java.lang.Object value)
gts - GeoTimeSerie to filllocation - Location to use for fillingelevation - Elevation to use for fillingvalue - Value to use for filling 'gts'public static GeoTimeSerie fillticks(GeoTimeSerie gts, long location, long elevation, java.lang.Object value, long[] ticks)
gts - GeoTimeSerie instance to had its values filled.location - Location data to use for the filling.elevation - Elevation data to use for the filling.value - Value data to use for the filling.ticks - Ticks to be filled.public static final java.util.List<GeoTimeSerie> fill(GeoTimeSerie gtsa, GeoTimeSerie gtsb, WarpScriptFillerFunction filler) throws WarpScriptException
gtsa - First GTS to fillgtsb - Second GTS to fillfiller - Instance of filler to use for filling the gaps.WarpScriptExceptionpublic static GeoTimeSerie compensateResets(GeoTimeSerie gts, boolean resethigher)
gts - GTS instance to compensate resets forresethigher - If true, indicates that resets will have higher values than counter value (i.e. counter decreases)public static boolean isBucketized(GeoTimeSerie gts)
public static java.util.List<GeoTimeSerie> timesplit(GeoTimeSerie gts, long quietperiod, int minvalues, java.lang.String labelname)
gts - GTS instance to splitquietperiod - Minimum number of microseconds without values to consider a split. The previous value must be at least 'quietperiod' us ago.minvalues - Only produce GTS with more than 'minvalues' values, this is to ignore lone valueslabelname - Name to use for a label containing the GTS sequence (oldest GTS is 1, next is 2, ....). 'label' MUST NOT exist among the labels of 'gts'.public static GeoTimeSerie crop(GeoTimeSerie gts)
gts - GTS instance to crop.public static GeoTimeSerie timeshift(GeoTimeSerie gts, long delta)
gts - GTS instance to shiftdelta - Number of microsecondes to shift ticks by.public static GeoTimeSerie tickindex(GeoTimeSerie gts)
public static GTSEncoder tickindex(GTSEncoder encoder) throws java.io.IOException
java.io.IOExceptionpublic static void clear(GeoTimeSerie gts)
gts - GTS instance to clear.public static void reset(GeoTimeSerie gts)
public static java.util.List<GeoTimeSerie> map(GeoTimeSerie gts, WarpScriptMapperFunction mapper, long prewindow, long postwindow, long occurrences, boolean reversed, int step, boolean overrideTick) throws WarpScriptException
WarpScriptExceptionpublic static java.util.List<GeoTimeSerie> map(GeoTimeSerie gts, java.lang.Object mapper, long prewindow, long postwindow, long occurrences, boolean reversed, int step, boolean overrideTick, WarpScriptStack stack) throws WarpScriptException
WarpScriptExceptionpublic static java.util.List<GeoTimeSerie> map(GeoTimeSerie gts, java.lang.Object mapper, long prewindow, long postwindow, long occurrences, boolean reversed, int step, boolean overrideTick, WarpScriptStack stack, java.util.List<java.lang.Long> outputTicks) throws WarpScriptException
WarpScriptExceptionpublic static java.util.List<GeoTimeSerie> map(GeoTimeSerie gts, java.lang.Object mapper, long prewindow, long postwindow, long occurrences, boolean reversed, int step, boolean overrideTick, WarpScriptStack stack, java.util.List<java.lang.Long> outputTicks, boolean dedup) throws WarpScriptException
gts - GTS instance to apply the mapper onmapper - Mapper Function to useprewindow - Number of ticks or time interval to consider BEFORE each tick for which the computation is done.
If number is 0, don't consider any ticks prior to the current one.
If number is > 0, consider that many ticks prior to the current one.
If number is < 0, consider that number negated of microseconds prior to the current tick.
A delta comparison from the previous value will need a prewindow of 1 (1 tick before the current one). *postwindow - Same meaning as 'prewindow' but for the interval AFTER each tick.occurrences - Number of times to apply map, 0 means apply it for each tick. This is useful for some computations like
sums where the only result that might matter is that of the latest tickreversed - Compute ticks backwards, starting from most recent onestep - How many ticks to move the sliding window after each mapper application (>=1)outputTicks - Sorted list of ticks to use instead of the gts ticks (reverse sorted if reversed is true)overrideTick - If true, use the tick returned by the mapper instead of the current tick. This may lead to duplicate ticks, need to run DEDUP.WarpScriptExceptionpublic static java.util.List<GeoTimeSerie> map(GeoTimeSerie gts, WarpScriptMapperFunction mapper, long prewindow, long postwindow, long occurrences, boolean reversed) throws WarpScriptException
WarpScriptExceptionpublic static java.util.List<GeoTimeSerie> map(GeoTimeSerie gts, WarpScriptMapperFunction mapper, long prewindow, long postwindow) throws WarpScriptException
WarpScriptExceptionpublic static GeoTimeSerie relabel(GeoTimeSerie gts, java.util.Map<java.lang.String,java.lang.String> newlabels)
gts - GTS instance whose labels must be modified.newlabels - Map of label names to label values.public static GTSEncoder relabel(GTSEncoder encoder, java.util.Map<java.lang.String,java.lang.String> newlabels)
public static GeoTimeSerie rename(GeoTimeSerie gts, java.lang.String name)
gts - GTS instance to rename.name - New name to give the GTS, or suffix to add to its current name if 'name' starts with '+' (the '+' will be trimmed).public static java.util.Map<java.util.Map<java.lang.String,java.lang.String>,java.util.List<GeoTimeSerie>> partition(java.util.Collection<GeoTimeSerie> series, java.util.Collection<java.lang.String> bylabels)
series - Collection of GTS to partitionbylabels - Collection of label names to use for partitioning or null to use all labels of each GTSpublic static java.util.Map<java.lang.String,java.lang.String> commonAttributes(java.util.List<GeoTimeSerie> lgts)
lgts - List of GTSs to find common attributes from.public static long firsttick(GeoTimeSerie gts)
gts - GeoTimeSerie to return the first tick for.public static long lasttick(GeoTimeSerie gts)
gts - GeoTimeSerie to return the last tick for.public static int nticks(GeoTimeSerie gts)
gts - GeoTimeSerie instance of which to count ticks.public static int nvalues(GeoTimeSerie gts)
gts - GeoTimeSerie instance of which to count values.public static boolean isSorted(GeoTimeSerie gts)
gts - GeoTimeSerie instance to consider.public static boolean isReversed(GeoTimeSerie gts)
gts - GeoTimeSerie instance to consider.public static java.lang.Object max(GeoTimeSerie gts) throws WarpScriptException
gts - GTS to compute the max ofWarpScriptExceptionpublic static java.lang.Object min(GeoTimeSerie gts) throws WarpScriptException
gts - GTS to compute the max ofWarpScriptExceptionpublic static java.lang.Object lowest(GeoTimeSerie gts) throws WarpScriptException
gts - GTS to compute the minimum elevation onWarpScriptExceptionpublic static java.lang.Object highest(GeoTimeSerie gts) throws WarpScriptException
gts - GTS to compute the maximum elevation onWarpScriptExceptionpublic static long[] longValues(GeoTimeSerie gts) throws WarpScriptException
WarpScriptExceptionpublic static double[] doubleValues(GeoTimeSerie gts) throws WarpScriptException
WarpScriptExceptionpublic static java.util.BitSet booleanValues(GeoTimeSerie gts) throws WarpScriptException
WarpScriptExceptionpublic static java.lang.String[] stringValues(GeoTimeSerie gts) throws WarpScriptException
WarpScriptExceptionpublic static GeoTimeSerie dedup(GeoTimeSerie gts)
gts - GeoTimeSerie instance from which to remove duplicates.public static GeoTimeSerie onlybuckets(GeoTimeSerie gts)
gts - GeoTimeSerie instance to clean.@SafeVarargs public static java.util.List<GeoTimeSerie> partitionAndApply(java.lang.Object function, WarpScriptStack stack, WarpScriptStack.Macro validator, java.util.Collection<java.lang.String> bylabels, java.util.List<GeoTimeSerie>... series) throws WarpScriptException
function - The function to apply, either an WarpScriptFilterFunction or WarpScriptNAryFunctionbylabels - Labels to use for partitioning the GTS instancesseries - Set of GTS instances collectionsWarpScriptException - if the function is invalid.@SafeVarargs public static java.util.Map<java.util.Map<java.lang.String,java.lang.String>,java.util.List<GeoTimeSerie>> partitionAndApplyUnflattened(java.lang.Object function, WarpScriptStack stack, WarpScriptStack.Macro validator, java.util.Collection<java.lang.String> bylabels, java.util.List<GeoTimeSerie>... series) throws WarpScriptException
function - The function to apply, either an WarpScriptFilterFunction or WarpScriptNAryFunctionbylabels - Labels to use for partitioning the GTS instancesseries - Set of GTS instances collectionsWarpScriptException - if the function is invalid.@SafeVarargs public static GeoTimeSerie applyNAryFunction(WarpScriptNAryFunction function, java.util.Map<java.lang.String,java.lang.String> commonlabels, java.util.List<GeoTimeSerie>... subseries) throws WarpScriptException
WarpScriptException@Deprecated public static java.util.List<GeoTimeSerie> apply(WarpScriptBinaryOp op, java.util.Collection<GeoTimeSerie> op1, java.util.Collection<GeoTimeSerie> op2, java.util.Collection<java.lang.String> bylabels) throws WarpScriptException
op - Binary op to apply.op1 - Collection of GTS instances for operand1 of opop2 - Collection of GTS instances for operand2 of opbylabels - Label names to use for partitioning op1+op2WarpScriptException - If partitioning could not be donepublic static java.util.List<GeoTimeSerie> reduce(WarpScriptReducerFunction reducer, java.util.Collection<GeoTimeSerie> series, java.util.Collection<java.lang.String> bylabels) throws WarpScriptException
WarpScriptExceptionpublic static java.util.List<GeoTimeSerie> reduce(WarpScriptReducerFunction reducer, java.util.Collection<GeoTimeSerie> series, java.util.Collection<java.lang.String> bylabels, boolean overrideTick) throws WarpScriptException
WarpScriptExceptionpublic static java.util.Map<java.util.Map<java.lang.String,java.lang.String>,java.util.List<GeoTimeSerie>> reduceUnflattened(WarpScriptReducerFunction reducer, java.util.Collection<GeoTimeSerie> series, java.util.Collection<java.lang.String> bylabels) throws WarpScriptException
WarpScriptExceptionpublic static java.util.Map<java.util.Map<java.lang.String,java.lang.String>,java.util.List<GeoTimeSerie>> reduceUnflattened(WarpScriptReducerFunction reducer, java.util.Collection<GeoTimeSerie> series, java.util.Collection<java.lang.String> bylabels, boolean overrideTick) throws WarpScriptException
WarpScriptExceptionpublic static java.lang.Object getLastValue(GeoTimeSerie gts)
gts - GTS instance to extract value from.public static int[] sortIndices(long[] values,
boolean reversed)
values - Values whose order must be checkedreversed - If true, sort indices so 'values' is in descending orderpublic static GeoTimeSerie.TYPE getValueType(java.lang.Object value)
public static void shrink(GeoTimeSerie gts)
gts - GTS instance to shrinkpublic static void shrink(GeoTimeSerie gts, double ratio)
public static GeoTimeSerie compact(GeoTimeSerie gts, boolean preserveRanges)
gts - GTS instance to compresspreserveRanges - Flag indicating if we should preserve range extrema or notpublic static GeoTimeSerie normalize(GeoTimeSerie gts)
gts - GeoTimeSerie instance to be normalized.public static GeoTimeSerie isonormalize(GeoTimeSerie gts)
gts - GeoTimeSerie instance to be isonormalized.public static GeoTimeSerie standardize(GeoTimeSerie gts)
gts - GeoTimeSerie instance to be standardized.public static GeoTimeSerie standardize(GeoTimeSerie gts, double mean, double sd)
public static GeoTimeSerie bSAX(GeoTimeSerie gts, int alphabetSize, int wordLen, int windowLen, boolean standardizePAA) throws WarpScriptException
gts - GeoTimeSerie instance on which to apply the bSAX algorithm, must be bucketized, filled and numeric.alphabetSize - Size of the alphabet used by bSAX, must be a power of two.wordLen - Size of the words to be generated by the bSAX algorithm.windowLen - Window size which is the width of each interval on which the pattern extraction should be performed.standardizePAA - Whether to standardize or not the piecewise aggregate approximation.WarpScriptException - if the GTS is not numeric, bucketized and filled or if parameters are incorrect.public static GeoTimeSerie singleExponentialSmoothing(GeoTimeSerie gts, double alpha) throws WarpScriptException
gts - GeoTimeSerie instance on which to apply the exponential smoothing.alpha - Smoothing Factor (0 < alpha < 1)WarpScriptException - if the GTS is not numeric, has less than 2 values or alpha is not in ]0;1[.public static java.util.List<GeoTimeSerie> doubleExponentialSmoothing(GeoTimeSerie gts, double alpha, double beta) throws WarpScriptException
gts - GeoTimeSerie instance on which to apply the exponential smoothing.alpha - Smoothing Factor (0 < alpha < 1)beta - Trend smoothing Factor (0 < beta < 1)WarpScriptException - if the GTS is not numeric, has less than 2 values or alpha or beta is not in ]0;1[.public static java.util.Map<java.lang.Object,java.lang.Long> valueHistogram(GeoTimeSerie gts)
public static java.util.Map<java.lang.Object,java.lang.Long> valueHistogram(GTSEncoder encoder)
public static GeoTimeSerie detect(GeoTimeSerie gts, int alphabetSize, int wordLen, int windowLen, java.util.Collection<java.lang.String> patterns, boolean standardizePAA) throws WarpScriptException
gts - GeoTimeSerie in which to detect patterns.alphabetSize - Size of the alphabet used by bSAX, must be a power of two.wordLen - Size of the words to be generated by the bSAX algorithm.windowLen - Window size which is the width of each interval on which the pattern extraction should be performed.standardizePAA - Whether to standardize or not the piecewise aggregate approximation.WarpScriptException - if the GTS is not numeric, bucketized and filled or if bSAX parameters are incorrect.public static int getBucketCount(GeoTimeSerie gts)
public static long getBucketSpan(GeoTimeSerie gts)
public static long getLastBucket(GeoTimeSerie gts)
public static void setBucketCount(GeoTimeSerie gts, int bucketcount)
public static void setBucketSpan(GeoTimeSerie gts, long bucketspan)
public static void setLastBucket(GeoTimeSerie gts, long lastbucket)
public static void metadataToString(java.lang.StringBuilder sb,
java.lang.String name,
java.util.Map<java.lang.String,java.lang.String> labels,
boolean expose)
public static void labelsToString(java.lang.StringBuilder sb,
java.util.Map<java.lang.String,java.lang.String> labels,
boolean expose)
public static java.lang.String buildSelector(GeoTimeSerie gts, boolean forSearch)
public static java.lang.String buildSelector(Metadata metadata, boolean forSearch)
metadata - Metadata to representforSearch - Set to true if the result is for searching, in that case for empty values of labels, '~$' will be produced, otherwise '='public static GeoTimeSerie timeclip(GeoTimeSerie gts, long start, long end)
gts - GeoTimeSerie instance to clip.start - Oldest tick (inclusive) to keep.end - Youngest tick (inclusive) to keep.public static GTSEncoder timeclip(GTSEncoder encoder, long start, long end)
start - lower timestamp to consider (inclusive)end - upper timestamp to consider (inclusive)public static GeoTimeSerie integrate(GeoTimeSerie gts, double initialValue)
gts - GeoTimeSerie instance to integrate.initialValue - Initial value of the resulting GTS.public static GeoTimeSerie shrinkTo(GeoTimeSerie gts, int newsize)
gts - Geo Time Series to reducenewsize - New number of valuespublic static GTSEncoder shrinkTo(GTSEncoder encoder, int newsize) throws java.io.IOException
java.io.IOExceptionpublic static java.util.List<GeoTimeSerie> chunk(GeoTimeSerie gts, long lastchunk, long chunkwidth, long chunkcount, java.lang.String chunklabel, boolean keepempty) throws WarpScriptException
gts - lastchunk - End timestamp of the most recent chunk. Use 0 to adjust automatically on 'chunkwidth' boundarychunkwidth - Width of each chunk in time unitschunkcount - Number of chunks to generate. Use 0 to generate as many chunks as needed to cover the GTSchunklabel - Name of the label to use for storing the chunkidkeepempty - Should we keed empty chunksWarpScriptException - if parameters are invalid.public static java.util.List<GeoTimeSerie> chunk(GeoTimeSerie gts, long lastchunk, long chunkwidth, long chunkcount, java.lang.String chunklabel, boolean keepempty, long overlap) throws WarpScriptException
WarpScriptExceptionpublic static java.util.List<GTSEncoder> chunk(GTSEncoder encoder, long lastchunk, long chunkwidth, long chunkcount, java.lang.String chunklabel, boolean keepempty, long overlap) throws WarpScriptException
WarpScriptExceptionpublic static GeoTimeSerie fuse(java.util.Collection<GeoTimeSerie> chunks) throws WarpScriptException
WarpScriptExceptionpublic static GeoTimeSerie timescale(GeoTimeSerie gts, double scale) throws WarpScriptException
gts - The GTS instance whose ticks are to be scaled.scale - The factor to apply to the ticks.WarpScriptException - If the GTS instance is bucketized.public static boolean isNormal(GeoTimeSerie gts, int buckets, double pcterror, boolean bessel)
gts - GTS to checkbuckets - Number of buckets to distribute the values inpcterror - Maximum acceptable percentage of deviation from the mean of the bucket sizesbessel - Should we apply Bessel's correction when computing sigmapublic static double[] musigma(GeoTimeSerie gts, boolean bessel)
public static GeoTimeSerie quantize(GeoTimeSerie gts, double[] bounds, java.lang.Object[] values) throws WarpScriptException
WarpScriptExceptionpublic static long[] getTicks(GeoTimeSerie gts)
gts - GeoTime Serie instance to get the ticks from.public static long[] getLocations(GeoTimeSerie gts)
gts - GeoTime Serie instance to get the locations from.public static long[] getOriginalLocations(GeoTimeSerie gts)
public static long[] getOriginalElevations(GeoTimeSerie gts)
public static long[] getElevations(GeoTimeSerie gts)
gts - GeoTime Serie instance to get the elevations from.public static double[] getValuesAsDouble(GeoTimeSerie gts) throws WarpScriptException
gts - GeoTime Serie instance to get the doubles from.WarpScriptException - if the GeoTimeSerie instance does not contain doubles.public static void internalizeStrings(Metadata meta)
meta - Metadata to be internalized.public static double pointwise_lowess(GeoTimeSerie gts, int idx, long tick, int q, int p, double[] weights, double[] rho, double[] beta, boolean reversed) throws WarpScriptException
gts - : input GTSidx - : considered as index of the first non-null neighbour at the righttick - : tick at which lowess is achievedq - : bandwitdth, i.e. number of nearest neighbours to considerp - : degree of polynomial fitweights - : optional array that store the weightsrho - : optional array that store the robustness weightsbeta - : optional array that store the regression parametersreversed - : should idx be considered to be at the left insteadWarpScriptException - if array lengths are not coherent.public static double pointwise_lowess(GeoTimeSerie gts, int idx, long tick, int q, int p, double[] weights, double[] rho, double[] beta) throws WarpScriptException
WarpScriptExceptionpublic static GeoTimeSerie rlowess(GeoTimeSerie gts, int q, int r, long d, int p, double[] weights, double[] rho, boolean inplace) throws WarpScriptException
gts - Input GTSq - Bandwith, i.e. number of nearest neighbours to consider when applying LOWESSr - Robustness, i.e. number of robustifying iterationsd - Delta in µs, i.e. acceptable neighbourhood radius within which LOWESS is not recomputed
close points are approximated by polynomial interpolation, d should remain < 0.1*(lasttick-firstick) in most casesp - Degree, i.e. degree of the polynomial fit
best usage p=1 or p=2 ; it will likely return an overflow error if p is too bigweights - : optional array that store the weightsrho - : optional array that store the robustness weightsinplace - : should the gts returned be the same object than the inputWarpScriptException - if parameters are incorrect.public static GeoTimeSerie rlowess(GeoTimeSerie gts, int q, int r, long d, int p) throws WarpScriptException
WarpScriptExceptionpublic static void lowess_stl(GeoTimeSerie fromGTS, GeoTimeSerie toGTS, int neighbours, int degree, int jump, double[] weights, double[] rho) throws WarpScriptException
fromGTS - : GTS from which data used for estimation is takentoGTS - : GTS where results are savedneighbours - : number of nearest neighbours to take into account when computing lowess (bandwitdh)degree - : degree of polynomial fit in lowessjump - : number of bucket to skip when computing lowess (to speed it up)weights - : optional array that store the weightsrho - : optional array that store the robustness weightsWarpScriptExceptionpublic static java.util.List<GeoTimeSerie> stl(GeoTimeSerie gts, int buckets_per_period, int inner, int outer, int neighbour_s, int degree_s, int jump_s, int neighbour_l, int degree_l, int jump_l, int neighbour_t, int degree_t, int jump_t, int neighbour_p, int degree_p, int jump_p) throws WarpScriptException
gts - : Input GTS, must be bucketizedbuckets_per_period - : number of buckets for one period of the seasonalityinner - Precision : number of inner loops (to make the decomposition)outer - Robustness : number of outer loops (to alleviate the impact of outliers upon the decomposition)
Optional sets of parameters shared by call of lowess of the same kind:neighbour_s - : (for the seasonal extracting step) Bandwidth, i.e. number of nearest neighbours to consider when applying LOWESS. If negative, approximation by the mean is used instead of LOWESS.degree_s - : (for the seasonal extracting step) Degree, i.e. degree of the polynomial fitjump_s - : (for the seasonal extracting step) Jump, i.e. number of bucket to skip to speed up computation. These buckets are interpolated afterward.neighbour_l - : (for the low frequency filtering step) Bandwidth, i.e. number of nearest neighbours to consider when applying LOWESSdegree_l - : (for the low frequency filtering step) Degree, i.e. degree of the polynomial fitjump_l - : (for the low frequency filtering step) Jump, i.e. number of bucket to skip to speed up computation. These buckets are interpolated afterward.neighbour_t - : (for the trend extracting step) Bandwidth, i.e. number of nearest neighbours to consider when applying LOWESSdegree_t - : (for the trend extracting step) Degree, i.e. degree of the polynomial fitjump_t - : (for the trend extracting step) Jump, i.e. number of bucket to skip to speed up computation. These buckets are interpolated afterward.neighbour_p - : (for the post seasonal smoothing step) Bandwidth, i.e. number of nearest neighbours to consider when applying LOWESSdegree_p - : (for the post seasonal smoothing step) Degree, i.e. degree of the polynomial fitjump_p - : (for the post seasonal smoothing step) Jump, i.e. number of bucket to skip to speed up computation. These buckets are interpolated afterward.WarpScriptExceptionpublic static void copy(GeoTimeSerie src, int srcPos, GeoTimeSerie dest, int destPos, int length)
src - The source GTSsrcPos - The starting index in srcdest - The destination GTSdestPos - The starting index in destlength - The number of points to copypublic static void copyGeo(GeoTimeSerie from, GeoTimeSerie to)
from - Source GeoTimeSerie instance from which geo infos will be copied.to - Destination GeoTimeSerie instance to which geo infos will be copied.public static int[] getFirstLastTicks(long[] ticks)
public static boolean geowithin(com.geoxp.GeoXPLib.GeoXPShape shape,
GeoTimeSerie gts)
public static boolean geointersects(com.geoxp.GeoXPLib.GeoXPShape shape,
GeoTimeSerie gts)
public static java.util.List<GeoTimeSerie> commonTicks(java.util.List<GeoTimeSerie> series)
series - List of GeoTimeSerie instance to get values with common ticks from.public static java.util.List<java.lang.Number> bbox(GeoTimeSerie gts)
public static GeoTimeSerie cprob(GeoTimeSerie gts, java.lang.String separator) throws WarpScriptException
gts - GeoTimeSerie instance representing the sequence of events.separator - a String separator between events or null to simply compute the probability of values.WarpScriptExceptionpublic static GeoTimeSerie prob(GeoTimeSerie gts)
gts - GeoTimeSerie instance for which to get the value probabilities.public static GeoTimeSerie lttb(GeoTimeSerie gts, int threshold, boolean timebased) throws WarpScriptException
WarpScriptExceptionpublic static void dump(GTSEncoder encoder, java.io.PrintWriter pw)
public static double standardizedMoment(int moment,
GeoTimeSerie gts,
boolean bessel)
throws WarpScriptException
WarpScriptExceptionpublic static double kurtosis(GeoTimeSerie gts, boolean bessel) throws WarpScriptException
WarpScriptExceptionpublic static double skewness(GeoTimeSerie gts, boolean bessel) throws WarpScriptException
WarpScriptExceptionpublic static void booleanNot(GeoTimeSerie gts) throws WarpScriptException
WarpScriptException