Skip to content

Commit e685200

Browse files
authored
Merge pull request #136 from JohnLCaron/testFixtures
Move testdata module into testFixtures in the core.
2 parents b5bfe0d + 20b29a6 commit e685200

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+1670
-162
lines changed

.idea/gradle.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Readme.md

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,26 @@
11
# netchdf
2-
_last updated: 5/22/2025_
2+
_last updated: 5/24/2025_
33

44
This is a rewrite in Kotlin of parts of the devcdm and netcdf-java libraries.
55

66
The intention is to create a maintainable, read-only, pure JVM library allowing full access to
7-
netcdf3, netcdf4, hdf4, hdf5, hdf-eos2 and hdf-eos5 data files.
7+
netcdf3, netcdf4, hdf4, hdf5, hdf-eos2, and hdf-eos5 data files.
88

99
Please contact me if you'd like to help out. Especially needed are test datasets from all the important data archives!!
1010

11+
## Building
12+
13+
* Download Java 21 JDK and set JAVA_HOME.
14+
* Download git and add to PATH.
15+
16+
cd <your_build_dir>
17+
git clone https://github.com/JohnLCaron/netchdf.git
18+
cd netchdf
19+
./gradlew clean assemble
20+
21+
Also see:
22+
* [Building and Running ncdump](clibs/Readme.md)
23+
1124
### Why this library?
1225

1326
There is so much important scientific data stored in the NetCDF and HDF file formats, that those formats will
@@ -87,7 +100,6 @@ Currently that is Gradle 8.14.
87100
For now, you must download and build the library yourself. Eventually we will publish it to Maven Central.
88101
The IntelliJ IDE is highly recommended for all JVM development.
89102

90-
91103
### Scope
92104

93105
Our goal is to give read access to all the content in NetCDF, HDF5, HDF4, and HDF-EOS files.
@@ -128,16 +140,17 @@ only supported for test purposes.
128140
Currently we have ~1500 test files:
129141

130142
````
131-
hdf4 = 205 files
132-
hdf-eos2 = 267 files
133-
hdf5 = 113 files
134-
hdf-eos5 = 18 files
135-
netcdf3 = 664 files
136-
netcdf3.2 = 81 files
137-
netcdf3.5 = 1 files
138-
netcdf4 = 121 files
139-
````
140-
143+
hdf-eos2 = 267 files
144+
hdf-eos5 = 18 files
145+
hdf4 = 205 files
146+
hdf5 = 113 files
147+
netcdf3 = 664 files
148+
netcdf3.2 = 81 files
149+
netcdf3.5 = 1 files
150+
netcdf4 = 121 files
151+
152+
total # files = 1470
153+
````
141154
We need to get representative samples of recent files for improved testing and code coverage.
142155

143156
### Data Model notes

cli/Readme.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Netchdf Command Line Interface
2+
5/24/2025
3+
4+
## Building
5+
6+
cd <your_build_dir>
7+
clone https://github.com/JohnLCaron/netchdf.git
8+
cd netchdf
9+
./gradlew clean assemble
10+
./gradlew :cli:uberJar
11+
12+
## Running ncdump
13+
14+
cd cli/build/libs
15+
java -jar netchdf-uber.jar --filename your_file

cli/build.gradle.kts

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
plugins {
2+
alias(libs.plugins.kotlin.jvm)
3+
}
4+
5+
dependencies {
6+
api(project(":core"))
7+
8+
implementation(libs.kotlinx.cli)
9+
implementation(libs.oshai.logging)
10+
implementation(libs.logback.classic)
11+
}
12+
13+
kotlin {
14+
jvmToolchain(21)
15+
}
16+
17+
tasks.register<Jar>("uberJar") {
18+
archiveClassifier = "uber"
19+
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
20+
archiveBaseName.set("netchdf")
21+
22+
manifest {
23+
attributes("Main-Class" to "com.sunya.netchdf.cli.ncdump")
24+
}
25+
26+
from(sourceSets.main.get().output)
27+
dependsOn(configurations.runtimeClasspath)
28+
from({
29+
configurations.runtimeClasspath.get().filter { it.name.endsWith("jar") }.map { zipTree(it) }
30+
})
31+
}

