Commit 56c389c5 authored by Volker Neff's avatar Volker Neff
Browse files

store variables with missing values

parent 21538563
Pipeline #11083 passed with stages
in 3 minutes and 17 seconds
......@@ -114,7 +114,7 @@ end
function loadMissingData!(data::VariableMissingDataType{1}, var::Variable)::VariableMissingDataType
tmp = similar(data, Float64)
streamReadVar(var.streamID, var.varID, tmp)
for i in CartesianIndices(data)
for i in OneTo(size(data))
data[i] = tmp[i] == var.missValue ? missing : tmp[i]
end
return data
......@@ -132,7 +132,29 @@ function storeData!(var::Variable, data::VariableDataType{1})
streamWriteVar(var.streamID, var.varID, data, 0)
return nothing
end
export storeData!
function storeMissingData!(var::Variable, data::VariableMissingDataType{N}) where {N}
@assert length(var) == length(data) "data has not correct size"
tmp = similar(data, Float64)
for i in CartesianIndices(data)
tmp[i] = ismissing(data[i]) ? var.missValue : data[i]
end
return storeData!(var, tmp)
end
function storeMissingData!(var::Variable, data::VariableMissingDataType{1})
@assert length(var) == length(data) "data has not correct size"
tmp = similar(data, Float64)
for i in OneTo(size(data))
tmp[i] = ismissing(data[i]) ? var.missValue : data[i]
end
return storeData!(var, tmp)
end
export storeData!, storeMissingData!
function Variable(name::AbstractString, grid::AbstractGrid, zAxis::AbstractZAxis,
time::TIME_t; unit::AbstractString="", stdName::AbstractString=name,
......
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