diff --git a/.gitignore b/.gitignore index ed02b30..1face5b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,4 @@ *.jl.cov *.jl.*.cov *.jl.mem -*.DS_Store -.DS_Store -.DS_Store - .DS_Store diff --git a/.travis.yml b/.travis.yml index 42c6332..566776d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,4 +11,4 @@ notifications: # uncomment the following lines to override the default test script #script: # - if [[ -a .git/shallow ]]; then git fetch --unshallow; fi -# - julia -e 'Pkg.clone(pwd()); Pkg.build("MacroEcology"); Pkg.test("MacroEcology"; coverage=true)' +# - julia -e 'Pkg.clone(pwd()); Pkg.build("SpatialEcology"); Pkg.test("SpatialEcology"; coverage=true)' diff --git a/LICENSE.md b/LICENSE.md index 4ed9e80..d2c10da 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,4 +1,4 @@ -The MacroEcology.jl package is licensed under the MIT "Expat" License: +The SpatialEcology.jl package is licensed under the MIT "Expat" License: > Copyright (c) 2016: Michael K. Borregaard. > diff --git a/REQUIRE b/REQUIRE index aa74eac..16f8249 100644 --- a/REQUIRE +++ b/REQUIRE @@ -4,4 +4,5 @@ RecipesBase NamedArrays Shapefile DataFrames -Bio +Reexport +#Bio diff --git a/appveyor.yml b/appveyor.yml index f802535..8dbe879 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -28,7 +28,7 @@ build_script: # Need to convert from shallow to complete for Pkg.clone to work - IF EXIST .git\shallow (git fetch --unshallow) - C:\projects\julia\bin\julia -e "versioninfo(); - Pkg.clone(pwd(), \"MacroEcology\"); Pkg.build(\"MacroEcology\")" + Pkg.clone(pwd(), \"SpatialEcology\"); Pkg.build(\"SpatialEcology\")" test_script: - - C:\projects\julia\bin\julia --check-bounds=yes -e "Pkg.test(\"MacroEcology\")" + - C:\projects\julia\bin\julia --check-bounds=yes -e "Pkg.test(\"SpatialEcology\")" diff --git a/doc/.ipynb_checkpoints/Testing SpatialEcology plotting-checkpoint.ipynb b/doc/.ipynb_checkpoints/Testing SpatialEcology plotting-checkpoint.ipynb new file mode 100644 index 0000000..ee02c12 --- /dev/null +++ b/doc/.ipynb_checkpoints/Testing SpatialEcology plotting-checkpoint.ipynb @@ -0,0 +1,424 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 31, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "text/plain": [] + }, + "execution_count": 31, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "using SpatialEcology\n", + "using JLD\n", + "mam = load(\"/Users/michael/.julia/v0.5/SpatialEcology/mamob.jld\", \"mam\")" + ] + }, + { + "cell_type": "code", + "execution_count": 32, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Assemblage with 981872 records of 5162 species in 17535 sites\n", + "\n", + "Species names:\n", + "Abditomys_latidens, Abeomelomys_sevia, Abrawayaomys_ruschii...Zyzomys_pedunculatus, Zyzomys_woodwardi\n", + "\n", + "Site names:\n", + "1, 2, 3...17534, 17535\n" + ] + }, + { + "data": { + "text/plain": [ + "Plots.PlotlyJSBackend()" + ] + }, + "execution_count": 32, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "using Plots; plotlyjs()" + ] + }, + { + "cell_type": "code", + "execution_count": 33, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "WARNING: Method definition convert_to_image(AbstractArray{T<:Any, 1}, SpatialEcology.Assemblage{#G<:Any, #T<:Any}) in module Main at In[28]:3 overwritten at In[33]:3.\n", + "WARNING: Method definition convert_to_image(AbstractArray{T<:Any, 1}, Any) in module Main at In[28]:6 overwritten at In[33]:6.\n" + ] + }, + { + "data": { + "text/plain": [ + "convert_to_image (generic function with 2 methods)" + ] + }, + "execution_count": 33, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# Make this a type recipe\n", + "\n", + "convert_to_image{G <: Any, T <: Any}(var::AbstractVector, asm::Assemblage{G, T}) = convert_to_image(var, asm.site)\n", + "\n", + "function convert_to_image(var::AbstractVector, grd)\n", + " x = Matrix{Float64}(reverse(cells(grd))...)\n", + " fill!(x, NaN)\n", + " xind, yind = grd.indices[:,1], grd.indices[:,2] #since matrices are probably drawn from upper left corner\n", + " [x[yind[i], xind[i]] = val for (i, val) in enumerate(var)]\n", + " x\n", + "end \n" + ] + }, + { + "cell_type": "code", + "execution_count": 34, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "text/html": [ + "\n", + "\n", + " \n", + "\n", + "\n", + "
\n", + "\n", + "\n", + "\n", + "\n", + "\n" + ] + }, + "execution_count": 34, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "x = convert_to_image(richness(mam), mam.site)\n", + "col = cgrad(reverse(cgrad(:heat).colors))\n", + "heatmap(x, aspect_ratio = :equal, grid = false, color = col) #so far only works in plotlyjs()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": 47, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "text/plain": [ + "Plots.GLVisualizeBackend()" + ] + }, + "execution_count": 47, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "glvisualize()" + ] + }, + { + "cell_type": "code", + "execution_count": 48, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "ename": "LoadError", + "evalue": "LoadError: UndefVarError: get_screens not defined\nwhile loading In[48], in expression starting on line 1", + "output_type": "error", + "traceback": [ + "LoadError: UndefVarError: get_screens not defined\nwhile loading In[48], in expression starting on line 1", + "", + " in _create_backend_figure(::Plots.Plot{Plots.GLVisualizeBackend}) at /Users/michael/.julia/v0.5/Plots/src/backends/glvisualize.jl:130", + " in _plot_setup(::Plots.Plot{Plots.GLVisualizeBackend}, ::Dict{Symbol,Any}, ::Array{Dict{Symbol,Any},1}) at /Users/michael/.julia/v0.5/Plots/src/pipeline.jl:216", + " in _plot!(::Plots.Plot{Plots.GLVisualizeBackend}, ::Dict{Symbol,Any}, ::Tuple{Array{Float64,2}}) at /Users/michael/.julia/v0.5/Plots/src/plot.jl:184", + " in (::Plots.#kw##plot)(::Array{Any,1}, ::Plots.#plot, ::Array{Float64,2}) at ./:0", + " in #heatmap#346(::Array{Any,1}, ::Function, ::Array{Float64,2}, ::Vararg{Array{Float64,2},N}) at /Users/michael/.julia/v0.5/Plots/src/Plots.jl:152", + " in heatmap(::Array{Float64,2}, ::Vararg{Array{Float64,2},N}) at /Users/michael/.julia/v0.5/Plots/src/Plots.jl:152" + ] + } + ], + "source": [ + "heatmap(x) " + ] + }, + { + "cell_type": "code", + "execution_count": 46, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "using Plots" + ] + }, + { + "cell_type": "code", + "execution_count": 49, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "ename": "LoadError", + "evalue": "LoadError: UndefVarError: get_screens not defined\nwhile loading In[49], in expression starting on line 1", + "output_type": "error", + "traceback": [ + "LoadError: UndefVarError: get_screens not defined\nwhile loading In[49], in expression starting on line 1", + "", + " in _create_backend_figure(::Plots.Plot{Plots.GLVisualizeBackend}) at /Users/michael/.julia/v0.5/Plots/src/backends/glvisualize.jl:130", + " in _plot_setup(::Plots.Plot{Plots.GLVisualizeBackend}, ::Dict{Symbol,Any}, ::Array{Dict{Symbol,Any},1}) at /Users/michael/.julia/v0.5/Plots/src/pipeline.jl:216", + " in _plot!(::Plots.Plot{Plots.GLVisualizeBackend}, ::Dict{Symbol,Any}, ::Tuple{UnitRange{Int64},Array{Float64,1}}) at /Users/michael/.julia/v0.5/Plots/src/plot.jl:184", + " in #plot#244(::Array{Any,1}, ::Function, ::UnitRange{Int64}, ::Vararg{Any,N}) at /Users/michael/.julia/v0.5/Plots/src/plot.jl:52", + " in plot(::UnitRange{Int64}, ::Array{Float64,1}, ::Vararg{Array{Float64,1},N}) at /Users/michael/.julia/v0.5/Plots/src/plot.jl:46" + ] + } + ], + "source": [ + "plot(1:10, rand(10))" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "using DataFrames\n", + "mam = readtable(\"/Users/michael/Google Drev/Mountain project/New Polygons/Species grid distributions/mammals_PA_matrix.csv\")\n", + "mam[3] = map(x->\"$x\", mam[3])\n", + "\n", + "\n", + "mama = SpatialEcology.Assemblage(mam)\n", + "## Problems with saving" + ] + }, + { + "cell_type": "code", + "execution_count": 30, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "using JLD\n", + "\n", + "jldopen(\"/Users/michael/.julia/v0.5/SpatialEcology/mamob.jld\", \"w\") do file\n", + " addrequire(file, SpatialEcology)\n", + " write(file, \"mam\", mama)\n", + "end" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "text/plain": [ + "SpatialEcology.Assemblage{SpatialEcology.GridData,Bool}" + ] + }, + "execution_count": 20, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "typeof(mama)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + } + ], + "metadata": { + "anaconda-cloud": {}, + "kernelspec": { + "display_name": "Julia 0.5.0", + "language": "julia", + "name": "julia-0.5" + }, + "language_info": { + "file_extension": ".jl", + "mimetype": "application/julia", + "name": "julia", + "version": "0.5.0" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/doc/Testing SpatialEcology plotting.ipynb b/doc/Testing SpatialEcology plotting.ipynb index 1fa77fc..ee02c12 100644 --- a/doc/Testing SpatialEcology plotting.ipynb +++ b/doc/Testing SpatialEcology plotting.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": 31, "metadata": { "collapsed": false }, @@ -11,170 +11,24 @@ "data": { "text/plain": [] }, - "execution_count": 1, + "execution_count": 31, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "using MacroEcology\n", + "using SpatialEcology\n", "using JLD\n", - "mam = load(\"/Users/michael/.julia/v0.5/MacroEcology.jl/mamobj.jld\", \"mam\")" + "mam = load(\"/Users/michael/.julia/v0.5/SpatialEcology/mamob.jld\", \"mam\")" ] }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 32, "metadata": { "collapsed": false }, "outputs": [ - { - "data": { - "text/html": [ - "\n", - "\n", - " \n", - "

