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

Problems computing dynamic heigth anomaly #14

Closed
amarux opened this issue Sep 1, 2020 · 4 comments
Closed

Problems computing dynamic heigth anomaly #14

amarux opened this issue Sep 1, 2020 · 4 comments

Comments

@amarux
Copy link

amarux commented Sep 1, 2020

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
Copy link
Collaborator

kouketsu commented Sep 3, 2020

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
Copy link
Author

amarux commented Sep 5, 2020

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
Copy link
Collaborator

kouketsu commented Sep 5, 2020

Please check dyn which is what you want @amarux.

@amarux
Copy link
Author

amarux commented Sep 5, 2020

@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!

@kouketsu kouketsu closed this as completed Nov 3, 2022
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

2 participants