Skip to content

Commit d93555a

Browse files
authored
Remove non required code (#103)
* Remove timestats.jl * Remove anti_diagonal_density * Remove inner_postprocessing * Remove rqatrend_matrix * Remove rqatrend_recurrenceanalysis * Fix include of removed file * Format analysis.jl * Fix Arifact path
1 parent 4264210 commit d93555a

File tree

4 files changed

+8
-113
lines changed

4 files changed

+8
-113
lines changed

src/RQADeforestation.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ include("metrics.jl")
1515
include("auxil.jl")
1616
include("rqatrend.jl")
1717
include("analysis.jl") # TODO what is still needed from analysis now that rqatrend is in its own file?
18-
include("timestats.jl")
1918
include("main.jl")
2019

2120
end

src/analysis.jl

Lines changed: 7 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -35,83 +35,16 @@ countvalid(cube; path=tempname() * ".zarr") = mapCube(countvalid, cube; indims=I
3535
Y(range(1, 5, length=15)),
3636
)
3737
mock_data = allowmissing(rand(30, 10, 15))
38-
mock_data[1:10,1,1] .= missing
39-
mock_data[:, 2,1] .= missing
40-
mock_data[[1,5,9], 2,2] .= missing
38+
mock_data[1:10, 1, 1] .= missing
39+
mock_data[:, 2, 1] .= missing
40+
mock_data[[1, 5, 9], 2, 2] .= missing
4141
mock_props = Dict()
4242
mock_cube = YAXArray(mock_axes, mock_data, mock_props)
4343

4444
mock_count = RQADeforestation.countvalid(mock_cube)
4545
@test mock_count.axes == (mock_cube.X, mock_cube.Y)
46-
@test mock_count[1,1] == 20
47-
@test mock_count[1,2] == 30
48-
@test mock_count[2,2] == 27
49-
@test mock_count[2,1] == 0
50-
end
51-
52-
"""
53-
rqatrend(xout, xin, thresh)
54-
55-
Compute the RQA trend metric for the non-missing time steps of xin, and save it to xout.
56-
`thresh` specifies the epsilon threshold of the Recurrence Plot computation
57-
"""
58-
function rqatrend_recurrenceanalysis(pix_trend, pix, thresh=2)
59-
ts = collect(skipmissing(pix))
60-
tau_pix = tau_recurrence(ts, thresh)
61-
pix_trend .= RA._trend(tau_pix)
62-
end
63-
64-
function rqatrend_matrix(pix_trend, pix, thresh=2)
65-
#replace!(pix, -9999 => missing)
66-
ts = collect(skipmissing(pix))
67-
rm = RecurrenceMatrix(ts, thresh)
68-
pix_trend .= RA.trend(rm)
69-
end
70-
71-
#=
72-
"""
73-
rqatrend_shuffle(cube; thresh=2, path=tempname() * ".zarr", numshuffle=300)
74-
Compute the RQA trend metric for shuffled time series of the data cube `cube` with the epsilon threshold `thresh` for `numshuffle` tries and save it into `path`.
75-
"""
76-
function rqatrend_shuffle(cube; thresh=2, path=tempname() * ".zarr", numshuffle=300)
77-
# This should be made a random shuffle
78-
# TODO this looks completely broken
79-
sg = surrogenerator(collect(eachindex(water[overlap])), BlockShuffle(7, shift=true))
80-
end
81-
=#
82-
83-
84-
"""
85-
anti_diagonal_density(ts, thresh, metric)
86-
Compute the average density of the diagonals perpendicular to the main diagonal for data series `ts`.
87-
Uses the threshold `thresh` and `metric` for the computation of the similarities.
88-
"""
89-
function anti_diagonal_density(ts::AbstractVector, thresh, metric=Euclidean())
90-
n = length(ts)
91-
ad_densities = zeros(2 * n - 3)
92-
for col in 1:n
93-
for row in 1:(col-1)
94-
d = evaluate(metric, ts[col], ts[row])
95-
#@show row, col, d
96-
ad_densities[col+row-2] += d <= thresh
97-
end
98-
end
99-
half = div(n, 2)
100-
maxdensities = collect(Iterators.flatten([(n, n) for n in 1:half-1]))
101-
diagonallengths = [maxdensities..., half, reverse(maxdensities)...]
102-
ad_densities ./ diagonallengths
103-
end
104-
105-
"""
106-
Compute the forest masking thresholding and clustering of the rqadata in one step
107-
"""
108-
function inner_postprocessing(rqadata, forestmask; threshold=-1.28, clustersize=30)
109-
@time rqamasked = rqadata .* forestmask
110-
@time rqathresh = map(rqamasked) do x
111-
if !ismissing(x)
112-
x > threshold ? zero(Float32) : one(Float32)
113-
else
114-
x
115-
end
116-
end
46+
@test mock_count[1, 1] == 20
47+
@test mock_count[1, 2] == 30
48+
@test mock_count[2, 2] == 27
49+
@test mock_count[2, 1] == 0
11750
end

src/timestats.jl

Lines changed: 0 additions & 37 deletions
This file was deleted.

test/Artifacts.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
git-tree-sha1 = "1dc9d7aa975de4f5ecc652f34d6bbee706fcb7bd"
33

44
[[rqatestdata.download]]
5-
url = "https://github.com/meggart/RQADeforestationTestData/archive/refs/tags/v2.0.tar.gz"
5+
url = "https://github.com/EarthyScience/RQADeforestationTestData/archive/refs/tags/v2.0.tar.gz"
66
sha256 = "38a3e66a0505ed9d22c6e065627039089a421b0b143ac4c8d78aac45dd3dd497"

0 commit comments

Comments
 (0)