Plotly javascript loaded.

\n", - "

To load again call

init_notebook(true)

\n", - " " - ] - }, - "metadata": {}, - "output_type": "display_data" - }, { "name": "stdout", "output_type": "stream", @@ -188,20 +42,13 @@ "1, 2, 3...17534, 17535\n" ] }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "WARNING: Method definition require(Symbol) in module Base at loading.jl:345 overwritten in module Plots at /Users/michael/.julia/v0.5/Requires/src/require.jl:12.\n" - ] - }, { "data": { "text/plain": [ "Plots.PlotlyJSBackend()" ] }, - "execution_count": 2, + "execution_count": 32, "metadata": {}, "output_type": "execute_result" } @@ -212,18 +59,26 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 33, "metadata": { "collapsed": false }, "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "WARNING: Method definition convert_to_image(AbstractArray{T<:Any, 1}, SpatialEcology.Assemblage{#G<:Any, #T<:Any}) in module Main at In[28]:3 overwritten at In[33]:3.\n", + "WARNING: Method definition convert_to_image(AbstractArray{T<:Any, 1}, Any) in module Main at In[28]:6 overwritten at In[33]:6.\n" + ] + }, { "data": { "text/plain": [ "convert_to_image (generic function with 2 methods)" ] }, - "execution_count": 3, + "execution_count": 33, "metadata": {}, "output_type": "execute_result" } @@ -244,7 +99,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 34, "metadata": { "collapsed": false }, @@ -257,12 +112,12 @@ " \n", "\n", "\n", - "
\n", + "
\n", "\n", "\n", @@ -271,7 +126,7 @@ "\n" ] }, - "execution_count": 6, + "execution_count": 34, "metadata": {}, "output_type": "execute_result" } @@ -286,181 +141,96 @@ "cell_type": "code", "execution_count": null, "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true + "collapsed": false }, "outputs": [], "source": [] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 47, "metadata": { - "collapsed": true + "collapsed": false }, - "outputs": [], - "source": [] + "outputs": [ + { + "data": { + "text/plain": [ + "Plots.GLVisualizeBackend()" + ] + }, + "execution_count": 47, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "glvisualize()" + ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 48, "metadata": { - "collapsed": true + "collapsed": false }, - "outputs": [], - "source": [] + "outputs": [ + { + "ename": "LoadError", + "evalue": "LoadError: UndefVarError: get_screens not defined\nwhile loading In[48], in expression starting on line 1", + "output_type": "error", + "traceback": [ + "LoadError: UndefVarError: get_screens not defined\nwhile loading In[48], in expression starting on line 1", + "", + " in _create_backend_figure(::Plots.Plot{Plots.GLVisualizeBackend}) at /Users/michael/.julia/v0.5/Plots/src/backends/glvisualize.jl:130", + " in _plot_setup(::Plots.Plot{Plots.GLVisualizeBackend}, ::Dict{Symbol,Any}, ::Array{Dict{Symbol,Any},1}) at /Users/michael/.julia/v0.5/Plots/src/pipeline.jl:216", + " in _plot!(::Plots.Plot{Plots.GLVisualizeBackend}, ::Dict{Symbol,Any}, ::Tuple{Array{Float64,2}}) at /Users/michael/.julia/v0.5/Plots/src/plot.jl:184", + " in (::Plots.#kw##plot)(::Array{Any,1}, ::Plots.#plot, ::Array{Float64,2}) at ./:0", + " in #heatmap#346(::Array{Any,1}, ::Function, ::Array{Float64,2}, ::Vararg{Array{Float64,2},N}) at /Users/michael/.julia/v0.5/Plots/src/Plots.jl:152", + " in heatmap(::Array{Float64,2}, ::Vararg{Array{Float64,2},N}) at /Users/michael/.julia/v0.5/Plots/src/Plots.jl:152" + ] + } + ], + "source": [ + "heatmap(x) " + ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 46, "metadata": { - "collapsed": true + "collapsed": false }, "outputs": [], - "source": [] + "source": [ + "using Plots" + ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 49, "metadata": { - "collapsed": true + "collapsed": false }, - "outputs": [], - "source": [] + "outputs": [ + { + "ename": "LoadError", + "evalue": "LoadError: UndefVarError: get_screens not defined\nwhile loading In[49], in expression starting on line 1", + "output_type": "error", + "traceback": [ + "LoadError: UndefVarError: get_screens not defined\nwhile loading In[49], in expression starting on line 1", + "", + " in _create_backend_figure(::Plots.Plot{Plots.GLVisualizeBackend}) at /Users/michael/.julia/v0.5/Plots/src/backends/glvisualize.jl:130", + " in _plot_setup(::Plots.Plot{Plots.GLVisualizeBackend}, ::Dict{Symbol,Any}, ::Array{Dict{Symbol,Any},1}) at /Users/michael/.julia/v0.5/Plots/src/pipeline.jl:216", + " in _plot!(::Plots.Plot{Plots.GLVisualizeBackend}, ::Dict{Symbol,Any}, ::Tuple{UnitRange{Int64},Array{Float64,1}}) at /Users/michael/.julia/v0.5/Plots/src/plot.jl:184", + " in #plot#244(::Array{Any,1}, ::Function, ::UnitRange{Int64}, ::Vararg{Any,N}) at /Users/michael/.julia/v0.5/Plots/src/plot.jl:52", + " in plot(::UnitRange{Int64}, ::Array{Float64,1}, ::Vararg{Array{Float64,1},N}) at /Users/michael/.julia/v0.5/Plots/src/plot.jl:46" + ] + } + ], + "source": [ + "plot(1:10, rand(10))" + ] }, { "cell_type": "code", @@ -577,2152 +347,52 @@ "collapsed": true }, "outputs": [], - "source": [] + "source": [ + "using DataFrames\n", + "mam = readtable(\"/Users/michael/Google Drev/Mountain project/New Polygons/Species grid distributions/mammals_PA_matrix.csv\")\n", + "mam[3] = map(x->\"$x\", mam[3])\n", + "\n", + "\n", + "mama = SpatialEcology.Assemblage(mam)\n", + "## Problems with saving" + ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 30, "metadata": { - "collapsed": true + "collapsed": false }, "outputs": [], - "source": [] + "source": [ + "using JLD\n", + "\n", + "jldopen(\"/Users/michael/.julia/v0.5/SpatialEcology/mamob.jld\", \"w\") do file\n", + " addrequire(file, SpatialEcology)\n", + " write(file, \"mam\", mama)\n", + "end" + ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 20, "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": 13, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "INFO: Precompiling module Grid.\n" - ] - } - ], - "source": [ - "using Grid" - ] - }, - { - "cell_type": "code", - "execution_count": 18, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "data": { - "text/plain": [ - "17535×2 Named Array{Float64,2}\n", - "A ╲ B │ Long Lat\n", - "──────┼─────────────\n", - "52310 │ -70.5 -55.5\n", - "52311 │ -69.5 -55.5\n", - "52312 │ -68.5 -55.5\n", - "52313 │ -67.5 -55.5\n", - "51948 │ -72.5 -54.5\n", - "51949 │ -71.5 -54.5\n", - "51950 │ -70.5 -54.5\n", - "51951 │ -69.5 -54.5\n", - "51952 │ -68.5 -54.5\n", - "51953 │ -67.5 -54.5\n", - "51954 │ -66.5 -54.5\n", - "51955 │ -65.5 -54.5\n", - "⋮ ⋮ ⋮\n", - "2304 │ -36.5 83.5\n", - "2305 │ -35.5 83.5\n", - "2306 │ -34.5 83.5\n", - "2307 │ -33.5 83.5\n", - "2308 │ -32.5 83.5\n", - "2309 │ -31.5 83.5\n", - "2310 │ -30.5 83.5\n", - "2311 │ -29.5 83.5\n", - "2312 │ -28.5 83.5\n", - "2313 │ -27.5 83.5\n", - "2314 │ -26.5 83.5\n", - "2315 │ -25.5 83.5" - ] - }, - "execution_count": 18, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "cd = MacroEcology.coords(mam)" - ] - }, - { - "cell_type": "code", - "execution_count": 24, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "data": { - "text/plain": [ - "17535-element Grid.InterpGrid{Float64,1,Grid.BCnil,Grid.InterpLinear}:\n", - " -55.5\n", - " -55.5\n", - " -55.5\n", - " -55.5\n", - " -54.5\n", - " -54.5\n", - " -54.5\n", - " -54.5\n", - " -54.5\n", - " -54.5\n", - " -54.5\n", - " -54.5\n", - " -54.5\n", - " ⋮ \n", - " 83.5\n", - " 83.5\n", - " 83.5\n", - " 83.5\n", - " 83.5\n", - " 83.5\n", - " 83.5\n", - " 83.5\n", - " 83.5\n", - " 83.5\n", - " 83.5\n", - " 83.5" - ] - }, - "execution_count": 24, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "testlong = InterpGrid(Vector(cd[:,\"Long\"]),BCnil, InterpLinear)\n", - "testlat = InterpGrid(Vector(cd[:,\"Lat\"]),BCnil, InterpLinear)" - ] - }, - { - "cell_type": "code", - "execution_count": 25, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "data": { - "text/html": [ - "" - ] - }, - "execution_count": 25, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "scatter(cd[:,\"Long\"], testlong)" - ] - }, - { - "cell_type": "code", - "execution_count": 41, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "ename": "LoadError", - "evalue": "LoadError: DimensionMismatch(\"Coordinate lengths do not match grid size.\")\nwhile loading In[41], in expression starting on line 2", - "output_type": "error", - "traceback": [ - "LoadError: DimensionMismatch(\"Coordinate lengths do not match grid size.\")\nwhile loading In[41], in expression starting on line 2", - "", - " in Grid.CoordInterpGrid{Float64,1,Grid.BCnil,Grid.InterpLinear,Tuple{FloatRange{Float64}}}(::Tuple{FloatRange{Float64}}, ::Grid.InterpGrid{Float64,1,Grid.BCnil,Grid.InterpLinear}) at /Users/michael/.julia/v0.5/Grid/src/coord.jl:7", - " in Grid.CoordInterpGrid{T<:AbstractFloat,N,BC<:Grid.BoundaryCondition,IT<:Grid.InterpType,R}(::Tuple{FloatRange{Float64}}, ::Grid.InterpGrid{Float64,1,Grid.BCnil,Grid.InterpLinear}) at /Users/michael/.julia/v0.5/Grid/src/coord.jl:13", - " in Grid.CoordInterpGrid{T<:AbstractFloat,N,BC<:Grid.BoundaryCondition,IT<:Grid.InterpType,R}(::FloatRange{Float64}, ::Array{Float64,1}, ::Type{T}, ::Type{T}) at /Users/michael/.julia/v0.5/Grid/src/coord.jl:24" - ] - } - ], - "source": [ - "a = sample(Vector(cd[:,\"Long\"]), 100)\n", - "testlong = CoordInterpGrid(minimum(a):1:maximum(a),a,BCnil, InterpLinear)" - ] - }, - { - "cell_type": "code", - "execution_count": 46, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "data": { - "text/plain": [ - "100-element Grid.InterpGrid{Float64,1,Grid.BCnil,Grid.InterpLinear}:\n", - " -176.5\n", - " -174.5\n", - " -168.5\n", - " -166.5\n", - " -163.5\n", - " -163.5\n", - " -161.5\n", - " -159.5\n", - " -154.5\n", - " -143.5\n", - " -140.5\n", - " -140.5\n", - " -137.5\n", - " ⋮ \n", - " 133.5\n", - " 138.5\n", - " 143.5\n", - " 155.5\n", - " 156.5\n", - " 159.5\n", - " 163.5\n", - " 164.5\n", - " 170.5\n", - " 171.5\n", - " 172.5\n", - " 173.5" - ] - }, - "execution_count": 46, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "a = sort(unique(cd[:,\"Long\"]))\n", - "b = sort(sample(a, 100))\n", - "\n", - "testa = InterpGrid(a, BCnil, InterpLinear)\n", - "testb = InterpGrid(b, BCnil, InterpLinear)" - ] - }, - { - "cell_type": "code", - "execution_count": 33, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "ename": "LoadError", - "evalue": "LoadError: Invalid location\nwhile loading In[33], in expression starting on line 1", - "output_type": "error", - "traceback": [ - "LoadError: Invalid location\nwhile loading In[33], in expression starting on line 1", - "", - " in set_position(::Grid.InterpGridCoefs{Float64,Grid.InterpLinear}, ::Type{Grid.BCnil}, ::Bool, ::Bool, ::Array{Float64,1}) at /Users/michael/.julia/v0.5/Grid/src/interp.jl:403", - " in _getindex at /Users/michael/.julia/v0.5/Grid/src/interp.jl:143 [inlined]", - " in getindex(::Grid.InterpGrid{Float64,1,Grid.BCnil,Grid.InterpLinear}, ::Int64) at /Users/michael/.julia/v0.5/Grid/src/interp.jl:146" - ] - } - ], - "source": [ - "testlong[20]" - ] - }, - { - "cell_type": "code", - "execution_count": 34, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "data": { - "text/plain": [ - "21×17 Array{Float64,2}:\n", - " 0.841471 0.997495 0.909297 … 0.989358 0.798487 0.412118 \n", - " 0.891207 0.999574 0.863209 0.96989 0.734397 0.319098 \n", - " 0.932039 0.991665 0.808496 0.940731 0.662969 0.22289 \n", - " 0.963558 0.973848 0.745705 0.902172 0.584917 0.124454 \n", - " 0.98545 0.9463 0.675463 0.854599 0.501021 0.0247754\n", - " 0.997495 0.909297 0.598472 … 0.798487 0.412118 -0.0751511\n", - " 0.999574 0.863209 0.515501 0.734397 0.319098 -0.174327 \n", - " 0.991665 0.808496 0.42738 0.662969 0.22289 -0.271761 \n", - " 0.973848 0.745705 0.334988 0.584917 0.124454 -0.366479 \n", - " 0.9463 0.675463 0.239249 0.501021 0.0247754 -0.457536 \n", - " 0.909297 0.598472 0.14112 … 0.412118 -0.0751511 -0.544021 \n", - " 0.863209 0.515501 0.0415807 0.319098 -0.174327 -0.625071 \n", - " 0.808496 0.42738 -0.0583741 0.22289 -0.271761 -0.699875 \n", - " 0.745705 0.334988 -0.157746 0.124454 -0.366479 -0.767686 \n", - " 0.675463 0.239249 -0.255541 0.0247754 -0.457536 -0.827826 \n", - " 0.598472 0.14112 -0.350783 … -0.0751511 -0.544021 -0.879696 \n", - " 0.515501 0.0415807 -0.44252 -0.174327 -0.625071 -0.922775 \n", - " 0.42738 -0.0583741 -0.529836 -0.271761 -0.699875 -0.956635 \n", - " 0.334988 -0.157746 -0.611858 -0.366479 -0.767686 -0.980936 \n", - " 0.239249 -0.255541 -0.687766 -0.457536 -0.827826 -0.995436 \n", - " 0.14112 -0.350783 -0.756802 … -0.544021 -0.879696 -0.99999 " - ] - }, - "execution_count": 34, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "x = -1.0:0.1:1.0\n", - "y = 2.0:0.5:10.0\n", - "z_2d = Float64[sin(i+j) for i in x, j in y]\n" - ] - }, - { - "cell_type": "code", - "execution_count": 77, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "data": { - "text/plain": [ - "10×10 DataArrays.DataArray{Float64,2}:\n", - " 0.139577 0.202049 0.30136 … 0.027901 0.658254 0.0338257\n", - " 0.226843 0.035261 0.42243 0.575682 0.451655 0.4322 \n", - " 0.280519 0.607437 0.494239 0.138621 0.142638 0.225242 \n", - " 0.0573405 0.50035 0.0212006 0.947107 0.0873271 0.636359 \n", - " 0.172637 0.935429 0.39757 0.0519984 0.137552 0.0157806\n", - " 0.279653 0.295228 0.616726 … 0.84535 0.294659 0.0736814\n", - " 0.359487 0.024395 0.791468 0.159427 0.932021 0.647971 \n", - " 0.29889 0.426172 0.569196 0.674834 0.473036 0.865966 \n", - " 0.835205 0.262597 0.781618 0.543226 0.186344 0.638209 \n", - " 0.61118 0.191013 0.456609 0.769856 0.675425 0.110935 " - ] - }, - "execution_count": 77, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "z = rand(10,10)\n", - "data(z)" - ] - }, - { - "cell_type": "code", - "execution_count": 78, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "ename": "PyCall.PyError", - "evalue": "PyError (:PyObject_Call) \nAttributeError(\"'list' object has no attribute 'shape'\",)\n File \"/Users/michael/anaconda/lib/python2.7/site-packages/matplotlib/axes/_axes.py\", line 5089, in pcolormesh\n X, Y, C = self._pcolorargs('pcolormesh', *args, allmatch=allmatch)\n File \"/Users/michael/anaconda/lib/python2.7/site-packages/matplotlib/axes/_axes.py\", line 4692, in _pcolorargs\n numRows, numCols = C.shape\n", - "output_type": "error", - "traceback": [ - "PyError (:PyObject_Call) \nAttributeError(\"'list' object has no attribute 'shape'\",)\n File \"/Users/michael/anaconda/lib/python2.7/site-packages/matplotlib/axes/_axes.py\", line 5089, in pcolormesh\n X, Y, C = self._pcolorargs('pcolormesh', *args, allmatch=allmatch)\n File \"/Users/michael/anaconda/lib/python2.7/site-packages/matplotlib/axes/_axes.py\", line 4692, in _pcolorargs\n numRows, numCols = C.shape\n", - "", - " in pyerr_check at /Users/michael/.julia/v0.5/PyCall/src/exception.jl:56 [inlined]", - " in pyerr_check at /Users/michael/.julia/v0.5/PyCall/src/exception.jl:61 [inlined]", - " in macro expansion at /Users/michael/.julia/v0.5/PyCall/src/exception.jl:81 [inlined]", - " in #_pycall#62(::Array{Any,1}, ::Function, ::PyCall.PyObject, ::Array{Float64,1}, ::Vararg{Any,N}) at /Users/michael/.julia/v0.5/PyCall/src/PyCall.jl:551", - " in (::PyCall.#kw##_pycall)(::Array{Any,1}, ::PyCall.#_pycall, ::PyCall.PyObject, ::Array{Float64,1}, ::Vararg{Any,N}) at ./:0", - " in #pycall#66(::Array{Any,1}, ::Function, ::PyCall.PyObject, ::Type{PyCall.PyAny}, ::Array{Float64,1}, ::Vararg{Any,N}) at /Users/michael/.julia/v0.5/PyCall/src/PyCall.jl:568", - " in (::PyCall.#kw##pycall)(::Array{Any,1}, ::PyCall.#pycall, ::PyCall.PyObject, ::Type{PyCall.PyAny}, ::Array{Float64,1}, ::Vararg{Any,N}) at ./:0", - " in #call#67(::Array{Any,1}, ::PyCall.PyObject, ::Array{Float64,1}, ::Vararg{Any,N}) at /Users/michael/.julia/v0.5/PyCall/src/PyCall.jl:571", - " in (::PyCall.#kw#PyObject)(::Array{Any,1}, ::PyCall.PyObject, ::Array{Float64,1}, ::Vararg{Any,N}) at ./:0", - " in py_add_series(::Plots.Plot{Plots.PyPlotBackend}, ::Plots.Series) at /Users/michael/.julia/v0.5/Plots/src/backends/pyplot.jl:738", - " in _before_layout_calcs(::Plots.Plot{Plots.PyPlotBackend}) at /Users/michael/.julia/v0.5/Plots/src/backends/pyplot.jl:958", - " in prepare_output(::Plots.Plot{Plots.PyPlotBackend}) at /Users/michael/.julia/v0.5/Plots/src/plot.jl:232", - " in show(::Base64EncodePipe, ::MIME{Symbol(\"image/png\")}, ::Plots.Plot{Plots.PyPlotBackend}) at /Users/michael/.julia/v0.5/Plots/src/output.jl:170", - " in base64encode(::Function, ::MIME{Symbol(\"image/png\")}, ::Vararg{Any,N}) at ./base64.jl:160", - " in show(::Base.AbstractIOBuffer{Array{UInt8,1}}, ::MIME{Symbol(\"text/html\")}, ::Plots.Plot{Plots.PyPlotBackend}) at /Users/michael/.julia/v0.5/Plots/src/output.jl:148", - " in show(::Base.AbstractIOBuffer{Array{UInt8,1}}, ::String, ::Plots.Plot{Plots.PyPlotBackend}) at ./multimedia.jl:33", - " in #sprint#304(::Void, ::Function, ::Int64, ::Function, ::String, ::Vararg{Any,N}) at ./strings/io.jl:37", - " in display_dict(::Plots.Plot{Plots.PyPlotBackend}) at /Users/michael/.julia/v0.5/Plots/src/output.jl:238", - " in execute_request(::ZMQ.Socket, ::IJulia.Msg) at /Users/michael/.julia/v0.5/IJulia/src/execute_request.jl:200", - " in eventloop(::ZMQ.Socket) at /Users/michael/.julia/v0.5/IJulia/src/eventloop.jl:8", - " in (::IJulia.##9#15)() at ./task.jl:360" - ] - } - ], - "source": [ - "heatmap(data(z))" - ] - }, - { - "cell_type": "code", - "execution_count": 36, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "ename": "ErrorException", - "evalue": "Invalid location", - "output_type": "error", - "traceback": [ - "Invalid location", - "", - " in set_position(::Grid.InterpGridCoefs{Float64,Grid.InterpQuadratic}, ::Type{Grid.BCnil}, ::Bool, ::Bool, ::Array{Float64,1}) at /Users/michael/.julia/v0.5/Grid/src/interp.jl:403", - " in _getindex at /Users/michael/.julia/v0.5/Grid/src/interp.jl:143 [inlined]", - " in getindex at /Users/michael/.julia/v0.5/Grid/src/interp.jl:154 [inlined]", - " in getindex(::Grid.CoordInterpGrid{Float64,2,Grid.BCnil,Grid.InterpQuadratic,Tuple{FloatRange{Float64},FloatRange{Float64}}}, ::Int64, ::Int64) at /Users/michael/.julia/v0.5/Grid/src/coord.jl:39", - " in isassigned(::Grid.CoordInterpGrid{Float64,2,Grid.BCnil,Grid.InterpQuadratic,Tuple{FloatRange{Float64},FloatRange{Float64}}}, ::Int64, ::Int64, ::Vararg{Int64,N}) at ./abstractarray.jl:186", - " in alignment(::IOContext{Base.AbstractIOBuffer{Array{UInt8,1}}}, ::Grid.CoordInterpGrid{Float64,2,Grid.BCnil,Grid.InterpQuadratic,Tuple{FloatRange{Float64},FloatRange{Float64}}}, ::Array{Int64,1}, ::Array{Int64,1}, ::Int64, ::Int64, ::Int64) at ./show.jl:1277", - " in print_matrix(::IOContext{Base.AbstractIOBuffer{Array{UInt8,1}}}, ::Grid.CoordInterpGrid{Float64,2,Grid.BCnil,Grid.InterpQuadratic,Tuple{FloatRange{Float64},FloatRange{Float64}}}, ::String, ::String, ::String, ::String, ::String, ::String, ::Int64, ::Int64) at ./show.jl:1407", - " in print_matrix(::IOContext{Base.AbstractIOBuffer{Array{UInt8,1}}}, ::Grid.CoordInterpGrid{Float64,2,Grid.BCnil,Grid.InterpQuadratic,Tuple{FloatRange{Float64},FloatRange{Float64}}}, ::String, ::String, ::String) at ./show.jl:1379", - " in #showarray#330(::Bool, ::Function, ::IOContext{Base.AbstractIOBuffer{Array{UInt8,1}}}, ::Grid.CoordInterpGrid{Float64,2,Grid.BCnil,Grid.InterpQuadratic,Tuple{FloatRange{Float64},FloatRange{Float64}}}, ::Bool) at ./show.jl:1618", - " in limitstringmime(::MIME{Symbol(\"text/plain\")}, ::Grid.CoordInterpGrid{Float64,2,Grid.BCnil,Grid.InterpQuadratic,Tuple{FloatRange{Float64},FloatRange{Float64}}}) at /Users/michael/.julia/v0.5/IJulia/src/execute_request.jl:31", - " in display_dict(::Grid.CoordInterpGrid{Float64,2,Grid.BCnil,Grid.InterpQuadratic,Tuple{FloatRange{Float64},FloatRange{Float64}}}) at /Users/michael/.julia/v0.5/IJulia/src/execute_request.jl:46", - " in execute_request(::ZMQ.Socket, ::IJulia.Msg) at /Users/michael/.julia/v0.5/IJulia/src/execute_request.jl:200", - " in eventloop(::ZMQ.Socket) at /Users/michael/.julia/v0.5/IJulia/src/eventloop.jl:8", - " in (::IJulia.##9#15)() at ./task.jl:360" - ] - } - ], - "source": [ - "z_2di = CoordInterpGrid((x,y), z_2d, BCnil, InterpQuadratic)" - ] - }, - { - "cell_type": "code", - "execution_count": 37, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "data": { - "text/plain": [ - "21×17 Grid.InterpGrid{Float64,2,Grid.BCnil,Grid.InterpQuadratic}:\n", - " 0.841471 0.997495 0.909297 … 0.989358 0.798487 0.412118 \n", - " 0.891207 0.999574 0.863209 0.96989 0.734397 0.319098 \n", - " 0.932039 0.991665 0.808496 0.940731 0.662969 0.22289 \n", - " 0.963558 0.973848 0.745705 0.902172 0.584917 0.124454 \n", - " 0.98545 0.9463 0.675463 0.854599 0.501021 0.0247754\n", - " 0.997495 0.909297 0.598472 … 0.798487 0.412118 -0.0751511\n", - " 0.999574 0.863209 0.515501 0.734397 0.319098 -0.174327 \n", - " 0.991665 0.808496 0.42738 0.662969 0.22289 -0.271761 \n", - " 0.973848 0.745705 0.334988 0.584917 0.124454 -0.366479 \n", - " 0.9463 0.675463 0.239249 0.501021 0.0247754 -0.457536 \n", - " 0.909297 0.598472 0.14112 … 0.412118 -0.0751511 -0.544021 \n", - " 0.863209 0.515501 0.0415807 0.319098 -0.174327 -0.625071 \n", - " 0.808496 0.42738 -0.0583741 0.22289 -0.271761 -0.699875 \n", - " 0.745705 0.334988 -0.157746 0.124454 -0.366479 -0.767686 \n", - " 0.675463 0.239249 -0.255541 0.0247754 -0.457536 -0.827826 \n", - " 0.598472 0.14112 -0.350783 … -0.0751511 -0.544021 -0.879696 \n", - " 0.515501 0.0415807 -0.44252 -0.174327 -0.625071 -0.922775 \n", - " 0.42738 -0.0583741 -0.529836 -0.271761 -0.699875 -0.956635 \n", - " 0.334988 -0.157746 -0.611858 -0.366479 -0.767686 -0.980936 \n", - " 0.239249 -0.255541 -0.687766 -0.457536 -0.827826 -0.995436 \n", - " 0.14112 -0.350783 -0.756802 … -0.544021 -0.879696 -0.99999 " - ] - }, - "execution_count": 37, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "z_2di = InterpGrid(z_2d, BCnil, InterpQuadratic)" - ] - }, - { - "cell_type": "code", - "execution_count": 47, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "search: Matrix BitMatrix ComMatrix DenseMatrix SharedMatrix SparseMatrixCSC\n", - "\n" - ] - }, - { - "data": { - "text/markdown": [ - "No documentation found.\n", - "\n", - "`Base.Matrix` is of type `TypeConstructor`.\n", - "\n", - "**Summary:**\n", - "\n", - "```\n", - "immutable TypeConstructor <: Type{T}\n", - "```\n", - "\n", - "**Fields:**\n", - "\n", - "```\n", - "parameters :: SimpleVector\n", - "body :: Any\n", - "```\n" - ], - "text/plain": [ - "No documentation found.\n", - "\n", - "`Base.Matrix` is of type `TypeConstructor`.\n", - "\n", - "**Summary:**\n", - "\n", - "```\n", - "immutable TypeConstructor <: Type{T}\n", - "```\n", - "\n", - "**Fields:**\n", - "\n", - "```\n", - "parameters :: SimpleVector\n", - "body :: Any\n", - "```\n" - ] - }, - "execution_count": 47, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "?Matrix" - ] - }, - { - "cell_type": "code", - "execution_count": 48, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "search: Array SubArray BitArray DenseArray StridedArray pointer_to_array\n", - "\n" - ] - }, - { - "data": { - "text/markdown": [ - "```\n", - "Array(dims)\n", - "```\n", - "\n", - "`Array{T}(dims)` constructs an uninitialized dense array with element type `T`. `dims` may be a tuple or a series of integer arguments. The syntax `Array(T, dims)` is also available, but deprecated.\n" - ], - "text/plain": [ - "```\n", - "Array(dims)\n", - "```\n", - "\n", - "`Array{T}(dims)` constructs an uninitialized dense array with element type `T`. `dims` may be a tuple or a series of integer arguments. The syntax `Array(T, dims)` is also available, but deprecated.\n" - ] - }, - "execution_count": 48, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "?Array" - ] - }, - { - "cell_type": "code", - "execution_count": 49, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "search: StridedArray StridedMatrix\n", - "\n" - ] - }, - { - "data": { - "text/markdown": [ - "No documentation found.\n", - "\n", - "`Base.StridedArray` is of type `TypeConstructor`.\n", - "\n", - "**Summary:**\n", - "\n", - "```\n", - "immutable TypeConstructor <: Type{T}\n", - "```\n", - "\n", - "**Fields:**\n", - "\n", - "```\n", - "parameters :: SimpleVector\n", - "body :: Any\n", - "```\n" - ], - "text/plain": [ - "No documentation found.\n", - "\n", - "`Base.StridedArray` is of type `TypeConstructor`.\n", - "\n", - "**Summary:**\n", - "\n", - "```\n", - "immutable TypeConstructor <: Type{T}\n", - "```\n", - "\n", - "**Fields:**\n", - "\n", - "```\n", - "parameters :: SimpleVector\n", - "body :: Any\n", - "```\n" - ] - }, - "execution_count": 49, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "?StridedArray" - ] - }, - { - "cell_type": "code", - "execution_count": 57, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "ename": "LoadError", - "evalue": "LoadError: MethodError: no method matching sparse(::Array{Int64,1}, ::Array{Int64,1}, ::Array{Float64,1}, ::Int64)\nClosest candidates are:\n sparse{Tv,Ti<:Integer}(::AbstractArray{Ti<:Integer,1}, ::AbstractArray{Ti<:Integer,1}, ::AbstractArray{Tv,1}, ::Integer, !Matched::Integer, !Matched::Any) at sparse/sparsematrix.jl:382\n sparse(::Any, ::Any, ::AbstractArray{T,1}, ::Any, !Matched::Any) at sparse/sparsematrix.jl:593\n sparse(::Any, ::Any, !Matched::AbstractArray{Bool,1}, ::Any, !Matched::Any) at sparse/sparsematrix.jl:595\n ...\nwhile loading In[57], in expression starting on line 5", - "output_type": "error", - "traceback": [ - "LoadError: MethodError: no method matching sparse(::Array{Int64,1}, ::Array{Int64,1}, ::Array{Float64,1}, ::Int64)\nClosest candidates are:\n sparse{Tv,Ti<:Integer}(::AbstractArray{Ti<:Integer,1}, ::AbstractArray{Ti<:Integer,1}, ::AbstractArray{Tv,1}, ::Integer, !Matched::Integer, !Matched::Any) at sparse/sparsematrix.jl:382\n sparse(::Any, ::Any, ::AbstractArray{T,1}, ::Any, !Matched::Any) at sparse/sparsematrix.jl:593\n sparse(::Any, ::Any, !Matched::AbstractArray{Bool,1}, ::Any, !Matched::Any) at sparse/sparsematrix.jl:595\n ...\nwhile loading In[57], in expression starting on line 5", - "" - ] - } - ], - "source": [ - "x = sample(1:4, 9, replace = true)\n", - "y = sample(1:4, 9, replace = true)\n", - "z = rand(9)\n", - "using DataArrays\n", - "Matrix(sparse(x,y,z, 9))" - ] - }, - { - "cell_type": "code", - "execution_count": 58, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "search: sparse sparsevec SparseVector SparseArrays SparseMatrixCSC issparse\n", - "\n" - ] - }, - { - "data": { - "text/markdown": [ - "```\n", - "sparse(A)\n", - "```\n", - "\n", - "Convert an AbstractMatrix `A` into a sparse matrix.\n", - "\n", - "```\n", - "sparse(I, J, V,[ m, n, combine])\n", - "```\n", - "\n", - "Create a sparse matrix `S` of dimensions `m x n` such that `S[I[k], J[k]] = V[k]`. The `combine` function is used to combine duplicates. If `m` and `n` are not specified, they are set to `maximum(I)` and `maximum(J)` respectively. If the `combine` function is not supplied, `combine` defaults to `+` unless the elements of `V` are Booleans in which case `combine` defaults to `|`. All elements of `I` must satisfy `1 <= I[k] <= m`, and all elements of `J` must satisfy `1 <= J[k] <= n`. Numerical zeros in (`I`, `J`, `V`) are retained as structural nonzeros; to drop numerical zeros, use [`dropzeros!`](:func:`dropzeros!`).\n", - "\n", - "For additional documentation and an expert driver, see `Base.SparseArrays.sparse!`.\n", - "\n", - "sparse(g) is the adjacency_matrix of g\n" - ], - "text/plain": [ - "```\n", - "sparse(A)\n", - "```\n", - "\n", - "Convert an AbstractMatrix `A` into a sparse matrix.\n", - "\n", - "```\n", - "sparse(I, J, V,[ m, n, combine])\n", - "```\n", - "\n", - "Create a sparse matrix `S` of dimensions `m x n` such that `S[I[k], J[k]] = V[k]`. The `combine` function is used to combine duplicates. If `m` and `n` are not specified, they are set to `maximum(I)` and `maximum(J)` respectively. If the `combine` function is not supplied, `combine` defaults to `+` unless the elements of `V` are Booleans in which case `combine` defaults to `|`. All elements of `I` must satisfy `1 <= I[k] <= m`, and all elements of `J` must satisfy `1 <= J[k] <= n`. Numerical zeros in (`I`, `J`, `V`) are retained as structural nonzeros; to drop numerical zeros, use [`dropzeros!`](:func:`dropzeros!`).\n", - "\n", - "For additional documentation and an expert driver, see `Base.SparseArrays.sparse!`.\n", - "\n", - "sparse(g) is the adjacency_matrix of g\n" - ] - }, - "execution_count": 58, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "?sparse" - ] - }, - { - "cell_type": "code", - "execution_count": 61, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "search: DenseMatrix DenseVecOrMat\n", - "\n" - ] - }, - { - "data": { - "text/markdown": [ - "No documentation found.\n", - "\n", - "`Base.DenseMatrix` is of type `TypeConstructor`.\n", - "\n", - "**Summary:**\n", - "\n", - "```\n", - "immutable TypeConstructor <: Type{T}\n", - "```\n", - "\n", - "**Fields:**\n", - "\n", - "```\n", - "parameters :: SimpleVector\n", - "body :: Any\n", - "```\n" - ], - "text/plain": [ - "No documentation found.\n", - "\n", - "`Base.DenseMatrix` is of type `TypeConstructor`.\n", - "\n", - "**Summary:**\n", - "\n", - "```\n", - "immutable TypeConstructor <: Type{T}\n", - "```\n", - "\n", - "**Fields:**\n", - "\n", - "```\n", - "parameters :: SimpleVector\n", - "body :: Any\n", - "```\n" - ] - }, - "execution_count": 61, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "?DenseMatrix" - ] - }, - { - "cell_type": "code", - "execution_count": 80, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "data": { - "text/plain": [ - "Summary Stats:\n", - "Mean: 0.495942\n", - "Minimum: 0.013205\n", - "1st Quartile: 0.283798\n", - "Median: 0.505712\n", - "3rd Quartile: 0.758443\n", - "Maximum: 0.979823\n" - ] - }, - "execution_count": 80, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "a = summarystats(rand(100))" - ] - }, - { - "cell_type": "code", - "execution_count": 83, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "ename": "LoadError", - "evalue": "LoadError: MethodError: Cannot `convert` an object of type StatsBase.SummaryStats{Float64} to an object of type DataFrames.DataFrame\nThis may have arisen from a call to the constructor DataFrames.DataFrame(...),\nsince type constructors fall back to convert methods.\nwhile loading In[83], in expression starting on line 2", - "output_type": "error", - "traceback": [ - "LoadError: MethodError: Cannot `convert` an object of type StatsBase.SummaryStats{Float64} to an object of type DataFrames.DataFrame\nThis may have arisen from a call to the constructor DataFrames.DataFrame(...),\nsince type constructors fall back to convert methods.\nwhile loading In[83], in expression starting on line 2", - "", - " in DataFrames.DataFrame(::StatsBase.SummaryStats{Float64}) at ./sysimg.jl:53" - ] - } - ], - "source": [] - }, - { - "cell_type": "code", - "execution_count": 84, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "data": { - "text/plain": [ - "4-element DataArrays.DataArray{Int64,1}:\n", - " NA\n", - " 1 \n", - " 2 \n", - " 4 " - ] - }, - "execution_count": 84, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "a = @data([NA, 1, 2, 4])" - ] - }, - { - "cell_type": "code", - "execution_count": 85, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "data": { - "text/plain": [ - "4-element DataArrays.DataArray{Float64,1}:\n", - " NA\n", - " 0.5\n", - " 1.0\n", - " 2.0" - ] - }, - "execution_count": 85, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "a/2" - ] - }, - { - "cell_type": "code", - "execution_count": 86, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "data": { - "text/plain": [ - "Inf" - ] - }, - "execution_count": 86, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "2/0\n" - ] - }, - { - "cell_type": "code", - "execution_count": 87, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "INFO: Recompiling stale cache file /Users/michael/.julia/lib/v0.5/StatPlots.ji for module StatPlots.\n" - ] - } - ], - "source": [ - "using StatPlots" - ] - }, - { - "cell_type": "code", - "execution_count": 88, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - " @animate 0 bytes Plots.#@animate\n", - " @colorant_str 0 bytes Colors.#@colorant_str\n", - " @gif 0 bytes Plots.#@gif\n", - " @layout 0 bytes Plots.#@layout\n", - " @recipe 0 bytes RecipesBase.#@recipe\n", - " @series 0 bytes RecipesBase.#@series\n", - " @shorthands 0 bytes Plots.#@shorthands\n", - " @userplot 0 bytes Plots.#@userplot\n", - " ABGR 236 bytes DataType\n", - " ADIN99 204 bytes DataType\n", - " ADIN99d 204 bytes DataType\n", - " ADIN99o 204 bytes DataType\n", - " AGray 212 bytes DataType\n", - " AGray32 112 bytes DataType\n", - " AHSI 204 bytes DataType\n", - " AHSL 204 bytes DataType\n", - " AHSV 204 bytes DataType\n", - " ALCHab 204 bytes DataType\n", - " ALCHuv 204 bytes DataType\n", - " ALMS 204 bytes DataType\n", - " ALab 204 bytes DataType\n", - " ALuv 204 bytes DataType\n", - " AMat 80 bytes TypeConstructor\n", - " ARGB 236 bytes DataType\n", - " ARGB32 112 bytes DataType\n", - " AVec 80 bytes TypeConstructor\n", - " AXYZ 204 bytes DataType\n", - " AYCbCr 204 bytes DataType\n", - " AYIQ 204 bytes DataType\n", - " AbstractLayout 92 bytes DataType\n", - " AbstractPlot 148 bytes DataType\n", - " AbstractRGB 148 bytes DataType\n", - " AlphaColor 228 bytes DataType\n", - " Animation 124 bytes DataType\n", - " Axis 124 bytes DataType\n", - " AxyY 204 bytes DataType\n", - " BBox 140 bytes DataType\n", - " BGR 224 bytes DataType\n", - " BGRA 236 bytes DataType\n", - " BezierCurve 168 bytes DataType\n", - " BoundingBox 284 bytes DataType\n", - " CIE1931JV_CMF 92 bytes DataType\n", - " CIE1931J_CMF 92 bytes DataType\n", - " CIE1931_CMF 92 bytes DataType\n", - " CIE1964_CMF 92 bytes DataType\n", - " Color 188 bytes DataType\n", - " ColorAlpha 228 bytes DataType\n", - " ColorGradient 124 bytes DataType\n", - " ColorTypes 9375 KB Module\n", - " Colorant 188 bytes DataType\n", - " Colors 9322 KB Module\n", - " DE_2000 136 bytes DataType\n", - " DE_94 136 bytes DataType\n", - " DE_AB 92 bytes DataType\n", - " DE_BFD 136 bytes DataType\n", - " DE_CMC 124 bytes DataType\n", - " DE_DIN99 92 bytes DataType\n", - " DE_DIN99d 92 bytes DataType\n", - " DE_DIN99o 92 bytes DataType\n", - " DE_JPC79 92 bytes DataType\n", - " DIN99 192 bytes DataType\n", - " DIN99A 204 bytes DataType\n", - " DIN99d 192 bytes DataType\n", - " DIN99dA 204 bytes DataType\n", - " DIN99o 192 bytes DataType\n", - " DIN99oA 204 bytes DataType\n", - " EmptyLayout 136 bytes DataType\n", - " Formatted 180 bytes DataType\n", - " Fractional 32 bytes Union\n", - " Gray 208 bytes DataType\n", - " Gray24 112 bytes DataType\n", - " GrayA 212 bytes DataType\n", - " GridLayout 184 bytes DataType\n", - " HSB 192 bytes DataType\n", - " HSI 192 bytes DataType\n", - " HSIA 204 bytes DataType\n", - " HSL 192 bytes DataType\n", - " HSLA 204 bytes DataType\n", - " HSV 192 bytes DataType\n", - " HSVA 204 bytes DataType\n", - " KW 212 bytes DataType\n", - " LCHab 192 bytes DataType\n", - " LCHabA 204 bytes DataType\n", - " LCHuv 192 bytes DataType\n", - " LCHuvA 204 bytes DataType\n", - " LMS 192 bytes DataType\n", - " LMSA 204 bytes DataType\n", - " Lab 192 bytes DataType\n", - " LabA 204 bytes DataType\n", - " Luv 192 bytes DataType\n", - " LuvA 204 bytes DataType\n", - " MSC 0 bytes Colors.#MSC\n", - " OHLC 204 bytes DataType\n", - " P2 136 bytes DataType\n", - " P3 136 bytes DataType\n", - " Plot 288 bytes DataType\n", - " PlotUtils 9135 KB Module\n", - " Plots 13091 KB Module\n", - " RGB 224 bytes DataType\n", - " RGB1 236 bytes DataType\n", - " RGB24 112 bytes DataType\n", - " RGB4 236 bytes DataType\n", - " RGBA 236 bytes DataType\n", - " RecipeData 124 bytes DataType\n", - " RecipesBase 9059 KB Module\n", - " Segments 168 bytes DataType\n", - " Shape 124 bytes DataType\n", - " StatPlots 50 KB Module\n", - " Subplot 240 bytes DataType\n", - " Surface 232 bytes DataType\n", - " TransparentColor 228 bytes DataType\n", - " U16 136 bytes DataType\n", - " U8 136 bytes DataType\n", - " XYZ 192 bytes DataType\n", - " XYZA 204 bytes DataType\n", - " YCbCr 192 bytes DataType\n", - " YCbCrA 204 bytes DataType\n", - " YIQ 192 bytes DataType\n", - " YIQA 204 bytes DataType\n", - " add_backend 0 bytes Plots.#add_backend\n", - " add_theme 0 bytes Plots.#add_theme\n", - " aliases 0 bytes Plots.#aliases\n", - " alpha 0 bytes ColorTypes.#alpha\n", - " alphacolor 0 bytes ColorTypes.#alphacolor\n", - " annotate! 0 bytes Plots.#annotate!\n", - " argb32 0 bytes Colors.#argb32\n", - " arrow 0 bytes Plots.#arrow\n", - " backend 0 bytes Plots.#backend\n", - " backend_name 0 bytes Plots.#backend_name\n", - " backend_object 0 bytes Plots.#backend_object\n", - " backends 0 bytes Plots.#backends\n", - " bar 0 bytes Plots.#bar\n", - " bar! 0 bytes Plots.#bar!\n", - " barh 0 bytes Plots.#barh\n", - " barh! 0 bytes Plots.#barh!\n", - " base_color_type 0 bytes ColorTypes.#base_color_type\n", - " base_colorant_type 0 bytes ColorTypes.#base_colorant_type\n", - " bbox 0 bytes Plots.#bbox\n", - " blue 0 bytes ColorTypes.#blue\n", - " boxplot 0 bytes Plots.#boxplot\n", - " boxplot! 0 bytes Plots.#boxplot!\n", - " brush 0 bytes Plots.#brush\n", - " ccolor 0 bytes ColorTypes.#ccolor\n", - " center 0 bytes Plots.#center\n", - " cgrad 0 bytes PlotUtils.#cgrad\n", - " cie_color_match 0 bytes Colors.#cie_color_match\n", - " cm 8 bytes Measures.Length{:mm,Float64}\n", - " color 0 bytes ColorTypes.#color\n", - " color_type 0 bytes ColorTypes.#color_type\n", - " coloralpha 0 bytes ColorTypes.#coloralpha\n", - " colordiff 0 bytes Colors.#colordiff\n", - " colormap 0 bytes Colors.#colormap\n", - " colormatch 0 bytes Colors.#colormatch\n", - " comp1 0 bytes ColorTypes.#comp1\n", - " comp2 0 bytes ColorTypes.#comp2\n", - " comp3 0 bytes ColorTypes.#comp3\n", - " contour 0 bytes Plots.#contour\n", - " contour! 0 bytes Plots.#contour!\n", - " contour3d 0 bytes Plots.#contour3d\n", - " contour3d! 0 bytes Plots.#contour3d!\n", - " contourf 0 bytes Plots.#contourf\n", - " contourf! 0 bytes Plots.#contourf!\n", - " coords 0 bytes Plots.#coords\n", - " cornerplot 0 bytes StatPlots.#cornerplot\n", - " cornerplot! 0 bytes StatPlots.#cornerplot!\n", - " corrplot 0 bytes StatPlots.#corrplot\n", - " corrplot! 0 bytes StatPlots.#corrplot!\n", - " current 0 bytes Plots.#current\n", - " curve_points 0 bytes Plots.#curve_points\n", - " curves 0 bytes Plots.#curves\n", - " curves! 0 bytes Plots.#curves!\n", - " cvec 0 bytes PlotUtils.#cvec\n", - " default 0 bytes Plots.#default\n", - " density 0 bytes Plots.#density\n", - " density! 0 bytes Plots.#density!\n", - " deuteranopic 0 bytes Colors.#deuteranopic\n", - " din99a 0 bytes Colors.#din99a\n", - " din99da 0 bytes Colors.#din99da\n", - " din99oa 0 bytes Colors.#din99oa\n", - " directed_curve 0 bytes Plots.#directed_curve\n", - " distinguishable_colors 0 bytes Colors.#distinguishable_colors\n", - " diverging_palette 0 bytes Colors.#diverging_palette\n", - " font 0 bytes Plots.#font\n", - " frame 0 bytes Plots.#frame\n", - " get_color_palette 0 bytes PlotUtils.#get_color_palette\n", - " gif 0 bytes Plots.#gif\n", - " glvisualize 0 bytes Plots.#glvisualize\n", - " gr 0 bytes Plots.#gr\n", - " gray 0 bytes ColorTypes.#gray\n", - " green 0 bytes ColorTypes.#green\n", - " grid 0 bytes Plots.#grid\n", - " gui 0 bytes Plots.#gui\n", - " h 8 bytes Measures.Length{:h,Float64}\n", - " heatmap 0 bytes Plots.#heatmap\n", - " heatmap! 0 bytes Plots.#heatmap!\n", - " hex 0 bytes Base.#hex\n", - " hexbin 0 bytes Plots.#hexbin\n", - " hexbin! 0 bytes Plots.#hexbin!\n", - " histogram 0 bytes Plots.#histogram\n", - " histogram! 0 bytes Plots.#histogram!\n", - " histogram2d 0 bytes Plots.#histogram2d\n", - " histogram2d! 0 bytes Plots.#histogram2d!\n", - " hline 0 bytes Plots.#hline\n", - " hline! 0 bytes Plots.#hline!\n", - " hsla 0 bytes Colors.#hsla\n", - " hsva 0 bytes Colors.#hsva\n", - " inch 8 bytes Measures.Length{:mm,Float64}\n", - " isdark 0 bytes PlotUtils.#isdark\n", - " iter_segments 0 bytes Plots.#iter_segments\n", - " laba 0 bytes Colors.#laba\n", - " lchaba 0 bytes Colors.#lchaba\n", - " lchuva 0 bytes Colors.#lchuva\n", - " lmsa 0 bytes Colors.#lmsa\n", - " luva 0 bytes Colors.#luva\n", - " marginalhist 0 bytes StatPlots.#marginalhist\n", - " marginalhist! 0 bytes StatPlots.#marginalhist!\n", - " mm 8 bytes Measures.Length{:mm,Float64}\n", - " ohlc 0 bytes Plots.#ohlc\n", - " ohlc! 0 bytes Plots.#ohlc!\n", - " optimize_ticks 0 bytes PlotUtils.#optimize_ticks\n", - " path3d 0 bytes Plots.#path3d\n", - " path3d! 0 bytes Plots.#path3d!\n", - " pct 8 bytes Measures.Length{:pct,Float64}\n", - " pgfplots 0 bytes Plots.#pgfplots\n", - " pie 0 bytes Plots.#pie\n", - " pie! 0 bytes Plots.#pie!\n", - " plot 0 bytes Plots.#plot\n", - " plot! 0 bytes Plots.#plot!\n", - " plot3d 0 bytes Plots.#plot3d\n", - " plot3d! 0 bytes Plots.#plot3d!\n", - " plot_color 0 bytes PlotUtils.#plot_color\n", - " plotarea 0 bytes Plots.#plotarea\n", - " plotly 0 bytes Plots.#plotly\n", - " plotlyjs 0 bytes Plots.#plotlyjs\n", - " png 0 bytes Plots.#png\n", - " protanopic 0 bytes Colors.#protanopic\n", - " pt 8 bytes Measures.Length{:mm,Float64}\n", - " px 8 bytes Measures.Length{:mm,Float64}\n", - " pyplot 0 bytes Plots.#pyplot\n", - " quiver 0 bytes Plots.#quiver\n", - " quiver! 0 bytes Plots.#quiver!\n", - " red 0 bytes ColorTypes.#red\n", - " rgb_string 0 bytes PlotUtils.#rgb_string\n", - " rgba 0 bytes Colors.#rgba\n", - " rgba_string 0 bytes PlotUtils.#rgba_string\n", - " rotate 0 bytes Plots.#rotate\n", - " rotate! 0 bytes Plots.#rotate!\n", - " savefig 0 bytes Plots.#savefig\n", - " scatter 0 bytes Plots.#scatter\n", - " scatter! 0 bytes Plots.#scatter!\n", - " scatter3d 0 bytes Plots.#scatter3d\n", - " scatter3d! 0 bytes Plots.#scatter3d!\n", - " sequential_palette 0 bytes Colors.#sequential_palette\n", - " set_theme 0 bytes Plots.#set_theme\n", - " spy 0 bytes Plots.#spy\n", - " sticks 0 bytes Plots.#sticks\n", - " sticks! 0 bytes Plots.#sticks!\n", - " stroke 0 bytes Plots.#stroke\n", - " surface 0 bytes Plots.#surface\n", - " surface! 0 bytes Plots.#surface!\n", - " test_examples 0 bytes Plots.#test_examples\n", - " text 0 bytes Plots.#text\n", - " title! 0 bytes Plots.#title!\n", - " translate 0 bytes Plots.#translate\n", - " translate! 0 bytes Plots.#translate!\n", - " tritanopic 0 bytes Colors.#tritanopic\n", - " twinx 0 bytes Plots.#twinx\n", - " unicodeplots 0 bytes Plots.#unicodeplots\n", - " update! 0 bytes Plots.#update!\n", - " violin 0 bytes Plots.#violin\n", - " violin! 0 bytes Plots.#violin!\n", - " vline 0 bytes Plots.#vline\n", - " vline! 0 bytes Plots.#vline!\n", - " w 8 bytes Measures.Length{:w,Float64}\n", - " weighted_color_mean 0 bytes Colors.#weighted_color_mean\n", - " whitebalance 0 bytes Colors.#whitebalance\n", - " wireframe 0 bytes Plots.#wireframe\n", - " wireframe! 0 bytes Plots.#wireframe!\n", - " with 0 bytes Plots.#with\n", - " wrap 0 bytes Plots.#wrap\n", - " xaxis! 0 bytes Plots.#xaxis!\n", - " xflip! 0 bytes Plots.#xflip!\n", - " xlabel! 0 bytes Plots.#xlabel!\n", - " xlims 0 bytes Plots.#xlims\n", - " xlims! 0 bytes Plots.#xlims!\n", - " xticks! 0 bytes Plots.#xticks!\n", - " xyY 192 bytes DataType\n", - " xyYA 204 bytes DataType\n", - " xyYa 0 bytes Colors.#xyYa\n", - " xyza 0 bytes Colors.#xyza\n", - " yaxis! 0 bytes Plots.#yaxis!\n", - " yflip! 0 bytes Plots.#yflip!\n", - " ylabel! 0 bytes Plots.#ylabel!\n", - " ylims 0 bytes Plots.#ylims\n", - " ylims! 0 bytes Plots.#ylims!\n", - " yticks! 0 bytes Plots.#yticks!\n", - " zlims 0 bytes Plots.#zlims\n", - " zlims! 0 bytes Plots.#zlims!\n" - ] - } - ], - "source": [ - "whos(StatPlots)" - ] - }, - { - "cell_type": "code", - "execution_count": 89, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "data": { - "text/plain": [ - "7-element Array{Symbol,1}:\n", - " :parent \n", - " :minpad \n", - " :bbox \n", - " :grid \n", - " :widths \n", - " :heights\n", - " :attr " - ] - }, - "execution_count": 89, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "fieldnames(StatPlots.GridLayout)" - ] - }, - { - "cell_type": "code", - "execution_count": 26, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "INFO: Checking out Plots master...\n", - "INFO: Pulling Plots latest master...\n", - "INFO: No packages to install, update or remove\n", - "INFO: Building Plots\n" - ] - } - ], - "source": [ - "Pkg.checkout(\"Plots\")\n", - "Pkg.build(\"Plots\")" - ] - }, - { - "cell_type": "code", - "execution_count": 35, - "metadata": { - "collapsed": false - }, - "outputs": [], - "source": [ - "using StatsBase, Plots\n", - "z = Matrix{Float64}(4,5)\n", - "fill!(z, NaN)\n", - "x = sample(1:4, 9, replace = true)\n", - "y = sample(1:4, 9, replace = true)\n", - "ll = rand(9)\n", - "for i in 1:length(x)\n", - " z[x[i],y[i]] = ll[i]\n", - "end" - ] - }, - { - "cell_type": "code", - "execution_count": 40, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "data": { - "text/html": [ - "\n", - "\n", - "\n", - " \n", - " \n", - " \n", - "\n", - "\n", - "\n", - " \n", - " \n", - " \n", - "\n", - "\n", - "\n", - " \n", - " \n", - " \n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "1\n", - "\n", - "\n", - "2\n", - "\n", - "\n", - "3\n", - "\n", - "\n", - "4\n", - "\n", - "\n", - "5\n", - "\n", - "\n", - "1.0\n", - "\n", - "\n", - "1.5\n", - "\n", - "\n", - "2.0\n", - "\n", - "\n", - "2.5\n", - "\n", - "\n", - "3.0\n", - "\n", - "\n", - "3.5\n", - "\n", - "\n", - "4.0\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - " \n", - " \n", - " \n", - "\n", - "\n", - "\n", - "\n", - "\n", - "0\n", - "\n", - "\n", - "0.1\n", - "\n", - "\n", - "0.2\n", - "\n", - "\n", - "0.3\n", - "\n", - "\n", - "0.4\n", - "\n", - "\n", - "0.5\n", - "\n", - "\n", - "0.6\n", - "\n", - "\n", - "0.7\n", - "\n", - "\n", - "0.8\n", - "\n", - "\n" - ] - }, - "execution_count": 40, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "gr()\n", - "heatmap(z, grid = false)" - ] - }, - { - "cell_type": "code", - "execution_count": 37, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "data": { - "text/html": [ - "\n", - "\n", - " \n", - "\n", - "\n", - "
\n", - "\n", - "\n", - "\n", - "\n", - "\n" - ] - }, - "execution_count": 37, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "plotlyjs()\n", - "heatmap(z, grid = false)" - ] - }, - { - "cell_type": "code", - "execution_count": 18, - "metadata": { - "collapsed": false + "collapsed": false }, "outputs": [ { "data": { "text/plain": [ - "Plots.PlotlyJSBackend()" + "SpatialEcology.Assemblage{SpatialEcology.GridData,Bool}" ] }, - "execution_count": 18, + "execution_count": 20, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "plotlyjs()\n" - ] - }, - { - "cell_type": "code", - "execution_count": 41, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "INFO: Freeing GR\n", - "INFO: No packages to install, update or remove\n" - ] - } - ], - "source": [ - "Pkg.free(\"GR\")" - ] - }, - { - "cell_type": "code", - "execution_count": 39, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "INFO: Building GR\n" - ] - } - ], - "source": [ - "Pkg.build(\"GR\")" + "typeof(mama)" ] }, { diff --git a/mamob.jld b/mamob.jld new file mode 100644 index 0000000..e4af2e8 Binary files /dev/null and b/mamob.jld differ diff --git a/scratch.jl b/scratch.jl index 059ed61..0f9959d 100644 --- a/scratch.jl +++ b/scratch.jl @@ -11,7 +11,7 @@ mama = Assemblage(mam) using JLD jldopen("mamobj.jld", "w") do file - addrequire(file, MacroEcology) + addrequire(file, SpatialEcology) write(file, "mam", mama) end diff --git a/src/SpatialEcology.jl b/src/SpatialEcology.jl index 456fd2f..99bd0e5 100644 --- a/src/SpatialEcology.jl +++ b/src/SpatialEcology.jl @@ -1,9 +1,12 @@ __precompile__() module SpatialEcology -using DataFrames -import Bio.Phylo -using NamedArrays +using Reexport +@reexport using DataFrames +@reexport using NamedArrays + +#import Bio.Phylo +import RecipesBase import Shapefile import Base: getindex, setindex!, size, show, summary @@ -11,7 +14,7 @@ include("DataTypes.jl") include("Constructor_helperfunctions.jl") include("Constructors.jl") include("Commatrix_functions.jl") -include("Gettersandsetters.jl") +include("GetandSetdata.jl") include("Gridfunctions.jl") include("Subsetting.jl") #include("PlotRecipes.jl") @@ -21,6 +24,5 @@ export nspecies, nsites, occupancy, richness, records, sitenames, specnames export setindex!, getindex, size, show, summary export coords, subset!, subset, addshape!, deleteshape! export xcells, ycells, cells, xmin, xmax, ymin, ymax, xrange, yrange, xcellsize, ycellsize, cellsize, boundingbox #it is possible that I will export none of these -#export DataFrames, NamedArrays end # module diff --git a/test/runtests.jl b/test/runtests.jl index f8839c9..001acf7 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,4 +1,4 @@ -using MacroEcology +using SpatialEcology using Base.Test # write your own tests here @@ -8,5 +8,3 @@ using Base.Test function tes{T <: Union{Int, Bool}}(x::AbstractMatrix{T}) println("success") end - -tst = OccMatrix(zeros(Int, 2, 2))