-
Notifications
You must be signed in to change notification settings - Fork 14
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
[Help needed]How to create and use my bathymetry file? #131
Comments
hello, Also in the code there is an example of the output of
|
HI@ctroupin thanks for your information. According to file "gebco_30sec_16.nc", I edited my file with python NetCDF package, a new error occurred: DimensionMismatch("tried to assign 1556×1371 array to 1586×1371 destination")
Stacktrace:
[1] throw_setindex_mismatch(X::Matrix{Float32}, I::Tuple{Int64, Int64})
@ Base .\indices.jl:193
[2] setindex_shape_check
@ .\indices.jl:253 [inlined]
[3] _unsafe_setindex!(::IndexLinear, ::Matrix{Float64}, ::Matrix{Float32}, ::Base.Slice{Base.OneTo{Int64}}, ::Base.Slice{Base.OneTo{Int64}})
@ Base .\multidimensional.jl:902
[4] _setindex!
@ .\multidimensional.jl:893 [inlined]
[5] setindex!(::Matrix{Float64}, ::Matrix{Float32}, ::Function, ::Function)
@ Base .\abstractarray.jl:1267
[6] (::DIVAnd.var"#405#406"{String, Bool, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}}, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}}, Float64, Float64})(nc::NCDataset{Nothing})
@ DIVAnd C:\Users\Admin\.julia\packages\DIVAnd\MV3j9\src\load_mask.jl:99
[7] NCDataset(f::DIVAnd.var"#405#406"{String, Bool, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}}, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}}, Float64, Float64}, args::String; kwargs::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ NCDatasets C:\Users\Admin\.julia\packages\NCDatasets\fy34h\src\dataset.jl:255
[8] NCDataset
@ C:\Users\Admin\.julia\packages\NCDatasets\fy34h\src\dataset.jl:253 [inlined]
[9] extract_bath
@ C:\Users\Admin\.julia\packages\DIVAnd\MV3j9\src\load_mask.jl:58 [inlined]
[10] load_bath(bath_name::String, isglobal::Bool, xi::StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}}, yi::StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}})
@ DIVAnd C:\Users\Admin\.julia\packages\DIVAnd\MV3j9\src\load_mask.jl:120
[11] top-level scope
@ .\timing.jl:210 [inlined]
[12] top-level scope
@ .\In[15]:0 I upload my bathymetry file, Can you take a look? |
thanks, sure I will check with your file. |
I've run this code with your bathymetry: dx = dy = 0.125
lonr = 120:dx:125.
latr = 31.:dy:36.2
bx,by,b = DIVAnd.load_bath(datafile,false,lonr,latr) and it works without error, hence my question:
|
I don't know why, but it works with any dx value. thanks again for all your help. |
My Python code for editing a bathymetry file. |
Thanks, glad to know it now works. |
hi,
When using my bathymetry file, the following error occurred:
bx,by,b = load_bath(bathname,false,lonr,latr);
ArgumentError: range must be non-empty
Stacktrace:
[1] minimum(r::UnitRange{Int64})
@ Base .\range.jl:617
[2] (::DIVAnd.var"#405#406"{String, Bool, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}}, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}}, Float64, Float64})(nc::NCDataset{Nothing})
@ DIVAnd C:\Users\Admin.julia\packages\DIVAnd\MV3j9\src\load_mask.jl:98
[3] NCDataset(f::DIVAnd.var"#405#406"{String, Bool, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}}, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}}, Float64, Float64}, args::String; kwargs::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ NCDatasets C:\Users\Admin.julia\packages\NCDatasets\fy34h\src\dataset.jl:255
[4] NCDataset
@ C:\Users\Admin.julia\packages\NCDatasets\fy34h\src\dataset.jl:253 [inlined]
[5] extract_bath
@ C:\Users\Admin.julia\packages\DIVAnd\MV3j9\src\load_mask.jl:58 [inlined]
[6] load_bath(bath_name::String, isglobal::Bool, xi::StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}}, yi::StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}})
@ DIVAnd C:\Users\Admin.julia\packages\DIVAnd\MV3j9\src\load_mask.jl:120
[7] top-level scope
@ .\timing.jl:210 [inlined]
[8] top-level scope
@ .\In[72]:0
I created my bathymetry file using the ArcGIS tool 'Raster to NetCDF'.
How can I solve this problem?
What should be noted when I creat bathymetry NetCDF files?
The text was updated successfully, but these errors were encountered: