YAXArrays.jl
YAXArrays.jl copied to clipboard
[Draft] Add CF conventions in YAXArray to use in plots
This PR aims to utilize CF conventions to generate name and label of a YAXArray.
Enables to use CF meta data in heatmap plots, see https://github.com/rafaqz/DimensionalData.jl/pull/989.
Implements same behavior as of python xarray.
Like named DimArrays, this will also add the name to Base.show, if the CF metadata if present:
Closing #393 would improve the axis labels.
╭───────────────────────────────────────────────────╮
│ 4×5 YAXArray{Int64,2} global mean air temperature │
├───────────────────────────────────────────────────┴────────────── dims ┐
↓ X Sampled{Float64} 1.0:1.0:4.0 ForwardOrdered Regular Points,
→ YVals Sampled{Int64} [1, 2, 3, 4, 5] ForwardOrdered Irregular Points
├────────────────────────────────────────────────────────────── metadata ┤
Dict{String, String} with 3 entries:
"units" => "K"
"long_name" => "global mean air temperature"
"standard_name" => "air_temperature"
├────────────────────────────────────────────────────── loaded in memory ┤
data size: 160.0 bytes
└────────────────────────────────────────────────────────────────────────┘
plot(a_cfa)
See testset "YAXArrays with CF conventions" for further details.
Codecov Report
Attention: Patch coverage is 54.83871% with 28 lines in your changes missing coverage. Please review.
Project coverage is 73.81%. Comparing base (
1069fa1) to head (dab169e).
| Files with missing lines | Patch % | Lines |
|---|---|---|
| src/Cubes/Cubes.jl | 54.83% | 28 Missing :warning: |
Additional details and impacted files
@@ Coverage Diff @@
## master #501 +/- ##
==========================================
+ Coverage 73.67% 73.81% +0.14%
==========================================
Files 12 12
Lines 1865 1875 +10
==========================================
+ Hits 1374 1384 +10
Misses 491 491
| Files with missing lines | Coverage Δ | |
|---|---|---|
| src/Cubes/Cubes.jl | 52.76% <54.83%> (+2.09%) |
:arrow_up: |
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
BUG in scatter plot but not inb lines plot: No method matching project_position(,..., DiskArrays.BlockedIndices) required for Makie.plot in unidata example.nc.
From the docs failures it seems as if this broke somehow the AlgebraOfGraphics functionality. Apart from that it looks good to me.
AlgebraOfGraphics creates a DimStack using the name for its type. I changed the name function to always return a Symbol.
- error in 1D lines plot:
Makie.number_to_date(::Type{DateTime360Day}, i)not implemented - error in 1D scatter plot:
no method matching _indices_sub(::DiskArrays.BlockedIndices{DiskArrays.GridChunks{1, Tuple{DiskArrays.RegularChunks}}}
AoG errors might be unrelated to this PR, probably more an internal AoG change, I will take a look later.
DimensionalData v0.29.16 + is required to show colorbar label. However, YAXArrays allows below as DD 0.27.
mmm .. 0.29 flavours are allow.
DimensionalData = "0.27, 0.28, 0.29"
Whats is the status for this PR. Is is ready for a final review or still in draft stage?