Skip to content

Commit 03a89a2

Browse files
committed
docs: add package overview, installation guide and usage examples to README
1 parent ecb761a commit 03a89a2

File tree

4 files changed

+63
-15
lines changed

4 files changed

+63
-15
lines changed

README.md

Lines changed: 45 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,46 @@
1-
# CommonDataFormat
1+
# CommonDataFormat.jl
22

3-
[![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://Beforerr.github.io/CommonDataFormat.jl/stable/)
4-
[![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://Beforerr.github.io/CommonDataFormat.jl/dev/)
5-
[![Build Status](https://github.com/Beforerr/CommonDataFormat.jl/actions/workflows/CI.yml/badge.svg?branch=main)](https://github.com/Beforerr/CommonDataFormat.jl/actions/workflows/CI.yml?query=branch%3Amain)
6-
[![Coverage](https://codecov.io/gh/Beforerr/CommonDataFormat.jl/branch/main/graph/badge.svg)](https://codecov.io/gh/Beforerr/CommonDataFormat.jl)
3+
[![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://juliaspacephysics.github.io/CommonDataFormat.jl/dev/)
4+
[![Build Status](https://github.com/JuliaSpacePhysics/CommonDataFormat.jl/actions/workflows/CI.yml/badge.svg?branch=main)](https://github.com/JuliaSpacePhysics/CommonDataFormat.jl/actions/workflows/CI.yml?query=branch%3Amain)
5+
[![Coverage](https://codecov.io/gh/JuliaSpacePhysics/CommonDataFormat.jl/branch/main/graph/badge.svg)](https://codecov.io/gh/JuliaSpacePhysics/CommonDataFormat.jl)
6+
7+
A Julia package for reading Common Data Format (CDF) files, widely used in space physics and other scientific domains for storing multidimensional data arrays and metadata.
8+
9+
## Features
10+
11+
- **Pure Julia implementation** - No external dependencies on CDF libraries
12+
- **Efficient data access** - Lazy loading and direct variable indexing
13+
14+
## Installation
15+
16+
```julia
17+
using Pkg
18+
Pkg.add("CommonDataFormat")
19+
```
20+
21+
## Quick Start
22+
23+
```julia
24+
using CommonDataFormat
25+
26+
# Load a CDF file
27+
cdf = CDFDataset("data.cdf")
28+
29+
# Access basic information
30+
println("CDF version: ", cdf.version)
31+
println("Data majority: ", cdf.majority)
32+
println("Compression: ", cdf.compression)
33+
34+
# List all variables
35+
println("Variables: ", keys(cdf))
36+
37+
# Access a variable
38+
var = cdf["temperature"]
39+
println("Variable data: ", var.data)
40+
println("Data type: ", var.data_type)
41+
println("Dimensions: ", var.dimensions)
42+
```
43+
44+
## Elsewhere
45+
46+
- [CDFpp](https://github.com/SciQLop/CDFpp): A modern C++ header only cdf library with Python bindings

docs/make.jl

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,14 @@ makedocs(;
88
authors="Beforerr <zzj956959688@gmail.com> and contributors",
99
sitename="CommonDataFormat.jl",
1010
format=Documenter.HTML(;
11-
canonical="https://Beforerr.github.io/CommonDataFormat.jl",
12-
edit_link="main",
13-
assets=String[],
11+
canonical="https://juliaspacephysics.github.io/CommonDataFormat.jl",
1412
),
1513
pages=[
1614
"Home" => "index.md",
1715
],
1816
)
1917

2018
deploydocs(;
21-
repo="github.com/Beforerr/CommonDataFormat.jl",
19+
repo="github.com/JuliaSpacePhysics/CommonDataFormat.jl",
2220
devbranch="main",
2321
)

docs/src/index.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22
CurrentModule = CommonDataFormat
33
```
44

5-
# CommonDataFormat
5+
# CommonDataFormat.jl
66

7-
Documentation for [CommonDataFormat](https://github.com/Beforerr/CommonDataFormat.jl).
7+
A Julia package for reading Common Data Format (CDF) files.
8+
9+
## API Reference
810

911
```@index
1012
```

test/runtests.jl

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,14 @@ const PROJECT_DATA_PATH = joinpath(@__DIR__, "..", "data")
1212
# include("basic_tests.jl")
1313
# include("cdf_file_tests.jl")
1414

15+
function data_path(name)
16+
for dir in [CDFpp_TEST_DATA_PATH, CDFlib_TEST_DATA_PATH, PROJECT_DATA_PATH]
17+
path = joinpath(dir, name)
18+
isfile(path) && return path
19+
end
20+
error("Data file not found: $name")
21+
end
22+
1523
function check_cdf_file(cdf, version, majority, compression)
1624
@test cdf.version == version
1725
@test cdf.majority == majority
@@ -25,25 +33,25 @@ function check_variables(cdf)
2533
end
2634

2735
@testset "Uncompressed cdf file" begin
28-
file = joinpath(CDFpp_TEST_DATA_PATH, "a_cdf.cdf")
36+
file = data_path("a_cdf.cdf")
2937
ds = CDFDataset(file)
3038
check_cdf_file(ds, (3, 9, 0), CDF.Row, CDF.NoCompression)
3139
end
3240

3341
@testset "CHECK_VARIABLES - Variable structure verification" begin
34-
file = joinpath(PROJECT_DATA_PATH, "omni_coho1hr_merged_mag_plasma_20240901_v01.cdf")
42+
file = data_path("omni_coho1hr_merged_mag_plasma_20240901_v01.cdf")
3543
ds = CDFDataset(file)
3644
@test keys(ds) == ["Epoch", "heliographicLatitude", "heliographicLongitude", "BR", "BT", "BN", "ABS_B", "V", "elevAngle", "azimuthAngle", "N", "T"]
3745
@test ds["BR"].data[1:3] == Float32[6.7, 6.7, 7.3]
3846
end
3947

4048
@testset "CHECK_VARIABLES - CDF_CHAR" begin
41-
file = joinpath(PROJECT_DATA_PATH, "ge_h0_cpi_00000000_v01.cdf")
49+
file = data_path("ge_h0_cpi_00000000_v01.cdf")
4250
ds = CDFDataset(file)
4351
@info ds["label_v3c"]
4452
end
4553
@testset "CHECK_VARIABLES - Variable structure verification" begin
46-
file = joinpath(CDFpp_TEST_DATA_PATH, "a_cdf.cdf")
54+
file = data_path("a_cdf.cdf")
4755
ds = CDFDataset(file)
4856

4957
# Check total number of variables (should be 18 as per C++)

0 commit comments

Comments
 (0)