JuliaDataCubes / JuliaDataCubes/YAXArrays.jl

Opening netcdf file without using NetCDF gives confusing error

Open
#82 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Julia
Stars
132
Forks
25
PR merge metrics
No merged PRs in 30d

Description

When I try to open a netcdf file with Cube without loading the NetCDF package before hand this fails with a confusing error.
I think, we can catch this earlier and give a more informative error message.

julia> wcormedian3 = Cube("data/cubes/s1cube_jurua_vh_smallchunks_wcor_median3.nc")ERROR: ArgumentError: Path data/cubes/s1cube_jurua_vh_smallchunks_wcor_median3.nc is not a directory.
Stacktrace:
  [1] storefromstring(s::String, create::Bool)
    @ Zarr ~/.julia/packages/Zarr/2V5d9/src/ZGroup.jl:103
  [2] zopen(s::String, mode::String; kwargs::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ Zarr ~/.julia/packages/Zarr/2V5d9/src/ZGroup.jl:91
  [3] zopen (repeats 2 times)
    @ ~/.julia/packages/Zarr/2V5d9/src/ZGroup.jl:91 [inlined]
  [4] YAXArrayBase.ZarrDataset(g::String)
    @ YAXArrayBase ~/.julia/packages/YAXArrayBase/OgYsV/src/datasets/zarr.jl:7
  [5] to_dataset(T::Type{YAXArrayBase.ZarrDataset}, g::String)
    @ YAXArrayBase ~/.julia/packages/YAXArrayBase/OgYsV/src/datasets/datasetinterface.jl:76
  [6] to_dataset(g::String; driver::Symbol)
    @ YAXArrayBase ~/.julia/packages/YAXArrayBase/OgYsV/src/datasets/datasetinterface.jl:72
  [7] to_dataset(g::String; driver::Symbol)
    @ YAXArrayBase ~/.julia/packages/YAXArrayBase/OgYsV/src/datasets/datasetinterface.jl:70
  [8] open_dataset(g::String; driver::Symbol)
    @ YAXArrays.Datasets ~/.julia/dev/YAXArrays/src/DatasetAPI/Datasets.jl:173
  [9] open_dataset
    @ ~/.julia/dev/YAXArrays/src/DatasetAPI/Datasets.jl:173 [inlined]
 [10] #Cube#79
    @ ~/.julia/dev/YAXArrays/src/DatasetAPI/Datasets.jl:415 [inlined]
 [11] Cube(s::String)
    @ YAXArrays.Datasets ~/.julia/dev/YAXArrays/src/DatasetAPI/Datasets.jl:415
 [12] top-level scope
    @ REPL[185]:1

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

Start at YAXArrays/src/DatasetAPI/Datasets.jl, especially open_dataset and Cube, and trace how a .nc path is handled when the NetCDF package has not been loaded. Check the existing dataset-opening tests, if present, and make the failure identify the missing NetCDF support instead of reporting that the path is not a directory.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.