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

generate_atmos_dataset.jl bug #259

Closed
waywardpidgeon opened this issue Nov 18, 2024 · 4 comments
Closed

generate_atmos_dataset.jl bug #259

waywardpidgeon opened this issue Nov 18, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@waywardpidgeon
Copy link

suggestion: edit the line

to be

time_indices=Colon()
julia> versioninfo()
Julia Version 1.10.5
Commit 6f3fdf7b36 (2024-08-27 14:19 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: 24 × 13th Gen Intel(R) Core(TM) i7-13700F
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-15.0.7 (ORCJIT, goldmont)
Threads: 1 default, 0 interactive, 1 GC (on 24 virtual cores)

Error:

time_indices=1:1
qt = ClimaOcean.JRA55.JRA55_field_time_series(:specific_humidity; time_indices)
ERROR: BoundsError: attempt to access 1-element StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64} at index [0]
@simone-silvestri
Copy link
Collaborator

Hi @waywardpidgeon, the problem with JRA55_field_time_series is that we need at least two indices to interpolate the atmos state in time. We can probably spit out an error message if trying to load a fieldtimeseries with only one index. Or we can fix the codebase to allow loading just one index. What is the trace of this error?

@glwagner glwagner added the bug Something isn't working label Nov 21, 2024
@waywardpidgeon
Copy link
Author

I tried it again and found a bug in the Bathymetry.jl code I had sent recently for #179 (I will add a comment to that issue)

I ran the example generate_atmos_dataset.jl this morning and the error did not appear.

What do you mean by "trace of this error"?
Thanks.

@glwagner
Copy link
Member

What do you mean by "trace of this error"?

When some code errors, it will display the error message at the top, followed by a "stacktrace" that shows the chain of functions that was called to produce the error. For example:

julia> f(x) = sin* x)
f (generic function with 1 method)

julia> f("hi")
ERROR: MethodError: no method matching *(::Irrational{:π}, ::String)

Closest candidates are:
  *(::Any, ::Any, ::Any, ::Any...)
   @ Base operators.jl:587
  *(::Real, ::Complex{Bool})
   @ Base complex.jl:327
  *(::ChainRulesCore.NotImplemented, ::Any)
   @ ChainRulesCore ~/.julia/packages/ChainRulesCore/6Pucz/src/tangent_arithmetic.jl:37
  ...

Stacktrace:
 [1] f(x::String)
   @ Main ./REPL[101]:1
 [2] top-level scope
   @ REPL[103]:1

Notice the bottom of the error message with the label "Stacktrace:". Try typing this code into the Julia REPL to get the same message.

@waywardpidgeon
Copy link
Author

Oh indeed trace=stacktrace.
I am closing this issue since the bug has now been fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants