Commit 178afd4d authored by Volker Neff's avatar Volker Neff
Browse files

fix type problems

parent d8e56e6a
Pipeline #11045 passed with stages
in 3 minutes and 43 seconds
......@@ -82,8 +82,12 @@ function loadData(var::Variable)::VariableDataType
end
function loadMissingData(var::Variable)::VariableMissingDataType
data = Array{Float64}(undef, size(var)...)
return loadMissingData!(data, var)
data = loadData(var)
data = convert(VariableMissingDataType, data)
for i in CartesianIndices(data)
data[i] = data[i] == var.missValue ? missing : data[i]
end
return data
end
export loadData, loadMissingData
......@@ -99,19 +103,19 @@ end
export loadData!
function loadMissingData!(data::VariableMissingDataType{N}, var::Variable)::VariableMissingDataType where {N}
@. data[:, :, :] = 0.0
streamReadVar(var.streamID, var.varID, convert(Array{Float64}, reshape(data, :)))
tmp = similar(data)
streamReadVar(var.streamID, var.varID, reshape(tmp, :))
for i in CartesianIndices(data)
data[i] = data[i] == var.missValue ? missing : data[i]
data[i] = tmp[i] == var.missValue ? missing : tmp[i]
end
return data
end
function loadMissingData!(data::VariableMissingDataType{1}, var::Variable)::VariableMissingDataType
@. data[:, :, :] = 0.0
streamReadVar(var.streamID, var.varID, convert(Array{Float64}, data))
tmp = similar(data)
streamReadVar(var.streamID, var.varID, tmp)
for i in CartesianIndices(data)
data[i] = data[i] == var.missValue ? missing : data[i]
data[i] = tmp[i] == var.missValue ? missing : tmp[i]
end
return data
end
......
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