File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -654,6 +654,30 @@ function ObservationRecipe.reconstruct_diag_cov(obs::EKP.Observation)
654654 return vars
655655end
656656
657+ """
658+ ObservationRecipe.reconstruct_vars(obs::EKP.Observation)
659+
660+ Reconstruct the `OutputVar`s from the `samples` in `obs`.
661+ """
662+ function ObservationRecipe. reconstruct_vars(obs:: EKP.Observation )
663+ all_metadata = EKP. get_metadata(obs)
664+ samples = EKP. get_samples(obs)
665+ stacked_sample = reduce(vcat, samples)
666+
667+ start_index = 1
668+ vars = OutputVar[]
669+ for metadata in all_metadata
670+ data_size = ClimaAnalysis. flattened_length(metadata)
671+ var = ClimaAnalysis. unflatten(
672+ metadata,
673+ view(stacked_sample, start_index: (start_index + data_size - 1 )),
674+ )
675+ push!(vars, var)
676+ start_index += data_size
677+ end
678+ return vars
679+ end
680+
657681"""
658682 _get_minibatch_indices_for_nth_iteration(ekp::EKP.EnsembleKalmanProcess, N)
659683
You can’t perform that action at this time.
0 commit comments