File size: 6,011 Bytes
1de6f3f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
ArrayTools
====================================

https://github.com/theonetruenerd/VenusPackages/blob/main/ArrayTools.pkg

The ArrayTools library provides the following functions:

- :py:func:`ArraySeqVLookup`
- :py:func:`ArrayVLookup`
- :py:func:`ConvertArrayOfNumericIntegersToString`
- :py:func:`ConvertArrayOfNumericStringsToInteger`
- :py:func:`Lookup`
- :py:func:`Sort3ArraysByNumericAscendingOrder`
- :py:func:`Update_Value_in_Array`
- :py:func:`get_distinct_from_array`
- :py:func:`mergeArrays`
- :py:func:`removeValueFromArray_basedOnIndex`

.. py:function:: ArraySeqVLookup(array i_arraySequencesA, array i_arrayValuesB, variable i_varCondition, array o_arraySequencesC)

  Given 2 arrays  A (Sequences) and B (Values) with same size
  Retrieve all the sequences in A where B = input value
  A(seq1, seq2, seq3,seq4,seq5, seq6, ...)
  B(1, 2, 3, 1, 2, 3, ...)

  Get from A all elements where B = 1
  C(seq1, seq4, ...)

  :param i_arraySequencesA: The input array of sequences to filter
  :param i_arrayValuesB: The input array of variables to act as a filter
  :param i_varCondition: The input value of the variable which is to be selected
  :param o_arraySequencesC: The output array of the sequences whose index matches the indices in which the the value of the variable is equal to the filter
  :type i_arraySequencesA: Array of sequences
  :type i_arrayValuesB: Array of variables
  :type i_varCondition: Variable
  :type o_arraySequencesC: Array of sequences
  :return: None
  :rtype: N/A

.. py:function:: ArrayVLookup(array i_arrayValuesA, array i_arrayValuesB, variable i_varCondition, array o_arrayValuesC)

  Given 2 arrays of values A and B with same size
  Retrieve all the elements in B where A = input value

  A(100, 20, 15, 45, 42, 1, ...)
  B(1, 2, 3, 1, 2, 3, ...)

  Get from A all elements where B = 1
  C(100, 15, ...)

  :param i_arrayValuesA: The input array of variables to filter
  :param i_arrayValuesB: The input array of variables to act as a filter
  :param i_varCondition: The input value of the variable which is to be selected
  :param o_arrayValuesC: The output array of the variables whose index matches the indices in which the value of the variable is equal to the filter
  :type i_arrayValuesA: Array of variables
  :type i_arrayValuesB: Array of variables
  :type i_varCondition: Variable
  :type o_arrayValuesC: Array of variables
  :return: None
  :rtype: N/A

.. py:function:: ConvertArrayOfNumericIntegersToString(array i_arr1_int, array o_arr1_str)

  Converts all the numeric integers within an array to strings.

  :param i_arr1_int: The input array containing the integers to be converted
  :param o_arr1_str: The output array containing the strings
  :type i_arr1_int: Array of variables
  :type o_arr1_str: Array of variables
  :return: None
  :rtype: N/A

.. py:function:: ConvertArrayOfNumericStringsToIntegers(array i_arr1_str, array o_arr1_int)

  Converts all the numeric strings within an array to integers.

  :param i_arr1_str: The input array containing the strings to be converted
  :param o_arr1_int: The output array containing the integers
  :type i_arr1_str: Array of variables
  :type o_arr1_int: Array of variables
  :return: None
  :rtype: N/A

.. py:function:: Lookup(array array, variable item)

  Looks up a value within an array, outputting a 1-based index of the value if found in the array, and a 0 if the value isn't found.

  :param array: The input array to be searched
  :param item: The variable to be searched for
  :type array: Array
  :type item: Variable
  :return: None
  :rtype: N/A

.. py:function:: Sort3ArraysByNumericAscendingOrder(array io_array1, array io_array2, array io_array3)

  Sorts 3 arrays by numeric ascending order. io_array1 must contain only numeric values; this one will be sorted and then the other arrays will update to match the new order of io_array1.

  :param io_array1: The first of the arrays to be sorted, which must contain only numeric values.
  :param io_array2: The second of the arrays to be sorted, which can contain any values.
  :param io_array3: The third of the arrays to be sorted, which can contain any values.
  :type io_array1: Array
  :type io_array2: Array
  :type io_array3: Array
  :return: None
  :rtype: N/A

.. py:function:: Update_Value_in_Array(array i_array, variable i_value, variable i_index)

  Overwrites a value in the array at a specified index.

  :param i_array: The array in which the value will be changed.
  :param i_value: The new value to be inserted into the array.
  :param i_index: The 1-based index of the position in the array to be overwritten.
  :type i_array: Array
  :type i_value: Variable
  :type i_index: Variable
  :return: None
  :rtype: N/A

.. py:function:: get_distinct_from_array(array i_arr, array o_arr)

  Gets all the values in an array that only appear once.

  :param i_arr: The input array to be searched.
  :param o_arr: The new output array containing the values which only appear once.
  :type i_arr: Array
  :type i_arr: Array
  :return: None
  :rtype: N/A

.. py:function:: mergeArrays(array array1, array array2, array array3)

  Concatenates two arrays and outputs the result into a third array.

  :param array1: The first array of interest.
  :param array2: The second array of interest.
  :param array3: The resulting array of values.
  :type array1: Array
  :type array2: Array
  :type array3: Array
  :return: None
  :rtype: N/A

.. py:function:: removeValueFromArray_basedOnIndex(array i_array_elements, variable i_index_to_remove)

  Removes a value from an array at the specified index.

  :param i_array_elements: The array from which an item is to be removed.
  :param i_index_to_remove: The 1-based index of the array from which the item is to be removed.
  :type i_array_elements: Array
  :type i_index_to_remove: Variable
  :return: None
  :rtype: N/A