Skip to content

Commit

Permalink
more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander-Barth committed Feb 15, 2024
1 parent cf60208 commit 026226e
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# ZarrDatasets

[![Build Status](https://github.com/JuliaGeo/ZarrDatasets.jl/actions/workflows/CI.yml/badge.svg?branch=main)](https://github.com/JuliaGeo/ZarrDatasets.jl/actions/workflows/CI.yml?query=branch%3Amain)
[![Build Status](https://github.com/JuliaGeo/ZarrDatasets.jl/workflows/CI/badge.svg)](https://github.com/JuliaGeo/ZarrDatasets.jl/actions)
[![codecov.io](http://codecov.io/github/JuliaGeo/ZarrDatasets.jl/coverage.svg?branch=main)](http://app.codecov.io/github/JuliaGeo/ZarrDatasets.jl?branch=main)
[![documentation dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://juliageo.github.io/ZarrDatasets.jl/dev/)
Expand All @@ -9,7 +8,7 @@
ZarrDatasets.jl is a julia package to read [Zarr](https://zarr.dev/) datasets using the native julia implementation [Zarr.jl](https://github.com/JuliaIO/Zarr.jl)
using the [CommonDataModel.jl](https://github.com/JuliaGeo/CommonDataModel.jl) interface.

In the following example data from [Copernicus marine service](https://marine.copernicus.eu/) are loaded using `ZarrDatasets` and a subset
In the following example, data from [Copernicus Marine Service](https://marine.copernicus.eu/) is loaded using `ZarrDatasets` and a subset
is saved as a NetCDF file:


Expand Down
2 changes: 1 addition & 1 deletion src/dataset.jl
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ CDM.group(ds::ZarrDataset,name::SymbolOrString) = ZarrDataset(ds.zgroup.groups,S


CDM.parentdataset(ds::ZarrDataset) = ds.parentdataset
CDM.iswritable(ds::ZarrDataset) = true
CDM.iswritable(ds::ZarrDataset) = false
CDM.maskingvalue(ds::ZarrDataset) = ds.maskingvalue


Expand Down
3 changes: 2 additions & 1 deletion test/Project.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
[deps]
CommonDataModel = "1fbeeb36-5f17-413c-809b-666fb144f157"
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
NCDatasets = "85f8d34a-cbdd-5861-8df4-14fed0d494ab"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[compat]
julia = "1"
NCDatasets = "0.14"
julia = "1"
10 changes: 10 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ using Dates
using NCDatasets
using Test
using ZarrDatasets
using CommonDataModel: iswritable, attribnames, parentdataset

@testset "ZarrDatasets.jl" begin
#fname = "/tmp/foo.zarr"
Expand Down Expand Up @@ -44,6 +45,15 @@ using ZarrDatasets
@test ds2.attrib[attribname] == attribval
end

io = IOBuffer()
show(io,ds)
str = String(take!(io))
@test occursin("title",str)

@test !iswritable(ds)
@test "title" in attribnames(ds)
@test isnothing(parentdataset(ds))

close(ds)
close(ds2)
end

0 comments on commit 026226e

Please sign in to comment.