Skip to content

Commit

Permalink
issue #23
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander-Barth committed Mar 28, 2024
1 parent 7eb8874 commit c761469
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/model.jl
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ struct StepModel{F1,F2}
costfun::F2
end

weights(model::StepModel) = reduce(vcat,weights.(model.chains))
weights(model::StepModel) = Iterators.flatten(weights.(model.chains))

function StepModel(
chains,loss_weights,truth_uncertain,gamma;
Expand Down
1 change: 1 addition & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ using Test

@testset "reconstruct gridded data" begin
include("test_DINCAE_SST.jl")
include("test_regL2.jl")
end

@testset "reconstruct point cloud" begin
Expand Down
38 changes: 38 additions & 0 deletions test/test_regL2.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
using DINCAE

const F = Float32
Atype = Array{F}

filename = "avhrr_sub_add_clouds_n10.nc"

if !isfile(filename)
download("https://dox.ulg.ac.be/index.php/s/2yFgNMkpsGumVSM/download", filename)
end


data = [
(filename = filename,
varname = "SST",
obs_err_std = 1,
jitter_std = 0.05,
isoutput = true,
)
]
data_test = data;
data_all = [data,data_test]

fnames_rec = [tempname()]
paramfile = tempname()

losses = DINCAE.reconstruct(
Atype,data_all,fnames_rec;
epochs = 3,
batch_size = 5,
enc_nfilter_internal = round.(Int,32 * 2 .^ (0:3)),
clip_grad = 5.0,
upsampling_method = :nearest,
ntime_win = 3,
paramfile = paramfile,
regularization_L2_beta = 0.001,
loss_weights_refine = (0.3,0.7),
)

0 comments on commit c761469

Please sign in to comment.