diff --git a/docs/Project.toml b/docs/Project.toml index 29477c5b4..812ca4382 100644 --- a/docs/Project.toml +++ b/docs/Project.toml @@ -20,3 +20,9 @@ Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" Tables = "bd369af6-aec1-5ad0-b16a-f7cc5008161c" Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d" + +[compat] +DocumenterVitepress = "0.2" + +[sources] +DimensionalData = { path = ".." } \ No newline at end of file diff --git a/docs/make.jl b/docs/make.jl index 2c4476e0e..92f10a900 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -33,7 +33,7 @@ makedocs(; sitename="DimensionalData", authors="Rafael Schouten et al.", # Deploy built documentation. # =========================== -deploydocs(; +DocumenterVitepress.deploydocs(; repo="github.com/rafaqz/DimensionalData.jl", target="build", # this is where Vitepress stores its output branch = "gh-pages", diff --git a/docs/package.json b/docs/package.json index 0a9a90de3..ee3a8eb98 100644 --- a/docs/package.json +++ b/docs/package.json @@ -6,7 +6,7 @@ "markdown-it": "^14.1.0", "markdown-it-mathjax3": "^4.3.2", "vitepress": "^1.6.3", - "vitepress-plugin-tabs": "^0.6.0" + "vitepress-plugin-tabs": "^0.7.1" }, "scripts": { "docs:dev": "vitepress dev build/.documenter", diff --git a/docs/src/.vitepress/config.mts b/docs/src/.vitepress/config.mts index 6926bc48e..f0503bf04 100644 --- a/docs/src/.vitepress/config.mts +++ b/docs/src/.vitepress/config.mts @@ -2,6 +2,7 @@ import { defineConfig } from 'vitepress' import { tabsMarkdownPlugin } from 'vitepress-plugin-tabs' import mathjax3 from "markdown-it-mathjax3"; import footnote from "markdown-it-footnote"; +import path from 'path' // import del from 'rollup-plugin-delete'; function getBaseRepository(base: string): string { if (!base) return '/'; @@ -56,6 +57,14 @@ export default defineConfig({ ['script', {src: `${baseTemp.base}siteinfo.js`}] ], vite: { + define: { + __DEPLOY_ABSPATH__: JSON.stringify('REPLACE_ME_DOCUMENTER_VITEPRESS_DEPLOY_ABSPATH'), + }, + resolve: { + alias: { + '@': path.resolve(__dirname, '../components') + } + }, build: { assetsInlineLimit: 0, // so we can tell whether we have created inlined images or not, we don't let vite inline them }, @@ -132,7 +141,7 @@ export default defineConfig({ }, socialLinks: [ - { icon: 'github', link: 'https://github.com/rafaqz/DimensionalData.jl' }, + // { icon: 'github', link: 'https://github.com/rafaqz/DimensionalData.jl' }, ], footer: { message: 'Made with DocumenterVitepress.jl', diff --git a/docs/src/.vitepress/theme/VersionPicker.vue b/docs/src/.vitepress/theme/VersionPicker.vue deleted file mode 100644 index b65054027..000000000 --- a/docs/src/.vitepress/theme/VersionPicker.vue +++ /dev/null @@ -1,142 +0,0 @@ - - - - - - - diff --git a/docs/src/.vitepress/theme/index.ts b/docs/src/.vitepress/theme/index.ts index cedccec82..83b6f4bc8 100644 --- a/docs/src/.vitepress/theme/index.ts +++ b/docs/src/.vitepress/theme/index.ts @@ -8,19 +8,22 @@ import { NolebaseEnhancedReadabilitiesScreenMenu, } from '@nolebase/vitepress-plugin-enhanced-readabilities/client' -import VersionPicker from "../../components/VersionPicker.vue" -import AuthorBadge from '../../components/AuthorBadge.vue' -import Authors from '../../components/Authors.vue' +import VersionPicker from "@/VersionPicker.vue" +import StarUs from '@/StarUs.vue' +import AuthorBadge from '@/AuthorBadge.vue' +import Authors from '@/Authors.vue' import { enhanceAppWithTabs } from 'vitepress-plugin-tabs/client' import '@nolebase/vitepress-plugin-enhanced-readabilities/client/style.css' -import './style.css' +import './style.css' // You could setup your own, or else a default will be copied. +import './docstrings.css' // You could setup your own, or else a default will be copied. export const Theme: ThemeConfig = { extends: DefaultTheme, Layout() { return h(DefaultTheme.Layout, null, { 'nav-bar-content-after': () => [ + h(StarUs), h(NolebaseEnhancedReadabilitiesMenu), // Enhanced Readabilities menu ], // A enhanced readabilities menu for narrower screens (usually smaller than iPad Mini) diff --git a/docs/src/components/StarUs.vue b/docs/src/components/StarUs.vue new file mode 100644 index 000000000..163726037 --- /dev/null +++ b/docs/src/components/StarUs.vue @@ -0,0 +1,95 @@ + + + + + + \ No newline at end of file diff --git a/docs/src/components/stargazers.data.ts b/docs/src/components/stargazers.data.ts new file mode 100644 index 000000000..ce7fe2875 --- /dev/null +++ b/docs/src/components/stargazers.data.ts @@ -0,0 +1,28 @@ +const REPO = "rafaqz/DimensionalData.jl"; + +export default { + async load() { + let stargazers_count; + try { + ({stargazers_count} = await github(`/repos/${REPO}`)); + } catch (error) { + if (process.env.CI) throw error; + stargazers_count = NaN; + } + return stargazers_count; + } +}; + +async function github( + path, + { + authorization = process.env.GITHUB_TOKEN && `token ${process.env.GITHUB_TOKEN}`, + accept = "application/vnd.github.v3+json" + } = {} +) { + const url = new URL(path, "https://api.github.com"); + const headers = {...(authorization && {authorization}), accept}; + const response = await fetch(url, {headers}); + if (!response.ok) throw new Error(`fetch error: ${response.status} ${url}`); + return await response.json(); +} \ No newline at end of file diff --git a/docs/src/index.md b/docs/src/index.md index b94e485a9..2c387ea1f 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -28,5 +28,6 @@ features: link: /groupby - title: Seamlessly integrated with the julia ecosystem details: Works with most methods that accept a regular Array. If a method accepts numeric indices or dims=X in base, you should be able to use DimensionalData.jl dims. + link: /integrations --- ``` diff --git a/src/Dimensions/dimension.jl b/src/Dimensions/dimension.jl index 2dade2618..c1493b439 100644 --- a/src/Dimensions/dimension.jl +++ b/src/Dimensions/dimension.jl @@ -34,8 +34,8 @@ A = DimArray(zeros(3, 5, 12), (y, x, ti)) ┌ 3×5×12 DimArray{Float64, 3} ┐ ├─────────────────────────────┴────────────────────────────────────────── dims ┐ - ↓ Y Categorical{Char} ['a', 'b', 'c'] ForwardOrdered, - → X Sampled{Int64} 2:2:10 ForwardOrdered Regular Points, + ↓ Y Categorical{Char} ['a', …, 'c'] ForwardOrdered, + → X Sampled{Int64} 2:2:10 ForwardOrdered Regular Points, ↗ Ti Sampled{DateTime} DateTime("2021-01-01T00:00:00"):Month(1):DateTime("2021-12-01T00:00:00") ForwardOrdered Regular Points └──────────────────────────────────────────────────────────────────────────────┘ [:, :, 1] @@ -62,8 +62,7 @@ x = A[X(2), Y(3)] 2021-03-01T00:00:00 0.0 2021-04-01T00:00:00 0.0 2021-05-01T00:00:00 0.0 - 2021-06-01T00:00:00 0.0 - 2021-07-01T00:00:00 0.0 + ⋮ 2021-08-01T00:00:00 0.0 2021-09-01T00:00:00 0.0 2021-10-01T00:00:00 0.0 @@ -80,7 +79,7 @@ x = A[X(Between(3, 4)), Y(At('b'))] ┌ 1×12 DimArray{Float64, 2} ┐ ├───────────────────────────┴──────────────────────────────────────────── dims ┐ - ↓ X Sampled{Int64} 4:2:4 ForwardOrdered Regular Points, + ↓ X Sampled{Int64} 4:2:4 ForwardOrdered Regular Points, → Ti Sampled{DateTime} DateTime("2021-01-01T00:00:00"):Month(1):DateTime("2021-12-01T00:00:00") ForwardOrdered Regular Points └──────────────────────────────────────────────────────────────────────────────┘ ↓ → 2021-01-01T00:00:00 2021-02-01T00:00:00 … 2021-12-01T00:00:00 @@ -379,7 +378,7 @@ with symbols, or e.g. creating Tables.jl keys. ```jldoctest; setup = :(using DimensionalData) julia> dim = Dim{:custom}(['a', 'b', 'c']) -custom ['a', 'b', 'c'] +custom ['a', …, 'c'] ``` """ struct Dim{S,T} <: Dimension{T} diff --git a/src/Lookups/lookup_arrays.jl b/src/Lookups/lookup_arrays.jl index 99ef38ca8..97026df90 100644 --- a/src/Lookups/lookup_arrays.jl +++ b/src/Lookups/lookup_arrays.jl @@ -293,10 +293,10 @@ A = ones(x, y) # output ┌ 5×4 DimArray{Float64, 2} ┐ -├──────────────────────────┴───────────────────────────────────────── dims ┐ +├──────────────────────────┴──────────────────────────────────────── dims ┐ ↓ X Sampled{Int64} 100:-20:20 ReverseOrdered Regular Intervals{Start}, - → Y Sampled{Int64} [1, 4, 7, 10] ForwardOrdered Regular Intervals{Start} -└──────────────────────────────────────────────────────────────────────────┘ + → Y Sampled{Int64} [1, …, 10] ForwardOrdered Regular Intervals{Start} +└─────────────────────────────────────────────────────────────────────────┘ ↓ → 1 4 7 10 100 1.0 1.0 1.0 1.0 80 1.0 1.0 1.0 1.0 @@ -513,8 +513,8 @@ Dimensions.lookup(A) # output -Categorical{String} ["one", "two", "three"] Unordered, -Categorical{Symbol} [:a, :b, :c, :d] ForwardOrdered +Categorical{String} ["one", …, "three"] Unordered, +Categorical{Symbol} [:a, …, :d] ForwardOrdered ``` """ struct Categorical{T,A<:AbstractVector{T},O<:Order,M} <: AbstractCategorical{T,O} diff --git a/src/Lookups/selector.jl b/src/Lookups/selector.jl index 9f8024d39..e4be55419 100644 --- a/src/Lookups/selector.jl +++ b/src/Lookups/selector.jl @@ -560,10 +560,10 @@ A[X(Between(15, 25)), Y(Between(4, 6.5))] # output ┌ 1×2 DimArray{Int64, 2} ┐ -├────────────────────────┴───────────────────────────── dims ┐ +├────────────────────────┴────────────────────────────── dims ┐ ↓ X Sampled{Int64} 20:10:20 ForwardOrdered Regular Points, → Y Sampled{Int64} 5:6 ForwardOrdered Regular Points -└────────────────────────────────────────────────────────────┘ +└─────────────────────────────────────────────────────────────┘ ↓ → 5 6 20 4 5 ``` @@ -815,10 +815,10 @@ A[X(Touches(15, 25)), Y(Touches(4, 6.5))] # output ┌ 1×2 DimArray{Int64, 2} ┐ -├────────────────────────┴───────────────────────────── dims ┐ +├────────────────────────┴────────────────────────────── dims ┐ ↓ X Sampled{Int64} 20:10:20 ForwardOrdered Regular Points, → Y Sampled{Int64} 5:6 ForwardOrdered Regular Points -└────────────────────────────────────────────────────────────┘ +└─────────────────────────────────────────────────────────────┘ ↓ → 5 6 20 4 5 ``` @@ -982,10 +982,10 @@ A[X(Where(x -> x > 15)), Y(Where(x -> x in (19, 21)))] # output ┌ 1×2 DimArray{Int64, 2} ┐ -├────────────────────────┴────────────────────────────── dims ┐ +├────────────────────────┴─────────────────────────────── dims ┐ ↓ X Sampled{Int64} [20] ForwardOrdered Irregular Points, → Y Sampled{Int64} [19, 21] ForwardOrdered Irregular Points -└─────────────────────────────────────────────────────────────┘ +└──────────────────────────────────────────────────────────────┘ ↓ → 19 21 20 4 6 ``` @@ -1024,8 +1024,8 @@ A[X=All(At(10.0), At(50.0)), Ti=All(1u"s"..10u"s", 90u"s"..100u"s")] ┌ 2×4 DimArray{Int64, 2} ┐ ├────────────────────────┴─────────────────────────────────────────────── dims ┐ - ↓ X Sampled{Float64} [10.0, 50.0] ForwardOrdered Irregular Points, - → Ti Sampled{Unitful.Quantity{Int64, 𝐓, Unitful.FreeUnits{(s,), 𝐓, nothing}}} [1 s, 6 s, 91 s, 96 s] ForwardOrdered Irregular Points + ↓ X Sampled{Float64} [10.0, 50.0] ForwardOrdered Irregular Points, + → Ti Sampled{Unitful.Quantity{Int64, 𝐓, Unitful.FreeUnits{(s,), 𝐓, nothing}}} [1 s, …, 96 s] ForwardOrdered Irregular Points └──────────────────────────────────────────────────────────────────────────────┘ ↓ → 1 s 6 s 91 s 96 s 10.0 1 2 19 20 diff --git a/src/array/array.jl b/src/array/array.jl index a20393fa4..250630579 100644 --- a/src/array/array.jl +++ b/src/array/array.jl @@ -402,17 +402,17 @@ julia> A = DimArray(rand(12,10), (ti, x), name="example"); julia> A[X(Near([12, 35])), Ti(At(DateTime(2001,5)))] ┌ 2-element DimArray{Float64, 1} example ┐ -├────────────────────────────────────────┴────────────── dims ┐ +├────────────────────────────────────────┴──────────────── dims ┐ ↓ X Sampled{Int64} [10, 40] ForwardOrdered Irregular Points -└─────────────────────────────────────────────────────────────┘ +└───────────────────────────────────────────────────────────────┘ 10 0.253849 40 0.637077 julia> A[Near(DateTime(2001, 5, 4)), Between(20, 50)] ┌ 4-element DimArray{Float64, 1} example ┐ -├────────────────────────────────────────┴──────────── dims ┐ +├────────────────────────────────────────┴────────────── dims ┐ ↓ X Sampled{Int64} 20:10:50 ForwardOrdered Regular Points -└───────────────────────────────────────────────────────────┘ +└─────────────────────────────────────────────────────────────┘ 20 0.774092 30 0.823656 40 0.637077 @@ -424,10 +424,10 @@ Generator expression: ```jldoctest dimarray julia> DimArray((x, y) for x in X(1:3), y in Y(1:2); name = :Value) ┌ 3×2 DimArray{Tuple{Int64, Int64}, 2} Value ┐ -├────────────────────────────────────────────┴──── dims ┐ +├────────────────────────────────────────────┴───── dims ┐ ↓ X Sampled{Int64} 1:3 ForwardOrdered Regular Points, → Y Sampled{Int64} 1:2 ForwardOrdered Regular Points -└───────────────────────────────────────────────────────┘ +└────────────────────────────────────────────────────────┘ ↓ → 1 2 1 (1, 1) (1, 2) 2 (2, 1) (2, 2) @@ -583,10 +583,10 @@ julia> rand(Bool, X(2), Y(4)) julia> rand(X([:a, :b, :c]), Y(100.0:50:200.0)) ┌ 3×3 DimArray{Float64, 2} ┐ -├──────────────────────────┴──────────────────────────────────── dims ┐ - ↓ X Categorical{Symbol} [:a, :b, :c] ForwardOrdered, +├──────────────────────────┴───────────────────────────────────── dims ┐ + ↓ X Categorical{Symbol} [:a, …, :c] ForwardOrdered, → Y Sampled{Float64} 100.0:50.0:200.0 ForwardOrdered Regular Points -└─────────────────────────────────────────────────────────────────────┘ +└──────────────────────────────────────────────────────────────────────┘ ↓ → 100.0 150.0 200.0 :a 0.443494 0.253849 0.867547 :b 0.745673 0.334152 0.0802658 @@ -624,10 +624,10 @@ julia> zeros(Bool, X(2), Y(4)) julia> zeros(X([:a, :b, :c]), Y(100.0:50:200.0)) ┌ 3×3 DimArray{Float64, 2} ┐ -├──────────────────────────┴──────────────────────────────────── dims ┐ - ↓ X Categorical{Symbol} [:a, :b, :c] ForwardOrdered, +├──────────────────────────┴───────────────────────────────────── dims ┐ + ↓ X Categorical{Symbol} [:a, …, :c] ForwardOrdered, → Y Sampled{Float64} 100.0:50.0:200.0 ForwardOrdered Regular Points -└─────────────────────────────────────────────────────────────────────┘ +└──────────────────────────────────────────────────────────────────────┘ ↓ → 100.0 150.0 200.0 :a 0.0 0.0 0.0 :b 0.0 0.0 0.0 @@ -666,10 +666,10 @@ julia> ones(Bool, X(2), Y(4)) julia> ones(X([:a, :b, :c]), Y(100.0:50:200.0)) ┌ 3×3 DimArray{Float64, 2} ┐ -├──────────────────────────┴──────────────────────────────────── dims ┐ - ↓ X Categorical{Symbol} [:a, :b, :c] ForwardOrdered, +├──────────────────────────┴───────────────────────────────────── dims ┐ + ↓ X Categorical{Symbol} [:a, …, :c] ForwardOrdered, → Y Sampled{Float64} 100.0:50.0:200.0 ForwardOrdered Regular Points -└─────────────────────────────────────────────────────────────────────┘ +└──────────────────────────────────────────────────────────────────────┘ ↓ → 100.0 150.0 200.0 :a 1.0 1.0 1.0 :b 1.0 1.0 1.0 @@ -796,13 +796,13 @@ placed at the end of `dims_new`. `others` contains other dimension pairs to be m julia> using DimensionalData julia> ds = (X(0:0.1:0.4), Y(10:10:100), Ti([0, 3, 4])) -(↓ X 0.0:0.1:0.4, -→ Y 10:10:100, -↗ Ti [0, 3, 4]) +(↓ X 0.0:0.1:0.4, +→ Y 10:10:100, +↗ Ti [0, …, 4]) julia> mergedims(ds, (X, Y) => :space) -(↓ Ti [0, 3, 4], -→ space MergedLookup{Tuple{Float64, Int64}} [(0.0, 10), (0.1, 10), …, (0.3, 100), (0.4, 100)] (↓ X, → Y)) +(↓ Ti [0, …, 4], +→ space MergedLookup{Tuple{Float64, Int64}} [(0.0, 10), …, (0.4, 100)] (↓ X, → Y)) ``` """ function mergedims(x, dt1::Tuple, dts::Tuple...) diff --git a/src/dimindices.jl b/src/dimindices.jl index 56388a05a..0f0305f72 100644 --- a/src/dimindices.jl +++ b/src/dimindices.jl @@ -54,10 +54,10 @@ are not in the same order. Or even if they are not all contained in each. ```jldoctest; setup = :(using DimensionalData, Random; Random.seed!(123)) julia> A = rand(Y(0.0:0.3:1.0), X('a':'f')) ┌ 4×6 DimArray{Float64, 2} ┐ -├──────────────────────────┴──────────────────────────────── dims ┐ +├──────────────────────────┴───────────────────────────────── dims ┐ ↓ Y Sampled{Float64} 0.0:0.3:0.9 ForwardOrdered Regular Points, → X Categorical{Char} 'a':1:'f' ForwardOrdered -└─────────────────────────────────────────────────────────────────┘ +└──────────────────────────────────────────────────────────────────┘ ↓ → 'a' 'b' 'c' 'd' 'e' 'f' 0.0 0.9063 0.253849 0.0991336 0.0320967 0.774092 0.893537 0.3 0.443494 0.334152 0.125287 0.350546 0.183555 0.354868 @@ -76,10 +76,10 @@ julia> di = DimIndices((X(1:2:4), Y(1:2:4))) julia> A[di] # Index A with these indices ┌ 2×2 DimArray{Float64, 2} ┐ -├──────────────────────────┴──────────────────────────────── dims ┐ +├──────────────────────────┴───────────────────────────────── dims ┐ ↓ Y Sampled{Float64} 0.0:0.6:0.6 ForwardOrdered Regular Points, → X Categorical{Char} 'a':2:'c' ForwardOrdered -└─────────────────────────────────────────────────────────────────┘ +└──────────────────────────────────────────────────────────────────┘ ↓ → 'a' 'c' 0.0 0.9063 0.0991336 0.6 0.745673 0.692209 @@ -212,10 +212,10 @@ julia> target = rand(X(1.0:10.0:30.0), Y(1.0:10.0:30.0)); julia> A[DimSelectors(target; selectors=Near), Ti=2] ┌ 3×3 DimArray{Float64, 2} ┐ -├──────────────────────────┴──────────────────────────────────────── dims ┐ - ↓ X Sampled{Float64} [1.0, 10.0, 22.0] ForwardOrdered Irregular Points, - → Y Sampled{Float64} [1.0, 11.0, 21.0] ForwardOrdered Irregular Points -└─────────────────────────────────────────────────────────────────────────┘ +├──────────────────────────┴────────────────────────────────────── dims ┐ + ↓ X Sampled{Float64} [1.0, …, 22.0] ForwardOrdered Irregular Points, + → Y Sampled{Float64} [1.0, …, 21.0] ForwardOrdered Irregular Points +└───────────────────────────────────────────────────────────────────────┘ ↓ → 1.0 11.0 21.0 1.0 0.691162 0.218579 0.539076 10.0 0.0303789 0.420756 0.485687 diff --git a/src/groupby.jl b/src/groupby.jl index 6ae48a8ad..af91d64e1 100644 --- a/src/groupby.jl +++ b/src/groupby.jl @@ -49,13 +49,14 @@ end function show_after(io::IO, mime, A::DimGroupByArray) displayheight, displaywidth = displaysize(io) blockwidth = get(io, :blockwidth, 0) + separatorwidth = min(displaywidth - 2, textwidth(sprint(summary, A)) + 2) if length(A) > 0 && isdefined(parent(A), 1) x = A[1] sorteddims = (dims(A)..., otherdims(x, dims(A))...) colordims = dims(map(rebuild, sorteddims, ntuple(dimcolor, Val(length(sorteddims)))), dims(x)) colors = collect(map(val, colordims)) lines, new_blockwidth, _ = print_dims_block(io, mime, basedims(x); - displaywidth, blockwidth, label="group dims", colors + displaywidth, blockwidth, separatorwidth, label="group dims", colors ) A1 = map(x -> DimSummariser(x, colors), A) ctx = IOContext(io, @@ -254,19 +255,17 @@ julia> A = rand(X(1:0.1:20), Y(1:20), Ti(DateTime(2000):Day(3):DateTime(2003))); julia> groups = groupby(A, Ti => month) # Group by month ┌ 12-element DimGroupByArray{DimArray{Float64,3},1} ┐ -├───────────────────────────────────────────────────┴───────────── dims ┐ - ↓ Ti Sampled{Int64} [1, 2, …, 11, 12] ForwardOrdered Irregular Points -├───────────────────────────────────────────────────────────── metadata ┤ +├───────────────────────────────────────────────────┴──────── dims ┐ + ↓ Ti Sampled{Int64} [1, …, 12] ForwardOrdered Irregular Points +├──────────────────────────────────────────────────────── metadata ┤ Dict{Symbol, Any} with 1 entry: :groupby => :Ti=>month -├─────────────────────────────────────────────────────────── group dims ┤ +├───────────────────────────────────────────────────┴── group dims ┐ ↓ X, → Y, ↗ Ti -└───────────────────────────────────────────────────────────────────────┘ +└──────────────────────────────────────────────────────────────────┘ 1 191×20×32 DimArray 2 191×20×28 DimArray - 3 191×20×31 DimArray ⋮ - 11 191×20×30 DimArray 12 191×20×31 DimArray ``` @@ -275,16 +274,15 @@ And take the mean: ```jldoctest groupby; setup = :(using Statistics) julia> groupmeans = mean.(groups) # Take the monthly mean ┌ 12-element DimArray{Float64, 1} ┐ -├─────────────────────────────────┴─────────────────────────────── dims ┐ - ↓ Ti Sampled{Int64} [1, 2, …, 11, 12] ForwardOrdered Irregular Points -├───────────────────────────────────────────────────────────── metadata ┤ +├─────────────────────────────────┴────────────────────────── dims ┐ + ↓ Ti Sampled{Int64} [1, …, 12] ForwardOrdered Irregular Points +├──────────────────────────────────────────────────────── metadata ┤ Dict{Symbol, Any} with 1 entry: :groupby => :Ti=>month -└───────────────────────────────────────────────────────────────────────┘ +└──────────────────────────────────────────────────────────────────┘ 1 0.500064 2 0.499762 3 0.500083 - 4 0.499985 ⋮ 10 0.500874 11 0.498704 @@ -304,18 +302,17 @@ Or do something else with Y: ```jldoctest groupby julia> groupmeans = mean.(groupby(A, Ti=>month, Y=>isodd)) ┌ 12×2 DimArray{Float64, 2} ┐ -├───────────────────────────┴────────────────────────────────────── dims ┐ - ↓ Ti Sampled{Int64} [1, 2, …, 11, 12] ForwardOrdered Irregular Points, - → Y Sampled{Bool} [false, true] ForwardOrdered Irregular Points -├────────────────────────────────────────────────────────────── metadata ┤ +├───────────────────────────┴──────────────────────────────── dims ┐ + ↓ Ti Sampled{Int64} [1, …, 12] ForwardOrdered Irregular Points, + → Y Sampled{Bool} [false, true] ForwardOrdered Irregular Points +├──────────────────────────────────────────────────────── metadata ┤ Dict{Symbol, Any} with 1 entry: :groupby => (:Ti=>month, :Y=>isodd) -└────────────────────────────────────────────────────────────────────────┘ +└──────────────────────────────────────────────────────────────────┘ ↓ → false true 1 0.499594 0.500533 2 0.498145 0.501379 ⋮ - 10 0.501105 0.500644 11 0.498606 0.498801 12 0.501643 0.499298 ``` diff --git a/src/set.jl b/src/set.jl index 58df6acf7..c55ba4338 100644 --- a/src/set.jl +++ b/src/set.jl @@ -42,10 +42,10 @@ julia> da = DimArray(zeros(3, 4), (custom=10.0:010.0:30.0, Z=-20:010.0:10.0)); julia> set(da, ones(3, 4)) ┌ 3×4 DimArray{Float64, 2} ┐ -├──────────────────────────┴──────────────────────────────────────── dims ┐ +├──────────────────────────┴───────────────────────────────────────── dims ┐ ↓ custom Sampled{Float64} 10.0:10.0:30.0 ForwardOrdered Regular Points, - → Z Sampled{Float64} -20.0:10.0:10.0 ForwardOrdered Regular Points -└─────────────────────────────────────────────────────────────────────────┘ + → Z Sampled{Float64} -20.0:10.0:10.0 ForwardOrdered Regular Points +└──────────────────────────────────────────────────────────────────────────┘ ↓ → -20.0 -10.0 0.0 10.0 10.0 1.0 1.0 1.0 1.0 20.0 1.0 1.0 1.0 1.0 @@ -57,10 +57,10 @@ Change the `Dimension` wrapper type: ```jldoctest set julia> set(da, :Z => Ti, :custom => Z) ┌ 3×4 DimArray{Float64, 2} ┐ -├──────────────────────────┴──────────────────────────────────── dims ┐ - ↓ Z Sampled{Float64} 10.0:10.0:30.0 ForwardOrdered Regular Points, +├──────────────────────────┴───────────────────────────────────── dims ┐ + ↓ Z Sampled{Float64} 10.0:10.0:30.0 ForwardOrdered Regular Points, → Ti Sampled{Float64} -20.0:10.0:10.0 ForwardOrdered Regular Points -└─────────────────────────────────────────────────────────────────────┘ +└──────────────────────────────────────────────────────────────────────┘ ↓ → -20.0 -10.0 0.0 10.0 10.0 0.0 0.0 0.0 0.0 20.0 0.0 0.0 0.0 0.0 @@ -72,10 +72,10 @@ Change the lookup `Vector`: ```jldoctest set julia> set(da, Z => [:a, :b, :c, :d], :custom => [4, 5, 6]) ┌ 3×4 DimArray{Float64, 2} ┐ -├──────────────────────────┴──────────────────────────────────────── dims ┐ - ↓ custom Sampled{Int64} [4, 5, 6] ForwardOrdered Regular Points, - → Z Sampled{Symbol} [:a, :b, :c, :d] ForwardOrdered Regular Points -└─────────────────────────────────────────────────────────────────────────┘ +├──────────────────────────┴────────────────────────────────── dims ┐ + ↓ custom Sampled{Int64} [4, …, 6] ForwardOrdered Regular Points, + → Z Sampled{Symbol} [:a, …, :d] ForwardOrdered Regular Points +└───────────────────────────────────────────────────────────────────┘ ↓ → :a :b :c :d 4 0.0 0.0 0.0 0.0 5 0.0 0.0 0.0 0.0 @@ -87,10 +87,10 @@ Change the `Lookup` type: ```jldoctest set julia> set(da, Z=DD.NoLookup(), custom=DD.Sampled()) ┌ 3×4 DimArray{Float64, 2} ┐ -├──────────────────────────┴──────────────────────────────────────── dims ┐ +├──────────────────────────┴───────────────────────────────────────── dims ┐ ↓ custom Sampled{Float64} 10.0:10.0:30.0 ForwardOrdered Regular Points, → Z -└─────────────────────────────────────────────────────────────────────────┘ +└──────────────────────────────────────────────────────────────────────────┘ 10.0 0.0 0.0 0.0 0.0 20.0 0.0 0.0 0.0 0.0 30.0 0.0 0.0 0.0 0.0 @@ -101,10 +101,10 @@ Change the `Sampling` trait: ```jldoctest set julia> set(da, :custom => DD.Irregular(10, 12), Z => DD.Regular(9.9)) ┌ 3×4 DimArray{Float64, 2} ┐ -├──────────────────────────┴────────────────────────────────────────── dims ┐ +├──────────────────────────┴─────────────────────────────────────────── dims ┐ ↓ custom Sampled{Float64} 10.0:10.0:30.0 ForwardOrdered Irregular Points, - → Z Sampled{Float64} -20.0:10.0:10.0 ForwardOrdered Regular Points -└───────────────────────────────────────────────────────────────────────────┘ + → Z Sampled{Float64} -20.0:10.0:10.0 ForwardOrdered Regular Points +└────────────────────────────────────────────────────────────────────────────┘ ↓ → -20.0 -10.0 0.0 10.0 10.0 0.0 0.0 0.0 0.0 20.0 0.0 0.0 0.0 0.0 diff --git a/src/stack/methods.jl b/src/stack/methods.jl index 7e684ba84..d4d5108be 100644 --- a/src/stack/methods.jl +++ b/src/stack/methods.jl @@ -74,7 +74,7 @@ julia> map(dims, axes(slices)) julia> first(slices) ┌ 3×5 DimStack ┐ ├──────────────┴─────────────────────────────────── dims ┐ - ↓ Y Sampled{Int64} 1:3 ForwardOrdered Regular Points, + ↓ Y Sampled{Int64} 1:3 ForwardOrdered Regular Points, → Ti ├──────────────────────────────────────────────── layers ┤ :x eltype: Float64 dims: Y size: 3 diff --git a/src/tables.jl b/src/tables.jl index 9773a8495..6fa62e1a9 100644 --- a/src/tables.jl +++ b/src/tables.jl @@ -77,8 +77,7 @@ julia> a = DimArray(ones(16, 16, 3), (X, Y, Dim{:band})) 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 … 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 - 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 - 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 + ⋮ ⋮ ⋱ ⋮ ⋮ 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 … 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0