JuliaDataCubes / JuliaDataCubes/EarthDataLab.jl

Axes are cubes: values not readable by mapCube

Open
#108 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Julia
Stars
34
Forks
14
PR merge metrics
No merged PRs in 30d

Description

c=Cube("/scratch/DataCube/v1.0.2/esdc-8d-0.25deg-46x90x90-1.0.2_1/")
d=getCubeData(c,variable=["fapar_tip", "gross_primary_productivity", "transpiration"],time=2001:2011, region="Europe")

function spatialAggregation(xout, xin, latitudes)
  show(latitudes)
end

latitudecube = ESDL.getAxis("Lat",d)

indims_map = InDims("Lon", "Lat")
indims_lat = InDims("Lat")
outdims    = OutDims()
mapCube(spatialAggregation, (d,latitudecube), indims = (indims_map, indims_lat), outdims = outdims);

This example from the documentation, from the chapter "Axes are Cubes" throws the following error for me:

MethodError: no method matching _read(::RangeAxis{Float64,:Lat,StepRangeLen{Float64,Base.TwicePrecision{Float64},Base.TwicePrecision{Float64}}}, ::SubArray{Float64,1,Array{Float64,1},Tuple{UnitRange{Int64}},true}, ::CartesianIndices{1,Tuple{UnitRange{Int64}}})
Closest candidates are:
  _read(!Matched::CubeMem, ::AbstractArray, ::CartesianIndices) at /Net/Groups/BGI/scratch/mgutwin/julia_atacama_depots/packages/ESDL/7FhrN/src/Cubes/Cubes.jl:134
  _read(!Matched::ESDL.Cubes.MmapCube, ::AbstractArray, ::CartesianIndices{N,R} where R<:Tuple{Vararg{AbstractUnitRange{Int64},N}}) where N at /Net/Groups/BGI/scratch/mgutwin/julia_atacama_depots/packages/ESDL/7FhrN/src/Cubes/MmapCubes.jl:76
  _read(!Matched::NetCDFCube{T,N}, ::AbstractArray, ::CartesianIndices{N,R} where R<:Tuple{Vararg{AbstractUnitRange{Int64},N}}) where {T, N} at /Net/Groups/BGI/scratch/mgutwin/julia_atacama_depots/packages/ESDL/7FhrN/src/Cubes/NetCDFCubes.jl:41

Probably a missing method or did I get the wrong idea about axes being treated as cubes?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the documented “Axes are Cubes” example with mapCube and the Lat axis. Inspect the _read dispatches referenced in Cubes.jl, MmapCubes.jl, and NetCDFCubes.jl, focusing on the RangeAxis error. Done means the example runs and spatialAggregation can read and show the latitude values without the MethodError.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
data
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.