GithubHelp home page GithubHelp logo

DIVAnd.fit issue about divand.jl HOT 11 CLOSED

gher-uliege avatar gher-uliege commented on July 25, 2024
DIVAnd.fit issue

from divand.jl.

Comments (11)

ctroupin avatar ctroupin commented on July 25, 2024

hello, can you provide us with a minimum working example (i.e. subset of the dataset) and the commands you ran to get this issue?
Otherwise the error messages don't help too much in this case, I'm afraid.

from divand.jl.

fricour avatar fricour commented on July 25, 2024

Data : divand_github_issue.txt

Hello,

The subset is given in the attached txt file above (columns order : lon, lat, sigma (density) and depth).
If we create a matrix m with lon, lat, sigma and depth (size of 64800x4):

This command works : ~, len, ~,~,~ = DIVAnd.fit_isotropic((m[:,1],m[:,2]), m[:,3], collect(0:1:20), 100)
but this one does not ~, len, ~,~,~ = DIVAnd.fit((m[:,1],m[:,2]), m[:,3], collect(0:1:20), 100)

I also added the depth field in the text file because I was testing the function fithorzlen, which gives me an error as well. I used the following command :

lenz, dbinfo = DIVAnd.fithorzlen((m[:,1],m[:,2],m[:,4]), m[:,3], [50.,60,70]) where I used a variable z equal to [50.,60,70] (´z´ is not defined in the documentation, I had to go in one of the examples to see what it was related to anf got the following result:

┌ Warning: Be patient big data set: 64800

└ @ DIVAnd /home/flo/.julia/packages/DIVAnd/azb67/src/fit.jl:675
┌ Warning: Too few data. Will use guesses (np = 0, RLz = 1.811113649598692, )
└ @ DIVAnd /home/flo/.julia/packages/DIVAnd/azb67/src/fit.jl:894
┌ Info: Data points at z=50.0: 64800, horz. correlation length: 1.811113649598692
└ @ DIVAnd /home/flo/.julia/packages/DIVAnd/azb67/src/fit.jl:1061
┌ Warning: Be patient big data set: 64800
└ @ DIVAnd /home/flo/.julia/packages/DIVAnd/azb67/src/fit.jl:675
┌ Warning: Too few data. Will use guesses (np = 0, RLz = 1.811113649598692, )
└ @ DIVAnd /home/flo/.julia/packages/DIVAnd/azb67/src/fit.jl:894
┌ Info: Data points at z=60.0: 64800, horz. correlation length: 1.811113649598692
└ @ DIVAnd /home/flo/.julia/packages/DIVAnd/azb67/src/fit.jl:1061
┌ Warning: Be patient big data set: 64800
└ @ DIVAnd /home/flo/.julia/packages/DIVAnd/azb67/src/fit.jl:675
┌ Warning: Too few data. Will use guesses (np = 0, RLz = 1.811113649598692, )
└ @ DIVAnd /home/flo/.julia/packages/DIVAnd/azb67/src/fit.jl:894
┌ Info: Data points at z=70.0: 64800, horz. correlation length: 1.811113649598692
└ @ DIVAnd /home/flo/.julia/packages/DIVAnd/azb67/src/fit.jl:1061

All elements in A are equal to the fill-value. No filling is possible

Stacktrace:
[1] error(::String) at ./error.jl:33
[2] DIVAnd_fill!(::Array{Float64,1}, ::Float64) at /home/flo/.julia/packages/DIVAnd/azb67/src/DIVAnd_fill!.jl:84
[3] #fithorzlen#522(::Float64, ::Float64, ::Float64, ::Float64, ::Function, ::Function, ::getfield(DIVAnd, Symbol("##526#533")), ::Int64, ::Bool, ::Array{Float64,1}, ::typeof(fithorzlen), ::Tuple{Array{Float64,1},Array{Float64,1},Array{Float64,1}}, ::Array{Float64,1}, ::Array{Float64,1}) at /home/flo/.julia/packages/DIVAnd/azb67/src/fit.jl:1065
[4] fithorzlen(::Tuple{Array{Float64,1},Array{Float64,1},Array{Float64,1}}, ::Array{Float64,1}, ::Array{Float64,1}) at /home/flo/.julia/packages/DIVAnd/azb67/src/fit.jl:1022
[5] top-level scope at In[314]:1

Maybe I am using it all wrong but I am not sure ! I also fixed some bugs by updating julia from a version 1.0.x to 1.1.1 (e.g. DIVAndrun was not working on my laptop with julia version 1.0.x)

For information, all tests are OK when using Pkg.test("DIVAnd")

Thanks for your help!

from divand.jl.

ctroupin avatar ctroupin commented on July 25, 2024

Thanks for the files, that really help to try and reproduce the issue.

It seems the package NLopt is missing from the requirement list. While we are fixing this, you can add install NLopt if it is not yet there, then add the following line in DIVAnd.jl

using NLopt

then re-run the code with DIVAnd.fit(...). With your data I get len = [0.5, 0.5]

@Alexander-Barth : is it suffient to add NLopt in REQUIRE and using NLopt in DIVAnd.jl ?

from divand.jl.

fricour avatar fricour commented on July 25, 2024

Hello,

I installed NLopt and I did Pkg.update() in any case. I've rerun everything, have restarted the kernel, I still have the same issue.

from divand.jl.

ctroupin avatar ctroupin commented on July 25, 2024

And did you add using NLopt in DIVAnd.jl?

from divand.jl.

fricour avatar fricour commented on July 25, 2024

Yes of course !

from divand.jl.

Alexander-Barth avatar Alexander-Barth commented on July 25, 2024

The functionality of DIVAnd.fit and DIVAnd.fit_isotropic have been replaced by other functions. In future version DIVAnd.fit and DIVAnd.fit_isotropic will be removed. Can you use the other function (DIVAnd.fithorzlen and DIVAnd.fitvertlen ) instead?

from divand.jl.

fricour avatar fricour commented on July 25, 2024

I did. I also got an issue (see also previous messages).

The error I get with DIVAnd.fithorzlen is, when using lenz, dbinfo = DIVAnd.fithorzlen((m[:,1],m[:,2],m[:,4]), m[:,3], [50.,60,70])

┌ Warning: Be patient big data set: 64800
└ @ DIVAnd /home/flo/.julia/packages/DIVAnd/lgTG2/src/fit.jl:675
┌ Warning: Too few data. Will use guesses (np = 0, RLz = 1.811113649598692, )
└ @ DIVAnd /home/flo/.julia/packages/DIVAnd/lgTG2/src/fit.jl:894
┌ Info: Data points at z=50.0: 64800, horz. correlation length: 1.811113649598692
└ @ DIVAnd /home/flo/.julia/packages/DIVAnd/lgTG2/src/fit.jl:1061
┌ Warning: Be patient big data set: 64800
└ @ DIVAnd /home/flo/.julia/packages/DIVAnd/lgTG2/src/fit.jl:675
┌ Warning: Too few data. Will use guesses (np = 0, RLz = 1.811113649598692, )
└ @ DIVAnd /home/flo/.julia/packages/DIVAnd/lgTG2/src/fit.jl:894
┌ Info: Data points at z=60.0: 64800, horz. correlation length: 1.811113649598692
└ @ DIVAnd /home/flo/.julia/packages/DIVAnd/lgTG2/src/fit.jl:1061
┌ Warning: Be patient big data set: 64800
└ @ DIVAnd /home/flo/.julia/packages/DIVAnd/lgTG2/src/fit.jl:675
┌ Warning: Too few data. Will use guesses (np = 0, RLz = 1.811113649598692, )
└ @ DIVAnd /home/flo/.julia/packages/DIVAnd/lgTG2/src/fit.jl:894
┌ Info: Data points at z=70.0: 64800, horz. correlation length: 1.811113649598692
└ @ DIVAnd /home/flo/.julia/packages/DIVAnd/lgTG2/src/fit.jl:1061

All elements in A are equal to the fill-value. No filling is possible

Stacktrace:
[1] error(::String) at ./error.jl:33
[2] DIVAnd_fill!(::Array{Float64,1}, ::Float64) at /home/flo/.julia/packages/DIVAnd/lgTG2/src/DIVAnd_fill!.jl:84
[3] #fithorzlen#522(::Float64, ::Float64, ::Float64, ::Float64, ::Function, ::Function, ::getfield(DIVAnd, Symbol("##526#533")), ::Int64, ::Bool, ::Array{Float64,1}, ::typeof(fithorzlen), ::Tuple{Array{Float64,1},Array{Float64,1},Array{Float64,1}}, ::Array{Float64,1}, ::Array{Float64,1}) at /home/flo/.julia/packages/DIVAnd/lgTG2/src/fit.jl:1065
[4] fithorzlen(::Tuple{Array{Float64,1},Array{Float64,1},Array{Float64,1}}, ::Array{Float64,1}, ::Array{Float64,1}) at /home/flo/.julia/packages/DIVAnd/lgTG2/src/fit.jl:1022
[5] top-level scope at In[31]:1

There seems to be something with the function fit at line 1022 so if the same function fit gives the error with DIVAnd.fit, it is still present in DIVAnd.fithorzlen maybe?

from divand.jl.

Alexander-Barth avatar Alexander-Barth commented on July 25, 2024

When I remove the NaN values, it seems to work for me:

using DIVAnd, DelimitedFiles
m = readdlm("divand_github_issue.txt")
sel = findall(isfinite.(m[:,3]));
lenz, dbinfo = DIVAnd.fithorzlen((m[sel,1],m[sel,2],m[sel,4]), m[sel,3], [50.,60.,70.])
extrema(m[sel,4])
# returns 
# (61.11283874511719, 61.11283874511719)

Note that the depth level is are constant in this dataset.

And thanks, I added a description for the z parameter DIVAnd.fithorzlen.

from divand.jl.

fricour avatar fricour commented on July 25, 2024

Perfect, it now works ! The NaN values were the source of the issue then.

Thank you !

from divand.jl.

Alexander-Barth avatar Alexander-Barth commented on July 25, 2024

Thank you for your confirmation!

from divand.jl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.