Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Breaking: preservedims in tables #917

Open
wants to merge 22 commits into
base: breaking
Choose a base branch
from
Open

Breaking: preservedims in tables #917

wants to merge 22 commits into from

Conversation

rafaqz
Copy link
Owner

@rafaqz rafaqz commented Jan 30, 2025

Forgot to PR this a while ago

Closes #896

@asinghvi17 want to review?

@asinghvi17
Copy link
Collaborator

Will test it out, thanks! @alex-s-gardner this is thing number 1 for saving glacier height histogram as GeoJSON

@asinghvi17
Copy link
Collaborator

This works on this branch but fails when I merge it with master, just FYI

@asinghvi17
Copy link
Collaborator

Also this kind of works the other way around than I had expected, I thought that preservedims would make the dimarray of that dimension, but it makes a dimarray of the other dimensions. See this example:

julia> da = @d sin.(hypot.(X(LinRange(-9,9,100)), Y(LinRange(0, 18, 100))) .+ Ti(LinRange(0, 6pi, 100)))
┌ 100×100×100 DimArray{Float64, 3} ┐
├──────────────────────────────────┴─────────────────────────────────────────────────────────────────────────────── dims ┐
  ↓ X  Sampled{Float64} LinRange{Float64}(-9.0, 9.0, 100) ForwardOrdered Regular Points,
  → Y  Sampled{Float64} LinRange{Float64}(0.0, 18.0, 100) ForwardOrdered Regular Points,
  ↗ Ti Sampled{Float64} LinRange{Float64}(0.0, 18.84955592153876, 100) ForwardOrdered Regular Points
└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
[:, :, 1]
 ⋮      ⋱  

julia> DimTable(da; preservedims=(Ti,))
DimTable with 100 rows, 2 columns, and schema:
 :Ti      …  Float64
 :layer1     DimMatrix{Float64, Tuple{X{Sampled{Float64, LinRange{Float64, Int64}, ForwardOrdered, Regular{Float64}, Points, NoMetadata}}, Y{Sampled{Float64, LinRange{Float64, Int64}, ForwardOrdered, Regular{Float64}, Points, NoMetadata}}}, Tuple{Ti{Sampled{Float64, LinRange{Float64, Int64}, ForwardOrdered, Regular{Float64}, Points, NoMetadata}}}, SubArray{Float64, 2, Array{Float64, 3}, Tuple{Slice{OneTo{Int64}}, Slice{OneTo{Int64}}, Int64}, true}, Symbol, NoMetadata}

where I would have expected the dimtable to have columns (X, Y, layer1) where layer1 was a vector of DimVectors in Ti.

@rafaqz
Copy link
Owner Author

rafaqz commented Jan 31, 2025

Thats what I thought it did too 😆

@rafaqz rafaqz changed the title preservedims in tables Breaking: preservedims in tables Feb 17, 2025
Copy link

codecov bot commented Mar 8, 2025

Codecov Report

Attention: Patch coverage is 81.78808% with 55 lines in your changes missing coverage. Please review.

Project coverage is 80.81%. Comparing base (80954d7) to head (a8ebd86).

Files with missing lines Patch % Lines
src/dimindices.jl 87.50% 17 Missing ⚠️
src/array/indexing.jl 70.27% 11 Missing ⚠️
src/array/broadcast.jl 62.96% 10 Missing ⚠️
src/groupby.jl 84.78% 7 Missing ⚠️
src/array/array.jl 80.00% 5 Missing ⚠️
src/tables.jl 86.66% 2 Missing ⚠️
src/Dimensions/dimension.jl 0.00% 1 Missing ⚠️
src/Lookups/lookup_arrays.jl 75.00% 1 Missing ⚠️
src/opaque.jl 83.33% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #917      +/-   ##
==========================================
+ Coverage   80.60%   80.81%   +0.21%     
==========================================
  Files          54       55       +1     
  Lines        5130     5208      +78     
==========================================
+ Hits         4135     4209      +74     
- Misses        995      999       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@rafaqz rafaqz changed the base branch from main to breaking March 8, 2025 23:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add the option to not "expand"/flatten dimensions in DimTable
2 participants