Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

potentially similar issue to nsquared and dynamic height? #16

Closed
willcoxe opened this issue Jul 13, 2021 · 1 comment
Closed

potentially similar issue to nsquared and dynamic height? #16

willcoxe opened this issue Jul 13, 2021 · 1 comment

Comments

@willcoxe
Copy link

I think I am having the same issues as folks have had previously with nsquared and dynamic height, except with gsw_melting_seaice_into_seawater and gsw_melting_ice_into_seawater

I have updated to #master but I don't think there's a specific wrapper for either.
I have tried two approaches with the values provided in the TEOS-10 manual:

SA = [34.7118, 34.8915, 35.0256, 34.8472, 34.7366, 34.7324]
CT = [ 4.7856, 2.4329, 1.8103, 1.2600, 0.6886, 0.4403]
p = [ 10, 50, 125, 250, 600, 1000]
w_seaice = [0.0560, 0.02513, 0.02159, 0.01210, 0.00943,0.00751]
SA_seaice = [ 5, 4.8, 3.5, 2.5, 1, 0.4]
t_seaice = [-4.7856, -4.4329, -3.8103, -4.2600, -3.8863, -3.4036]

first approach

gsw_melting_seaice_into_seawater(SA,CT,p,w_seaice,SA_seaice,t_seaice)
ERROR: MethodError: no method matching gsw_melting_seaice_into_seawater(::Vector{Float64}, ::Vector{Float64}, ::Vector{Int64}, ::Vector{Float64}, ::Vector{Float64}, ::Vector{Float64})
Closest candidates are:
gsw_melting_seaice_into_seawater(::Any, ::Any, ::Any, ::Any, ::Any, ::Any, ::Any, ::Any) at .julia/packages/GibbsSeaWater/ilgJP/src/gen_gswteos10.jl:357

second approach

sa_final = zeros(length(SA))
ct_final = zeros(length(SA))
gsw_melting_seaice_into_seawater(SA,CT,p,w_seaice,SA_seaice,t_seaice, sa_final,ct_final)

Iam sure I am missing something obvious

ERROR: MethodError: Cannot convert an object of type Vector{Float64} to an object of type Float64
Closest candidates are:
convert(::Type{T}, ::T) where T<:Number at number.jl:6
convert(::Type{T}, ::Number) where T<:Number at number.jl:7
convert(::Type{T}, ::Base.TwicePrecision) where T<:Number at twiceprecision.jl:250
...
Stacktrace:
[1] cconvert(T::Type, x::Vector{Float64})
@ Base ./essentials.jl:396
[2] gsw_melting_seaice_into_seawater(sa::Vector{Float64}, ct::Vector{Float64}, p::Vector{Int64}, w_seaice::Vector{Float64}, sa_seaice::Vector{Float64}, t_seaice::Vector{Float64}, sa_final::Vector{Float64}, ct_final::Vector{Float64})
@ GibbsSeaWater ~/.julia/packages/GibbsSeaWater/ilgJP/src/gen_gswteos10.jl:358

Apologies if I have missed something obvious.
(The gsw_check_data.jl also comes back with NaNs)

Thanks in advance!

@willcoxe
Copy link
Author

I have created a for loop now since it works for single values. This is sufficient for my current needs.

l_x = []
l_y = []
x = zeros(length(sa))
y = zeros(length(sa))

for i in range(1,length=length(l_sa))
gsw_melting_seaice_into_seawater(l_sa[i],l_ct[i],l_p[i],l_w_seaice[i], l_sa_seaice[i], l_t_seaice[i], x, y)
push!(l_x,x[1])
push!(l_y,y[1])
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant