TEOS-10 / GibbsSeaWater.jl

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

Problems computing dynamic heigth anomaly #14

Closed amarux closed 1 year ago

amarux commented 4 years ago

Hi! Thank you for make GSW available for Julia.

I am trying to compute the dynamic height anomaly using the wrapper function gsw_geo_strf_dyn_height.
The data I am using to test is from the official toolbox reference. The steps I am using are as follow:

SA = [34.7118, 34.8915, 35.0256, 34.8472, 34.7366, 34.7324]
CT = [28.8099, 28.4392, 22.7862, 10.2262,  6.8272,  4.3236]
p =  [10, 50, 125, 250, 600, 1000]
p_ref = 1000.0

gsw_geo_strf_dyn_height.(SA, CT, p, p_ref)

This results in the following error:

ERROR: MethodError: no method matching gsw_geo_strf_dyn_height(::Float64, ::Float64, ::Float64, ::Float64)
Closest candidates are:
  gsw_geo_strf_dyn_height(::Any, ::Any, ::Any, ::Any, ::Any, ::Any)

I think I should provide two arguments more, but I was expecting that they were obtained by the wrapper based on the lines 10-11 in wrappers.jl. So, I am wondering what I missed in the use of the gsw_geo_strf_dyn_height wrapper function.

Thank you in advance

kouketsu commented 4 years ago

Please try the following.

SA = [34.7118, 34.8915, 35.0256, 34.8472, 34.7366, 34.7324]
CT = [28.8099, 28.4392, 22.7862, 10.2262,  6.8272,  4.3236]
p =  [10.0, 50, 125, 250, 600, 1000]
p_ref = 1000.0
dyn = zeros(length(SA)) # calculated dynamic hight anomaly 

gsw_geo_strf_dyn_height(SA, CT, p, p_ref, length(SA), dyn)
amarux commented 4 years ago

I tried the suggestion of @kouketsu, but the result is unexpected to me. I got the following:

Ptr{Float64} @0x00007f68088e24d0

I was expecting an Array with the same size of SA or CT. Maybe this data type can be transformed but this could be an issue with the wrappers.

kouketsu commented 4 years ago

Please check dyn which is what you want @amarux.

amarux commented 4 years ago

@kouketsu I did not understand the comment inside the code you suggested previouly! I am sorry

As you say the dyn variable has the result I want.

Thanks a lot!