Skip to content

Commit

Permalink
Merge pull request #42 from nextsimhub/issue41_cdl
Browse files Browse the repository at this point in the history
Replace NetCDF files with CDL files
  • Loading branch information
TomMelt authored Aug 23, 2024
2 parents 9a499cc + 381f869 commit beb72e7
Show file tree
Hide file tree
Showing 14 changed files with 2,032 additions and 4 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
build
Testing
*.DS_Store
*.nc
1,953 changes: 1,953 additions & 0 deletions grids/rect3030.res.cdl

Large diffs are not rendered by default.

Binary file removed grids/rect3030.res.nc
Binary file not shown.
Binary file removed results/partition_mask_2.nc
Binary file not shown.
Binary file removed results/partition_mask_4.nc
Binary file not shown.
Binary file removed results/partition_metadata_2.nc
Binary file not shown.
Binary file removed results/partition_metadata_4.nc
Binary file not shown.
28 changes: 24 additions & 4 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,27 @@ create_test(TARGET test_zoltan_0 SOURCES test_zoltan_partitioner_0.cpp MAX_NUM_P
create_test(TARGET test_zoltan_1 SOURCES test_zoltan_partitioner_1.cpp MAX_NUM_PROCS 2)
create_test(TARGET test_zoltan_2 SOURCES test_zoltan_partitioner_2.cpp MAX_NUM_PROCS 4)

# Copy grid files used for testing
file(COPY test_0.nc DESTINATION ${CMAKE_BINARY_DIR}/test)
file(COPY test_1.nc DESTINATION ${CMAKE_BINARY_DIR}/test)
file(COPY test_2.nc DESTINATION ${CMAKE_BINARY_DIR}/test)
# Generate input files from respective cdl files
add_custom_command(
OUTPUT test_0.nc
COMMAND
ncgen -b -o test_0.nc ${CMAKE_CURRENT_SOURCE_DIR}/test_0.cdl
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/test_0.cdl
)
add_custom_command(
OUTPUT test_1.nc
COMMAND
ncgen -b -o test_1.nc ${CMAKE_CURRENT_SOURCE_DIR}/test_1.cdl
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/test_1.cdl
)
add_custom_command(
OUTPUT test_2.nc
COMMAND
ncgen -b -o test_2.nc ${CMAKE_CURRENT_SOURCE_DIR}/test_2.cdl
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/test_2.cdl
)
add_custom_target(
generate_input_files
ALL
DEPENDS test_0.nc test_1.nc test_2.nc
)
17 changes: 17 additions & 0 deletions test/test_0.cdl
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
netcdf test_0 {
dimensions:
x = 6 ;
y = 4 ;
variables:
int mask(y, x) ;

// global attributes:
:title = "All land mask" ;
data:

mask =
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0 ;
}
Binary file removed test/test_0.nc
Binary file not shown.
17 changes: 17 additions & 0 deletions test/test_1.cdl
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
netcdf test_1 {
dimensions:
x = 6 ;
y = 4 ;
variables:
int mask(y, x) ;

// global attributes:
:title = "No land mask" ;
data:

mask =
1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1 ;
}
Binary file removed test/test_1.nc
Binary file not shown.
17 changes: 17 additions & 0 deletions test/test_2.cdl
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
netcdf test_2 {
dimensions:
m = 6 ;
n = 4 ;
variables:
int land_mask(n, m) ;

// global attributes:
:title = "Non-default dimension naming and ordering" ;
data:

land_mask =
0, 0, 0, 0, 0, 0,
1, 1, 1, 1, 1, 1,
0, 0, 0, 0, 0, 0,
1, 1, 1, 1, 1, 1 ;
}
Binary file removed test/test_2.nc
Binary file not shown.

0 comments on commit beb72e7

Please sign in to comment.