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

Examples in docs throw error #11

Closed
juliohm opened this issue Nov 9, 2017 · 5 comments
Closed

Examples in docs throw error #11

juliohm opened this issue Nov 9, 2017 · 5 comments

Comments

@juliohm
Copy link

juliohm commented Nov 9, 2017

GMT.jl v0.2.0
GMT v5.4.2-1

Ex 1

x = linspace(0, 2pi,180); seno = sin.(x/0.2)*45;
coast(region="g", proj="A300/30/6c", frame="g", resolution="c", land="navy")

plot!(collect(x)*60, seno, lw=0.5, lc="red", fmt="png", marker="circle",
      markeredgecolor=0, size=0.05, markerfacecolor="cyan", show=true)

UndefVarError: coast not defined

Ex 2

x,y,z=GMT.peaks()
G = gmt("surface -R-3/3/-3/3 -I0.1", [x[:] y[:] z[:]]);  # Iterpolate into a regular grid
grdcontour(G, frame="a", fmt="png", show=1)

Something went wrong when calling the module. GMT error number = 64

Ex 3

topo = makecpt(color="rainbow", range="1000/5000/500", continuous=true);
grdimage("@tut_relief.nc", shade="+ne0.8+a100", proj="M12c", frame="a", fmt="jpg",
         color=topo)
scale!(position="jTC+w5i/0.25i+h+o0/-1i", region="@tut_relief.nc", color=topo,
       frame="y+lm", fmt="jpg", show=1)

function scale! does not accept keyword arguments

Ex 4

imshow("http:https://larryfire.files.wordpress.com/2009/07/untooned_jessicarabbit.jpg",
      frame="g", region="d", proj="I15c", image_in="r", show=false)
coast!(shore="1,white", resolution="c", fmt="png", show=true)

UndefVarError: coast! not defined
@joa-quim
Copy link
Member

joa-quim commented Nov 9, 2017

Sorry, took me a bit but I see now were I screwed up. I did a last minute change in the module names to anticipate what will happen in GMT6. Because we are dropping the strong connection to PostScript module names like gmt pscoast will drop the ps part and will be called with gmt coast. But this is still GMT, not GMT.jl. But to not having to rename them later in GMT.jl I started to use already coast instead of pscoast. Now the part that I screwed is that in the src/GMT.jl file when I tagged the 0.2 version it was still exporting functions with old names, e.g. pscoast. I will have to tag a new version with fixes. There are more things that need to fixed in the examples codes (for example the contour examples need specific assigning the contour interval because the automatic one only works with the GMT6 (trunk version).
Meanwhile, if you do a Pkg.checkout("GMT") and next edit src/GMT.jl and put back const GMTver = 5.0 than it work, but I still need to fix the grdcontour and the scale commands.

@joa-quim
Copy link
Member

joa-quim commented Nov 9, 2017

Or simply, for the moment, do qualified call. I.e. GMT.coast

@juliohm
Copy link
Author

juliohm commented Nov 9, 2017

I am on the master branch now, the qualified call is throwing a different error:

x = linspace(0, 2pi,180); seno = sin.(x/0.2)*45;
GMT.coast(region="g", proj="A300/30/6c", frame="g", resolution="c", land="navy")

plot!(collect(x)*60, seno, lw=0.5, lc="red", fmt="png", marker="circle",
      markeredgecolor=0, size=0.05, markerfacecolor="cyan", show=true)

type GMT_TEXTSET has no field n_rows

Stacktrace:
 [1] dataset_init(::Ptr{Void}, ::Bool, ::Array{Float64,2}, ::UInt32, ::Array{Int64,1}) at /home/juliohm/.julia/v0.6/GMT/src/gmt_main.jl:1367
 [2] dataset_init_(::Ptr{Void}, ::Bool, ::Array{Float64,2}, ::UInt32, ::Array{Int64,1}) at /home/juliohm/.julia/v0.6/GMT/src/gmt_main.jl:1261
 [3] GMTJL_Set_Object(::Ptr{Void}, ::GMT.GMT_RESOURCE, ::Array{Float64,2}) at /home/juliohm/.julia/v0.6/GMT/src/gmt_main.jl:939
 [4] gmt(::String, ::Array{Float64,2}, ::Vararg{Array{Float64,2},N} where N) at /home/juliohm/.julia/v0.6/GMT/src/gmt_main.jl:268
 [5] finish_PS_module(::Dict{Symbol,Any}, ::Array{String,1}, ::String, ::Array{Float64,2}, ::Array{Any,1}, ::Int64, ::String, ::String, ::String, ::Bool, ::String) at /home/juliohm/.julia/v0.6/GMT/src/common_options.jl:814
 [6] #xy#84(::String, ::Array{Any,1}, ::String, ::Bool, ::Bool, ::Bool, ::Array{Any,1}, ::Function, ::String, ::Array{Float64,2}) at /home/juliohm/.julia/v0.6/GMT/src/psxy.jl:223
 [7] (::GMT.#kw##xy)(::Array{Any,1}, ::GMT.#xy, ::String, ::Array{Float64,2}) at ./<missing>:0
 [8] #plot!#93(::String, ::Array{Any,1}, ::String, ::Bool, ::Bool, ::Bool, ::Array{Any,1}, ::Function, ::Array{Float64,1}, ::Array{Float64,1}) at /home/juliohm/.julia/v0.6/GMT/src/plot.jl:108
 [9] (::GMT.#kw##plot!)(::Array{Any,1}, ::GMT.#plot!, ::Array{Float64,1}, ::Array{Float64,1}) at ./<missing>:0
 [10] include_string(::String, ::String) at ./loading.jl:515

@joa-quim
Copy link
Member

joa-quim commented Nov 9, 2017

That's because master uses GMT dev (trunk) version. You have to do like I said. Edit the src/GMT.jl file and put back const GMTver = 5.0
I have submitted a PR to a new tag but things are now taking a bit to resolve and furthermore the Julia test script is failing wit a false accusation so I anticipate a further delay in that PR getting merged.

I'll try to address some of your other questions but I'll have leave in a while for dinning out.

@joa-quim
Copy link
Member

This should be solved with the new 0.3.0 tag

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