Commit 1e21b0d2 authored by Alejandro Saez's avatar Alejandro Saez

truncate_data truncate whole replicum

parent 1c0a6f54
...@@ -609,6 +609,9 @@ function truncate_data!(data::YData, nc::Int64) ...@@ -609,6 +609,9 @@ function truncate_data!(data::YData, nc::Int64)
return nothing return nothing
end end
function truncate_data!(data::Vector{YData}, nc::Vector{Int64}) function truncate_data!(data::Vector{YData}, nc::Vector{Int64})
if length(nc) < length(data)
data = data[1:length(nc)]
end
truncate_data!.(data, nc) truncate_data!.(data, nc)
return nothing return nothing
end end
...@@ -624,6 +627,14 @@ end ...@@ -624,6 +627,14 @@ end
function truncate_data!(data::Vector{Vector{CData}}, nc::Vector{Int64}) function truncate_data!(data::Vector{Vector{CData}}, nc::Vector{Int64})
N = length(data) N = length(data)
R = length(data[1]) R = length(data[1])
L = length(nc)
if L < R
data = data[:][1:L]
end
R = length(data[1])
if R != L
error("Truncate config number not the same as data.")
end
for k = 1:N for k = 1:N
for r = 1:R for r = 1:R
data[k][r].vcfg = data[k][r].vcfg[1:nc[r]] data[k][r].vcfg = data[k][r].vcfg[1:nc[r]]
...@@ -1307,4 +1318,4 @@ function read_ens_csv(ens::EnsInfo) ...@@ -1307,4 +1318,4 @@ function read_ens_csv(ens::EnsInfo)
end end
return pp_sym, ap_sym, [pp_ll;pp_ls;pp_ss;pp_ll_2;pp_ls_2;pp_ss_2], [ap_ll;ap_ls;ap_ss;ap_ll_2;ap_ls_2;ap_ss_2] return pp_sym, ap_sym, [pp_ll;pp_ls;pp_ss;pp_ll_2;pp_ls_2;pp_ss_2], [ap_ll;ap_ls;ap_ss;ap_ll_2;ap_ls_2;ap_ss_2]
end end
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment