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

Interpolation can fail when using a quite high resolution (compared to NetCDF File) #45

Closed
Alexander-Barth opened this issue Jun 25, 2019 · 1 comment

Comments

@Alexander-Barth
Copy link
Member

bathname = "../data/gebco_30sec_8.nc"
#bathname = "../data/gebco_30sec_4.nc"

if !isfile(bathname)
    @info("Download bathymetry")
    download("https://dox.ulg.ac.be/index.php/s/wS6Y8P8NhIF60eG/download", bathname)
    #download("https://dox.ulg.ac.be/index.php/s/RSwm4HPHImdZoQP/download", bathname)
else
    @info("Bathymetry file already downloaded")
end
bathisglobal = true;


dx = dy = 0.005
lonr = 19.45:dx:20.675
latr = 59.5:dy:59.9;

bx,by,b = load_bath(bathname,bathisglobal,lonr,latr)
@show size(b);
BoundsError: attempt to access 11×4 interpolate((19.399999999988694:0.13333333333332575:20.73333333332195,59.533333333340764:0.13333333333333997:59.933333333340784), ::Array{Float64,2}, Gridded(Interpolations.Linear())) with element type Float64 at index [19.45:0.005:20.675, 59.5:0.005:59.9]

Stacktrace:
 [1] throw_boundserror(::Interpolations.GriddedInterpolation{Float64,2,Float64,Interpolations.Gridded{Interpolations.Linear},Tuple{StepRangeLen{Float64,Base.TwicePrecision{Float64},Base.TwicePrecision{Float64}},StepRangeLen{Float64,Base.TwicePrecision{Float64},Base.TwicePrecision{Float64}}}}, ::Tuple{StepRangeLen{Float64,Base.TwicePrecision{Float64},Base.TwicePrecision{Float64}},StepRangeLen{Float64,Base.TwicePrecision{Float64},Base.TwicePrecision{Float64}}}) at ./abstractarray.jl:484
 [2] (::Interpolations.GriddedInterpolation{Float64,2,Float64,Interpolations.Gridded{Interpolations.Linear},Tuple{StepRangeLen{Float64,Base.TwicePrecision{Float64},Base.TwicePrecision{Float64}},StepRangeLen{Float64,Base.TwicePrecision{Float64},Base.TwicePrecision{Float64}}}})(::StepRangeLen{Float64,Base.TwicePrecision{Float64},Base.TwicePrecision{Float64}}, ::StepRangeLen{Float64,Base.TwicePrecision{Float64},Base.TwicePrecision{Float64}}) at /home/jovyan/.julia/packages/Interpolations/jXoPW/src/gridded/indexing.jl:75
 [3] load_bath(::String, ::Bool, ::StepRangeLen{Float64,Base.TwicePrecision{Float64},Base.TwicePrecision{Float64}}, ::StepRangeLen{Float64,Base.TwicePrecision{Float64},Base.TwicePrecision{Float64}}) at /home/jovyan/.julia/dev/DIVAnd/src/load_mask.jl:104
 [4] top-level scope at In[27]:1
@jmbeckers
Copy link
Member

should now be fixed in Alex branch. extract_bath adapted to make sure piece from netcdf covers the desired domain.

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