forked from NCAR/DART
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
remove hdf tutorial routines. Fix i4 i8 integer
fixes NCAR#340
- Loading branch information
1 parent
6609e3b
commit 6bab04c
Showing
1 changed file
with
2 additions
and
137 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,7 @@ module HDF5_utilities_mod | |
implicit none | ||
private | ||
|
||
public :: h5_open, H5_CRTDAT, H5_RDWT, & | ||
public :: h5_open, & | ||
h5_get_rank, & | ||
h5_get_dimensions, & | ||
h5_get_dset_dspace, & | ||
|
@@ -66,7 +66,7 @@ end subroutine initialize_module | |
function h5_open(filename, flag, context) result(file_id) | ||
|
||
character(len=*), intent(in) :: filename | ||
integer(HID_T), intent(in) :: flag | ||
integer, intent(in) :: flag | ||
character(len=*), optional, intent(in) :: context | ||
integer(HID_T) :: file_id | ||
|
||
|
@@ -188,140 +188,5 @@ subroutine h5_check(hdferr, subr_name, h5routine, context, filename) | |
|
||
end subroutine h5_check | ||
|
||
|
||
subroutine H5_CRTDAT() | ||
|
||
! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * | ||
! Copyright by The HDF Group. * | ||
! Copyright by the Board of Trustees of the University of Illinois. * | ||
! All rights reserved. * | ||
! * | ||
! This routine is part of HDF5. The full HDF5 copyright notice, including * | ||
! terms governing use, modification, and redistribution, is contained in * | ||
! the COPYING file, which can be found at the root of the source code * | ||
! distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * | ||
! If you do not have access to either file, you may request a copy from * | ||
! [email protected]. * | ||
! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * | ||
! | ||
! The following example shows how to create an empty dataset. | ||
! It creates a file called 'dsetf.h5', defines the | ||
! dataset dataspace, creates a dataset which is a 4x6 integer array, | ||
! and then closes the dataspace, the dataset, and the file. | ||
! | ||
! This example is used in the HDF5 Tutorial. | ||
|
||
character(len=8), parameter :: filename = "dsetf.h5" ! File name | ||
character(len=4), parameter :: dsetname = "dset" ! Dataset name | ||
|
||
integer(HID_T) :: file_id ! File identifier | ||
integer(HID_T) :: dset_id ! Dataset identifier | ||
integer(HID_T) :: dspace_id ! Dataspace identifier | ||
|
||
integer(HSIZE_T), dimension(2) :: dims = (/4,6/) ! Dataset dimensions | ||
integer :: rank = 2 ! Dataset rank | ||
|
||
integer :: error ! Error flag | ||
|
||
! Initialize FORTRAN interface. | ||
call h5open_f(error) | ||
|
||
! Create a new file using default properties. | ||
call h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, error) | ||
|
||
! Create the dataspace. | ||
call h5screate_simple_f(rank, dims, dspace_id, error) | ||
|
||
! Create the dataset with default properties. | ||
call h5dcreate_f(file_id, dsetname, H5T_NATIVE_INTEGER, dspace_id, dset_id, error) | ||
|
||
! End access to the dataset and release resources used by it. | ||
call h5dclose_f(dset_id, error) | ||
|
||
! Terminate access to the data space. | ||
call h5sclose_f(dspace_id, error) | ||
|
||
! Close the file. | ||
call h5fclose_f(file_id, error) | ||
|
||
! Close FORTRAN interface. | ||
call h5close_f(error) | ||
|
||
end subroutine H5_CRTDAT | ||
|
||
|
||
subroutine H5_RDWT | ||
|
||
! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * | ||
! Copyright by The HDF Group. * | ||
! Copyright by the Board of Trustees of the University of Illinois. * | ||
! All rights reserved. * | ||
! * | ||
! This routine is part of HDF5. The full HDF5 copyright notice, including * | ||
! terms governing use, modification, and redistribution, is contained in * | ||
! the COPYING file, which can be found at the root of the source code * | ||
! distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * | ||
! If you do not have access to either file, you may request a copy from * | ||
! [email protected]. * | ||
! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * | ||
! | ||
! The following example shows how to write and read to/from an existing dataset. | ||
! It opens the file created in the previous example, obtains the dataset | ||
! identifier, writes the data to the dataset in the file, | ||
! then reads the dataset to memory. | ||
! | ||
! This example is used in the HDF5 Tutorial. | ||
|
||
! Initialize the dset_data array. | ||
|
||
character(len=8), parameter :: filename = "dsetf.h5" ! File name | ||
character(len=4), parameter :: dsetname = "dset" ! Dataset name | ||
|
||
integer(HID_T) :: file_id ! File identifier | ||
integer(HID_T) :: dset_id ! Dataset identifier | ||
|
||
integer :: error ! Error flag | ||
integer :: i, j | ||
|
||
integer, dimension(4,6) :: dset_data, data_out ! Data buffers | ||
integer(HSIZE_T), dimension(2) :: data_dims | ||
|
||
DO i = 1, 4 | ||
DO j = 1, 6 | ||
dset_data(i,j) = (i-1)*6 + j | ||
END DO | ||
END DO | ||
|
||
|
||
! Initialize FORTRAN interface. | ||
call h5open_f(error) | ||
|
||
! Open an existing file. | ||
call h5fopen_f (filename, H5F_ACC_RDWR_F, file_id, error) | ||
|
||
! Open an existing dataset. | ||
call h5dopen_f(file_id, dsetname, dset_id, error) | ||
|
||
! Write the dataset. | ||
|
||
data_dims(1) = 4 | ||
data_dims(2) = 6 | ||
call h5dwrite_f(dset_id, H5T_NATIVE_INTEGER, dset_data, data_dims, error) | ||
|
||
! Read the dataset. | ||
call h5dread_f(dset_id, H5T_NATIVE_INTEGER, data_out, data_dims, error) | ||
|
||
! Close the dataset. | ||
call h5dclose_f(dset_id, error) | ||
|
||
! Close the file. | ||
call h5fclose_f(file_id, error) | ||
|
||
! Close FORTRAN interface. | ||
call h5close_f(error) | ||
|
||
end subroutine H5_RDWT | ||
|
||
|
||
end module HDF5_utilities_mod | ||
|