Skip to content

Commit

Permalink
Merge pull request #10 from emit-sds/single_column_update
Browse files Browse the repository at this point in the history
one-sample files
  • Loading branch information
pgbrodrick authored May 2, 2022
2 parents a00bc55 + a197f06 commit 44dad02
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/Datasets.jl
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ function load_line(reflectance_file::String, reflectance_uncertainty_file::Strin
good_data = .!all(img_dat .== refl_nodata, dims=2)[:,1]
img_dat = img_dat[good_data,:]

if sum(good_data) > 1
if sum(good_data) >= 1
if reflectance_uncertainty_file != ""
unc_dat = convert(Array{Float64},ArchGDAL.readraster(reflectance_uncertainty_file)[:,line,:])
unc_dat = unc_dat[:, good_bands]
Expand Down
3 changes: 2 additions & 1 deletion src/EndmemberLibrary.jl
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ function load_data!(library::SpectralLibrary)
try
library.classes = convert(Array{AbstractString}, df[!,library.class_header_name])
catch e
throw(ArgumentError("Could not read classes from endmember library. Try adjusting class_header_name, or reworking the library."))
throw(ArgumentError("Could not read classes from endmember library using class key "*library.class_header_name *
". Try adjusting class_header_name, or reworking the library."))
end

try
Expand Down
4 changes: 2 additions & 2 deletions src/SpectralUnmixing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ function unmix_pixel(library::SpectralLibrary, img_dat_input::Array{Float64}, un

if occursin("sma", mode)
perm = get_sma_permutation(class_idx, num_endmembers, combination_type, size(library.spectra)[1])
G = library.spectra[perm,:]
G = library.spectra[perm, library.good_bands]

G = scale_data(G, library.wavelengths[library.good_bands], normalization)'

Expand Down Expand Up @@ -190,7 +190,7 @@ function unmix_pixel(library::SpectralLibrary, img_dat_input::Array{Float64}, un
for (_comb, comb) in enumerate(options[perm])
comb = [c for c in comb]
#G = hcat(library.spectra[comb,:], ones(size(library.spectra[comb,:])[1],1))
G = scale_data(library.spectra[comb,:], library.wavelengths[library.good_bands], normalization)'
G = scale_data(library.spectra[comb, library.good_bands], library.wavelengths[library.good_bands], normalization)'

x0 = dolsq(G, d')
ls = nothing
Expand Down
2 changes: 0 additions & 2 deletions unmix.jl
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,6 @@ function main()
end


endmember_library.spectra = endmember_library.spectra[:,endmember_library.good_bands]

n_classes = length(unique(endmember_library.classes))
output_bands = [n_classes + 1]
output_files = [string(args.output_file_base , "_fractional_cover")]
Expand Down

0 comments on commit 44dad02

Please sign in to comment.