testdata/src/main/kotlin/com/sunya/netchdf/cli/ncdump.kt renamed to cli/src/main/kotlin/com/sunya/netchdf/cli/ncdump.kt

File renamed without changes.

clibs/build.gradle.kts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
plugins {
22
alias(libs.plugins.kotlin.jvm)
3+
id ("java-test-fixtures")
34
}
45

56
dependencies {
67
api(project(":core"))
7-
implementation(project(":testdata"))
8+
// implementation(project(":testdata"))
89
implementation(libs.oshai.logging)
910
implementation(libs.kotlinx.coroutines.core)
1011

11-
// testImplementation(libs.guava)
1212
testImplementation(kotlin("test"))
1313
testImplementation(libs.bundles.jvmtest)
1414
testImplementation(libs.kotest.property)
15+
testImplementation(testFixtures(project(":core")))
1516
}
1617

1718
kotlin {

clibs/src/test/java/com/sunya/netchdf/netcdf4/TestNetcdfClib.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
import com.sunya.netchdf.netcdfClib.ffm.netcdf_h;
88
import org.junit.jupiter.api.Test;
9-
import com.sunya.testdata.TestFilesKt;
9+
import com.sunya.netchdf.testdata.TestFilesKt;
1010

1111
public class TestNetcdfClib {
1212

clibs/src/test/kotlin/com/sunya/netchdf/NetchdfClibExtra.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
package com.sunya.netchdf
22

33
import com.sunya.cdm.util.Stats
4-
import com.sunya.testdata.NetchdfExtraFiles
4+
import com.sunya.netchdf.testdata.NetchdfExtraFiles
55
import org.junit.jupiter.api.Disabled
66
import org.junit.jupiter.api.Test
77
import org.junit.jupiter.params.ParameterizedTest
88
import org.junit.jupiter.params.provider.Arguments
99
import org.junit.jupiter.params.provider.MethodSource
10-
import com.sunya.testdata.testData
10+
import com.sunya.netchdf.testdata.testData
1111
import org.junit.jupiter.api.AfterAll
1212
import java.util.stream.Stream
1313

clibs/src/test/kotlin/com/sunya/netchdf/NetchdfClibTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import com.sunya.cdm.util.nearlyEquals
88
import com.sunya.netchdf.hdf4Clib.Hdf4ClibFile
99
import com.sunya.netchdf.hdf5Clib.Hdf5ClibFile
1010
import com.sunya.netchdf.netcdfClib.NClibFile
11-
import com.sunya.testdata.*
11+
import com.sunya.netchdf.testdata.*
1212
import org.junit.jupiter.api.AfterAll
1313
import org.junit.jupiter.api.BeforeAll
1414
import org.junit.jupiter.api.Disabled

clibs/src/test/kotlin/com/sunya/netchdf/hdf4/H4Ccompare.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ import com.sunya.cdm.array.ArrayUByte
55
import com.sunya.cdm.util.Stats
66
import com.sunya.netchdf.*
77
import com.sunya.netchdf.hdf4Clib.Hdf4ClibFile
8-
import com.sunya.testdata.H4Files
8+
import com.sunya.netchdf.testdata.H4Files
99
import org.junit.jupiter.api.AfterAll
1010
import org.junit.jupiter.api.Test
1111
import org.junit.jupiter.params.ParameterizedTest
1212
import org.junit.jupiter.params.provider.Arguments
1313
import org.junit.jupiter.params.provider.MethodSource
14-
import com.sunya.testdata.testData
14+
import com.sunya.netchdf.testdata.testData
1515
import org.junit.jupiter.api.Assertions
1616
import java.util.*
1717
import java.util.stream.Stream

0 commit comments

Comments
 (0)