Skip to content

Commit

Permalink
more test development
Browse files Browse the repository at this point in the history
  • Loading branch information
edwardhartnett committed Aug 28, 2020
1 parent f114fbc commit 6675467
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/flib/pio_nf.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1725,7 +1725,7 @@ end function PIOc_def_var_chunking
end interface
ndims = size(chunksizes)
do i=1,ndims
cchunksizes(i) = chunksizes(ndims-i+1)-1
cchunksizes(i) = chunksizes(ndims-i+1)
enddo

ierr = PIOc_def_var_chunking(file%fh, vardesc%varid-1, storage, cchunksizes)
Expand Down
10 changes: 9 additions & 1 deletion tests/unit/ftst_vars.F90
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
program ftst_vars
use mpi
use pio
use pio_nf

type(iosystem_desc_t) :: pio_iosystem
type(file_desc_t) :: pio_file
Expand All @@ -18,14 +19,17 @@ program ftst_vars
character(len=64) :: dim_name = 'influence_on_Roman_history'
character(len=64) :: var_name = 'Caesar'
integer :: iotype = PIO_iotype_netcdf4c
integer :: dimid, dim_len = 4
integer :: dimid, dim_len = 40
integer :: chunksize = 10
integer :: ierr

! Set up MPI
call MPI_Init(ierr)
call MPI_Comm_rank(MPI_COMM_WORLD, my_rank, ierr)
call MPI_Comm_size(MPI_COMM_WORLD, ntasks , ierr)

! This whole test only works for netCDF/HDF5 files, because it is
! about chunking.
#ifdef _NETCDF4
if (my_rank .eq. 0) print *,'Testing variables...'

Expand All @@ -49,6 +53,10 @@ program ftst_vars
ret_val = PIO_def_var(pio_file, var_name, PIO_int, (/dimid/), pio_var)
if (ierr .ne. PIO_NOERR) stop 7

! Define chunking for var.
ret_val = PIO_def_var_chunking(pio_file, pio_var, 0, (/chunksize/))
if (ierr .ne. PIO_NOERR) stop 9

! Close the file.
call PIO_closefile(pio_file)

Expand Down

0 comments on commit 6675467

Please sign in to comment.