From 2883eb2f6c6af81c3d07b0a644896b35963dd70b Mon Sep 17 00:00:00 2001 From: Joaquim Date: Mon, 11 Mar 2024 22:23:24 +0000 Subject: [PATCH] If a thermal band has a slight different name than template, try to guess it. --- src/utils.jl | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/utils.jl b/src/utils.jl index 59e1732..0c930c9 100644 --- a/src/utils.jl +++ b/src/utils.jl @@ -348,8 +348,21 @@ function cutcube(; names::Vector{String}=String[], bands::AbstractVector=Int[], end end # Now test if any of the file names, either passed in or generated here, do not exist + k = 1 for name in names - !isfile(name) && error("File name $name does not exist. Must stop here.") + if (!isfile(name)) + if (startswith(name, "LC0") && template[end-3:end-2] == "SR") # For Landsat 9 termal bands are now _ST_B10 + name = replace(name, "_SR_B" => "_ST_B") + if (isfile(name)) + names[k] = name + else + error("File name $name does not exist. Must stop here.") + end + else + error("File name $name does not exist. Must stop here.") + end + end + k += 1 end MTL = read_mtl(names[1], mtl, get_full=true) (MTL !== nothing) && (MTL = ["MTL=" * join(MTL, "\n")])