File tree Expand file tree Collapse file tree 2 files changed +38
-0
lines changed
Expand file tree Collapse file tree 2 files changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ Revise = "295af30f-e4ad-537b-8983-00126c2a3abe"
1717SimpleSDMDatasets = " 2c7d61d0-5c73-410d-85b2-d2e7fbbdcefa"
1818SimpleSDMLayers = " 2c645270-77db-11e9-22c3-0f302a89c64c"
1919StatsBase = " 2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
20+ Tables = " bd369af6-aec1-5ad0-b16a-f7cc5008161c"
2021
2122[compat ]
2223ArchGDAL = " 0.9"
Original file line number Diff line number Diff line change 1+ # We are a Tables.jl provider
2+ Tables. istable (:: Type{T} ) where {T <: SimpleSDMLayer } = true
3+
4+ # We access data in a layer by rows (they are provided by iteration)
5+ Tables. rowaccess (:: Type{T} ) where {T <: SimpleSDMLayer } = true
6+
7+ #
8+ function Tables. schema (layer:: T ) where {T <: SimpleSDMLayer }
9+ lon_type = eltype (longitudes (layer))
10+ lat_type = eltype (latitudes (layer))
11+ elm_type = eltype (l)
12+ colnames = [:longitude , :latitude , :value ]
13+ coltypes = [lon_type, lat_type, elm_type]
14+ return Tables. schema (colnames, coltypes)
15+ end
16+
17+ function Tables. rows (layer:: T ) where {T <: SimpleSDMLayer }
18+ return layer
19+ end
20+
21+ function Tables. getcolumn (row, i:: Int )
22+ if i == 1
23+ return row. first[1 ]
24+ elseif i == 2
25+ return row. first[2 ]
26+ end
27+ return row. second
28+ end
29+
30+ function Tables. getcolumn (row, nm:: Symbol )
31+ if nm == :longitude
32+ return row. first[1 ]
33+ elseif nm == :latitude
34+ return row. first[2 ]
35+ end
36+ return row. second
37+ end
You can’t perform that action at this time.
0 commit comments