TEOS-10 / GibbsSeaWater.jl

Gibbs-SeaWater (GSW) Oceanographic Toolbox in Julia
http://www.teos-10.org
Other
23 stars 3 forks source link

potentially similar issue to nsquared and dynamic height? #16

Closed willcoxe closed 3 years ago

willcoxe commented 3 years ago

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 commented 3 years ago

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