Oscar is right in that the for loop is likely the simplest, fastest, and easiest to read method. Also aplvain is right in that there are nice packages that can help.
That said you could use an array comprehension to do this.
julia> A = rand(Int8, 3,4,5); B = rand(Int8, 3, 4,5); C = similar(B, 1);
julia> threshold = 1; lookback = 1
1
julia> findall(>(threshold), A)
33-element Vector{CartesianIndex{3}}:
CartesianIndex(1, 1, 1)
CartesianIndex(2, 1, 1)
CartesianIndex(3, 1, 1)
CartesianIndex(1, 2, 1)
CartesianIndex(2, 2, 1)
CartesianIndex(1, 3, 1)
CartesianIndex(2, 3, 1)
CartesianIndex(3, 3, 1)
CartesianIndex(1, 1, 2)
CartesianIndex(3, 1, 2)
CartesianIndex(2, 3, 2)
CartesianIndex(2, 4, 2)
CartesianIndex(3, 4, 2)
CartesianIndex(1, 1, 3)
CartesianIndex(3, 1, 3)
CartesianIndex(2, 2, 3)
CartesianIndex(1, 3, 3)
CartesianIndex(2, 3, 3)
CartesianIndex(1, 4, 3)
CartesianIndex(3, 4, 3)
CartesianIndex(3, 1, 4)
CartesianIndex(2, 2, 4)
CartesianIndex(3, 2, 4)
CartesianIndex(1, 3, 4)
CartesianIndex(2, 3, 4)
CartesianIndex(2, 4, 4)
CartesianIndex(3, 4, 4)
CartesianIndex(1, 2, 5)
CartesianIndex(3, 2, 5)
CartesianIndex(1, 3, 5)
CartesianIndex(2, 3, 5)
CartesianIndex(1, 4, 5)
CartesianIndex(3, 4, 5)
julia> [view(B,ind[1]-lookback:ind[1], ind[2], ind[3]) for ind in findall(>(threshold), A) if ind[1] > lookback]
22-element Vector{SubArray{Int8, 1, Array{Int8, 3}, Tuple{UnitRange{Int64}, Int64, Int64}, true}}:
[-33, -36]
[-36, -29]
[-68, 99]
[107, 82]
[82, -44]
[-119, -122]
[127, -16]
[62, -113]
[-113, 104]
[7, 103]
[-4, -94]
[-91, -26]
[-85, -99]
[-17, -12]
[100, 40]
[40, -50]
[-39, -2]
[49, 4]
[4, 0]
[38, -57]
[82, 122]
[14, 0]
Value of `A` and `B`
julia> A
3×4×5 Array{Int8, 3}:
[:, :, 1] =
71 89 47 -112
50 24 111 -35
38 -102 41 -120
[:, :, 2] =
35 -17 -31 -65
-115 -55 19 114
57 0 -71 69
[:, :, 3] =
114 -33 103 91
-82 57 114 -125
39 -103 -109 117
[:, :, 4] =
-124 -107 63 -119
-44 86 39 38
35 63 -112 60
[:, :, 5] =
-111 21 90 66
-75 -30 25 -103
-79 102 -116 53
julia> B
3×4×5 Array{Int8, 3}:
[:, :, 1] =
-33 -68 107 -48
-36 99 82 108
-29 55 -44 -91
[:, :, 2] =
-57 91 127 62
-119 -93 -16 -113
-122 -85 13 104
[:, :, 3] =
-21 -4 -91 -125
7 -94 -26 -85
103 -124 16 -99
[:, :, 4] =
38 100 -39 49
-17 40 -2 4
-12 -50 87 0
[:, :, 5] =
9 -20 82 111
-103 38 122 14
-19 -57 -35 0