composite error
Closed this issue · 13 comments
Trying to composite but got the following error
julia> describe(dh.table)
8×7 DataFrame
Row │ variable mean min median max nmissing eltype
│ Symbol Union… Any Union… Any Int64 Type
─────┼─────────────────────────────────────────────────────────────────────────────────────────────
1 │ HOLEID OCR-RCH-030 OCR_DDH_007 0 String
2 │ FROM 12.4561 0.0 11.0 40.0 0 Float64
3 │ TO 13.6079 1.0 12.0 42.0 0 Float64
4 │ LENGTH 1.15185 0.5 1.0 3.0 0 Float64
5 │ EL1 10.8796 0.05 6.66 45.09 0 Union{Missing, Float64}
6 │ X 553062.0 552840.0 553060.0 553194.0 0 Float64
7 │ Y 9.50209e6 9.50204e6 9.50209e6 9.50222e6 0 Float64
8 │ Z 81.7177 55.9687 81.8838 100.54 0 Float64
julia> cmpst = composite(dh, interval=1.0, zone=:EL1, mode=:nodiscard)
ERROR: TypeError: in Type{...} expression, expected UnionAll, got Symbol
Stacktrace:
[1] composite(::DrillHoles.DrillHole; interval::Float64, zone::Symbol, mode::Symbol, mincomp::Float64, gap::Float64) at /home/andre/.julia/packages/DrillHoles/uLhpl/src/compositing.jl:58
[2] top-level scope at REPL[34]:1
when loading package I got an error on line 58 compositing.jl regarding : with an space prior to Union, I removed de space and the package loade but is this error related to that "fix".
Hi @Lanjal , we are refactoring the code in the cleanup
branch. If you install the package with ] add DrillHoles#cleanup
you will get the latest version I am using. However, we still didn't have time to cleanup the compositing part.
@rmcaixeta should be able to help you out with the version you're using now.
Sweet!
Thanks Julio.
BTW great work !
Hi @Lanjal . Thanks for sharing the issue. I took a quick look here, the part around ln 58 worked ok here even with more recent versions. Can you try these two scenarios to help me debug it, please?
- check if it works without zone definition: composite(dh, interval=1.0, mode=:nodiscard)
- try using EL1 as zone, but fill missing values with -99 prior to desurvey dh.
Hi Rafael, no look here
2 - there are no missing values in EL1
julia> describe(assay)
4×7 DataFrame
Row │ variable mean min median max nmissing eltype ⋯
│ Symbol Union… Any Union… Any Int64 DataType ⋯
─────┼──────────────────────────────────────────────────────────────────────────
1 │ HOLEID OCR-RCH-030 OCR_DDH_007 0 String ⋯
2 │ FROM 12.4561 0.0 11.0 40.0 0 Float64
3 │ TO 13.6079 1.0 12.0 42.0 0 Float64
4 │ EL1 10.8796 0.05 6.66 45.09 0 Float64
1 - Tried , same error
julia> cmpst = composite(dh, interval=1.0, mode=:nodiscard)
ERROR: TypeError: in Type{...} expression, expected UnionAll, got Symbol
Stacktrace:
[1] composite(::DrillHoles.DrillHole; interval::Float64, zone::Nothing, mode::Symbol, mincomp::Float64, gap::Float64) at /home/andre/.julia/packages/DrillHoles/uLhpl/src/compositing.jl:58
[2] top-level scope at REPL[29]:1
I will try all over again removing Julia and installing the packages again from zero to see it woks. I'll get back to you anyway to let you know.
Hm ok. If you can share the data, I can take a look in the weekend to help too
sounds perfect. I'm extracting the data form a database. It is local now but I will put on my server and send you the script when the data it is there.
Here is the script if you want to check what is happening
using LibPQ, DataFrames, DrillHoles, Plots,CSV
conn=LibPQ.Connection("host=162.55.126.129 dbname=geofoss user=droid password=devcor")
collar=DataFrame(execute(conn, "select c.bhid as "HOLEID", c.xcollar as "X", c.ycollar as "Y",c.zcollar as "Z",max(s._at) as "ENDDEPTH"from collar as c, survey as s where c.bhid=s.bhid group by c.bhid,c.xcollar,c.ycollar,c.zcollar"))
collar.HOLEID=convert(Vector{String}, collar.HOLEID)
collar.ENDDEPTH=convert(Vector{Float64}, collar.ENDDEPTH)
collar.X=convert(Vector{Float64}, collar.X)
collar.Y=convert(Vector{Float64}, collar.Y)
collar.Z=convert(Vector{Float64}, collar.Z)
collar
survey=DataFrame(execute(conn, "SELECT bhid as "HOLEID",_at as "AT",az as "AZM",dip*-1 as "DIP" FROM survey"))
survey.HOLEID=convert(Vector{String}, survey.HOLEID)
survey.AT=convert(Vector{Float64}, survey.AT)
survey.AZM=convert(Vector{Float64}, survey.AZM)
survey.DIP=convert(Vector{Float64}, survey.DIP)
survey
assay=DataFrame(execute(conn, "SELECT bhid as "HOLEID",_from as "FROM", _to as "TO",el1 as "EL1" FROM assay WHERE el1 IS NOT NULL"))
assay.HOLEID=convert(Vector{String}, assay.HOLEID)
assay.FROM=convert(Vector{Float64}, assay.FROM)
assay.TO=convert(Vector{Float64}, assay.TO)
assay.EL1=convert(Vector{Float64}, assay.EL1)
assay
collarIn = Collar(file=collar, holeid=:HOLEID, x=:X, y=:Y, z=:Z)
surveyIn = Survey(file=survey, holeid=:HOLEID, at=:AT, azm=:AZM, dip=:DIP)
assayIn = Interval(file=assay, holeid=:HOLEID, from=:FROM, to=:TO)
#Desurvey the drillhole data objects
dh = drillhole(collarIn, surveyIn, assayIn)
CSV.write("DESURVEYED.csv",dh.table)
describe(dh.table.LENGTH)
#THE FOLLOWING LINE GIVES ME THE ERROR MSG
cmpst = composite(dh, interval=1.0, zone=:EL1, mode=:nodiscard)
composited=dropmissing(cmpst.table)
CSV.write("COMPOSITED.csv", composited)
Reinstalled Julia and
---- After ] add "all the guys below" I got:
julia> using LibPQ, DataFrames, DrillHoles, Plots,CSV
[ Info: Precompiling LibPQ [194296ae-ab2e-5f79-8cd4-7183a0a5a0d1]
[ Info: Precompiling DataFrames [a93c6f00-e57d-5684-b7b6-d8193f3e46c0]
[ Info: Precompiling DrillHoles [9d36f3b5-8124-4f7e-bcda-df733105c718]
ERROR: LoadError: LoadError: syntax: space not allowed after ":" used for quoting
Stacktrace:
[1] top-level scope at /home/andre/.julia/packages/DrillHoles/uLhpl/src/compositing.jl:58
[2] include(::Module, ::String) at ./Base.jl:377
[3] include(::String) at /home/andre/.julia/packages/DrillHoles/uLhpl/src/DrillHoles.jl:5
[4] top-level scope at /home/andre/.julia/packages/DrillHoles/uLhpl/src/DrillHoles.jl:12
[5] include(::Module, ::String) at ./Base.jl:377
[6] top-level scope at none:2
[7] eval at ./boot.jl:331 [inlined]
[8] eval(::Expr) at ./client.jl:449
[9] top-level scope at ./none:3
in expression starting at /home/andre/.julia/packages/DrillHoles/uLhpl/src/compositing.jl:58
in expression starting at /home/andre/.julia/packages/DrillHoles/uLhpl/src/DrillHoles.jl:12
ERROR: Failed to precompile DrillHoles [9d36f3b5-8124-4f7e-bcda-df733105c718] to /home/andre/.julia/compiled/v1.4/DrillHoles/XEHc3_Jz11C.ji.
Stacktrace:
[1] error(::String) at ./error.jl:33
[2] compilecache(::Base.PkgId, ::String) at ./loading.jl:1272
[3] _require(::Base.PkgId) at ./loading.jl:1029
[4] require(::Base.PkgId) at ./loading.jl:927
[5] require(::Module, ::Symbol) at ./loading.jl:922
---I went to composite.jl and removed de space between : and Union on line 58
---it was
num = eltype.(eachcol(dh)) .<: Union{Missing, Number}
---I changed to
num = eltype.(eachcol(dh)) .<:Union{Missing,Number}
---Then compiled ok
julia> using LibPQ, DataFrames, DrillHoles, Plots,CSV
[ Info: Precompiling DrillHoles [9d36f3b5-8124-4f7e-bcda-df733105c718]
[ Info: Precompiling Plots [91a5bcdd-55d7-5caf-9e0b-520d859cae80]
----runing the code I got the error again
julia> cmpst = composite(dh, interval=1.0, zone=:EL1, mode=:nodiscard)
ERROR: TypeError: in Type{...} expression, expected UnionAll, got Symbol
Stacktrace:
[1] composite(::DrillHoles.DrillHole; interval::Float64, zone::Symbol, mode::Symbol, mincomp::Float64, gap::Float64) at /home/andre/.julia/packages/DrillHoles/uLhpl/src/compositing.jl:58
[2] top-level scope at REPL[57]:1
Hi Andre. Strange, I tested here both in Linux and Windows, and both worked well. Which version of julia you're using?
And if you could share too the output of this, please: ] status DrillHoles DataFrames
Good to hear that it is ok, has to be something with my machine here . Julia is 1.4.1 on a Ubuntu Fockall Fossa machine
(@v1.4) pkg> status DataFrames DrillHoles
Status ~/.julia/environments/v1.4/Project.toml
[a93c6f00] DataFrames v0.21.8
[9d36f3b5] DrillHoles v0.1.3
Just tested on a windows machine, guess what? IT WORKED
I forgot I had a windows machine here. It is something with mine old linux box. Sorry about that and thanks again for the help
Will do Julio! Thanks
Great, I'm closing this issue then.
I highly recommend julia 1.6 too! Abs