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

WorldOceanAtlas KeyError: key "file_name" not found #2

Closed
ctroupin opened this issue Sep 24, 2018 · 8 comments
Closed

WorldOceanAtlas KeyError: key "file_name" not found #2

ctroupin opened this issue Sep 24, 2018 · 8 comments

Comments

@ctroupin
Copy link
Member

Hello,

using the latest version of PhysOcean (all the tests passed) and Julia 1.0.0, I cannot test the WOD download.
Running:

WorldOceanDatabase.download(lonr,latr,timerange,varname,email,basedir);

returns UndefVarError: Dates not defined but this can be easily fixed by adding using Dates.
Then after recompiling and running the same code, I get:

KeyError: key "file_name" not found

Stacktrace:
 [1] getindex at ./dict.jl:478 [inlined]
 [2] download(::StepRangeLen{Float64,Base.TwicePrecision{Float64},Base.TwicePrecision{Float64}}, ::StepRangeLen{Float64,Base.TwicePrecision{Float64},Base.TwicePrecision{Float64}}, ::Array{Date,1}, ::String, ::String, ::String) at /home/ctroupin/.julia/packages/PhysOcean/Xi3Gc/src/WorldOceanDatabase.jl:227
 [3] top-level scope at In[3]:1
@Alexander-Barth
Copy link
Member

Do you have a file called out2.html ? I should contain a html input tag with the name file_name. Is this the case?

@ctroupin
Copy link
Member Author

Yes, out2.html is there, but no file_name in it. But ok, I think I know why, probably the data selection was empty (too small domain and period).
I check again.

@ctroupin
Copy link
Member Author

ok, with a larger domain it goes further, but now:

XBT is now available
PFL is now available
MRB is now available
...
MethodError: no method matching Array{String,1}(::Int64)
Closest candidates are:
  Array{String,1}() where T at boot.jl:413
  Array{String,1}(!Matched::UndefInitializer, !Matched::Int64) where T at boot.jl:394
  Array{String,1}(!Matched::UndefInitializer, !Matched::Int64...) where {T, N} at boot.jl:400
  ...

Stacktrace:
 [1] extract(::Array{String,1}, ::String) at /home/ctroupin/.julia/packages/PhysOcean/Xi3Gc/src/WorldOceanDatabase.jl:32
 [2] download(::StepRangeLen{Float64,Base.TwicePrecision{Float64},Base.TwicePrecision{Float64}}, ::StepRangeLen{Float64,Base.TwicePrecision{Float64},Base.TwicePrecision{Float64}}, ::Array{Date,1}, ::String, ::String, ::String) at /home/ctroupin/.julia/packages/PhysOcean/Xi3Gc/src/WorldOceanDatabase.jl:324
 [3] top-level scope at In[7]:1

the data from WOD are there (.tar.gz) but the extraction is not performed.

Alexander-Barth added a commit that referenced this issue Sep 24, 2018
@Alexander-Barth
Copy link
Member

Does it work now with the latest commit?

@ctroupin
Copy link
Member Author

Now I have:

UndefVarError: is_windows not defined
...

but I think it's solved by is_windows by Sys.iswindows().
The extraction now works but then

CTD is now available

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 50644  100 50644    0     0  32657      0  0:00:01  0:00:01 --:--:-- 32652
┌ Info: Extracting /home/ctroupin/Downloads/WOD/TestGhir5/CTD
└ @ PhysOcean.WorldOceanDatabase /home/ctroupin/.julia/packages/PhysOcean/OU0LA/src/WorldOceanDatabase.jl:41

MethodError: no method matching replace(::String, ::String, ::String)
Closest candidates are:
  replace(::String, !Matched::Pair{#s55,B} where B where #s55<:AbstractChar; count) at strings/util.jl:414
  replace(::String, !Matched::Pair{#s52,B} where B where #s52<:Union{Tuple{Vararg{AbstractChar,N} where N}, Set{#s49} where #s49<:AbstractChar, AbstractArray{#s50,1} where #s50<:AbstractChar}; count) at strings/util.jl:419
  replace(::String, !Matched::Pair; count) at strings/util.jl:423
  ...

Stacktrace:
 [1] (::getfield(PhysOcean.WorldOceanDatabase, Symbol("##1#2")){Array{String,1},Array{String,1}})(::Int64) at ./none:0
 [2] iterate at ./generator.jl:47 [inlined]
 [3] collect at ./array.jl:619 [inlined]
 [4] macro expansion at ./logging.jl:309 [inlined]
 [5] extract(::Array{String,1}, ::String) at /home/ctroupin/.julia/packages/PhysOcean/OU0LA/src/WorldOceanDatabase.jl:41
 [6] download(::StepRangeLen{Float64,Base.TwicePrecision{Float64},Base.TwicePrecision{Float64}}, ::StepRangeLen{Float64,Base.TwicePrecision{Float64},Base.TwicePrecision{Float64}}, ::Array{Date,1}, ::String, ::String, ::String) at /home/ctroupin/.julia/packages/PhysOcean/OU0LA/src/WorldOceanDatabase.jl:327
 [7] top-level scope at In[5]:1

@Alexander-Barth
Copy link
Member

Can you try to commit the changes? If you are in doubt what to change, you can also run the code under Julia 0.7. The depreciation warnings will guide you what the new syntax is. It would be good however, to keep the code compatible with Julia 0.6, 0.7 and 1.0. You might want to take a look in DIVAnd.jl for how you can keep the code compatible with the 3 versions.

@Alexander-Barth
Copy link
Member

This resource might be helpful:
https://docs.julialang.org/en/v0.7.0/NEWS/
https://github.com/JuliaLang/Compat.jl

Compat.jl is the equivalent of python six module allowing you to run more easily code under multiple Julia versions.

@ctroupin
Copy link
Member Author

ctroupin commented Sep 27, 2018

yes, would be better to keep it compatible with other versions, the Compat.jl doc is not very explicit to me
for example:

@compat ...compat syntax...

I don't see that in DIVAnd, but I'll try some shorter examples to see how it's supposed to work.

Edit: ok, think I got it, it now words with 1.0.0 and 0.6.4.

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