Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If a thermal band has a slight different name than template, try to guess it. #66

Merged
merged 1 commit into from
Mar 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -348,8 +348,21 @@
end
end
# Now test if any of the file names, either passed in or generated here, do not exist
k = 1

Check warning on line 351 in src/utils.jl

View check run for this annotation

Codecov / codecov/patch

src/utils.jl#L351

Added line #L351 was not covered by tests
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

Check warning on line 357 in src/utils.jl

View check run for this annotation

Codecov / codecov/patch

src/utils.jl#L353-L357

Added lines #L353 - L357 were not covered by tests
else
error("File name $name does not exist. Must stop here.")

Check warning on line 359 in src/utils.jl

View check run for this annotation

Codecov / codecov/patch

src/utils.jl#L359

Added line #L359 was not covered by tests
end
else
error("File name $name does not exist. Must stop here.")

Check warning on line 362 in src/utils.jl

View check run for this annotation

Codecov / codecov/patch

src/utils.jl#L362

Added line #L362 was not covered by tests
end
end
k += 1

Check warning on line 365 in src/utils.jl

View check run for this annotation

Codecov / codecov/patch

src/utils.jl#L365

Added line #L365 was not covered by tests
end
MTL = read_mtl(names[1], mtl, get_full=true)
(MTL !== nothing) && (MTL = ["MTL=" * join(MTL, "\n")])
Expand Down
Loading