@@ -6,9 +6,10 @@ using Distances
66""" rqatrend(cube;thresh=2, path=tempname() * ".zarr")
77
88Compute the RQA trend metric for the datacube `cube` with the epsilon threshold `thresh`.
9+ `lowerbound` and `upperbound` are forwarded to the classification of the RQA Trend result.
910"""
10- function rqatrend(cube; thresh= 2 , outpath= tempname() * " .zarr" , overwrite= false , kwargs... )
11- mapCube(rqatrend, cube, thresh; indims= InDims(" Time" ), outdims= OutDims(; outtype= UInt8, path= outpath, fill_value= 255 , overwrite, kwargs... ))
11+ function rqatrend(cube; thresh= 2 , lowerbound = - 5 , upperbound = - 0.5 , outpath= tempname() * " .zarr" , overwrite= false , kwargs... )
12+ mapCube(rqatrend, cube, thresh, lowerbound, upperbound ; indims= InDims(" Time" ), outdims= OutDims(; outtype= UInt8, path= outpath, fill_value= 255 , overwrite, kwargs... ))
1213end
1314
1415@testitem " rqatrend cube" begin
3738""" rqatrend(path::AbstractString; thresh=2, outpath=tempname()*".zarr")
3839
3940Compute the RQA trend metric for the data that is available on `path`.
41+ See the `rqatrend` for a YAXArray for the description of the parameters.
4042"""
41- rqatrend(path:: AbstractString ; thresh= 2 , outpath= tempname() * " .zarr" , overwrite= false , kwargs... ) =
42- rqatrend(Cube(path); thresh, outpath, overwrite, kwargs... )
43+ rqatrend(path:: AbstractString ; thresh= 2 , lowerbound = - 5. , upperbound = - 0.5 , outpath= tempname() * " .zarr" , overwrite= false , kwargs... ) =
44+ rqatrend(Cube(path); thresh, lowerbound, upperbound, outpath, overwrite, kwargs... )
4345
4446
4547"""
4648rqatrend(xout, xin, thresh)
4749
4850Compute the RQA trend metric for the non-missing time steps of xin, and save it to xout.
49- `thresh` specifies the epsilon threshold of the Recurrence Plot computation
51+ `thresh` specifies the epsilon threshold of the Recurrence Plot computation.
52+ `lowerbound` and `upperbound` are the bounds of the classification into UInt8.
53+ The result of rqatrend are UInt8 values between 0 (no change) to 254 (definitive change) with 255 as sentinel value for missing data.
5054"""
5155function rqatrend(pix_trend, pix, thresh= 2 , lowerbound= - 5. , upperbound= - 0.5 )
5256 pix_trend .= classify_rqatrend(rqatrend_impl(pix; thresh); lowerbound, upperbound)
5660 classify_rqatrend(trend; lowerbound=Float32(-5.0), upperbound=Float32(-0.5)))
5761Classify the rqatrend and put it into 254 bins so that they can fit into a UInt8 encoding.
5862This is a compromise between data storage and accuracy of the change detection.
63+ The value range is 0 (no change) to 254 (definitive change) with 255 kept free as a Sentinel value for missing data.
5964"""
6065function classify_rqatrend(trend; lowerbound= Float32(- 5.0 ), upperbound= Float32(- 0.5 ))
6166 isnan(trend) && return UInt8(255 )
0 commit comments