h5tset_size_f Type mismatch in argument 'size' at (1); passed INTEGER(4) to INTEGER(8)

Dear All,

I am not able to find what throws this error when compiling this .f90 file with gfortran. I am copying part of the code which doesn't give any other errors.

the variables are declared as
integer :: hdferr
integer(HID_T):: atype_id

these are the subroutine calls just before and after

CALL h5screate_simple_f(1, adims, aspace_id, hdferr)
CALL h5tcopy_f(H5T_NATIVE_CHARACTER, atype_id, hdferr)
CALL h5tset_size_f(atype_id, 18, hdferr)
CALL h5acreate_f(dset_id, 'FullName', atype_id, aspace_id, attr_id, hdferr)
CALL h5awrite_f(attr_id, atype_id, 'Precipitation Rate', adims, hdferr)
CALL h5aclose_f(attr_id, hdferr)

I can't figure out where the problem is.

Thanks

h5tset_size is expecting an integer(size_t) in the second argument, but you are passing and integer (constant 18), instead pass INT(18,size_t).

Scot

···

On Feb 4, 2015, at 9:34 AM, Fabio Berzaghi <fabe@uw.edu> wrote:

Dear All,

I am not able to find what throws this error when compiling this .f90 file with gfortran. I am copying part of the code which doesn't give any other errors.

the variables are declared as
integer :: hdferr
integer(HID_T):: atype_id

these are the subroutine calls just before and after

CALL h5screate_simple_f(1, adims, aspace_id, hdferr)
CALL h5tcopy_f(H5T_NATIVE_CHARACTER, atype_id, hdferr)
CALL h5tset_size_f(atype_id, 18, hdferr)
CALL h5acreate_f(dset_id, 'FullName', atype_id, aspace_id, attr_id, hdferr)
CALL h5awrite_f(attr_id, atype_id, 'Precipitation Rate', adims, hdferr)
CALL h5aclose_f(attr_id, hdferr)

I can't figure out where the problem is.

Thanks

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@lists.hdfgroup.org
http://lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org
Twitter: https://twitter.com/hdf5

Scot thanks,

But I am still not able to make this work. I have multiple calls of h5tset_size and each of them needs a different size.
I tried to declare an integer variable
integer(SIZE_T),dimension(4) :: test
CALL h5tset_size_f(atype_id, test, hdferr)

but I get Rank mismatch in argument 'size' at (1) (scalar and rank-1), which refers to test.

I also tried to declare the variable in the subroutine call but it doesn't work either.

Is there a specific way of doing it?

Thank you

···

On 4/2/15 17:05, Scot Breitenfeld wrote:

h5tset_size is expecting an integer(size_t) in the second argument, but you are passing and integer (constant 18), instead pass INT(18,size_t).

Scot

On Feb 4, 2015, at 9:34 AM, Fabio Berzaghi <fabe@uw.edu> wrote:

Dear All,

I am not able to find what throws this error when compiling this .f90 file with gfortran. I am copying part of the code which doesn't give any other errors.

the variables are declared as
integer :: hdferr
integer(HID_T):: atype_id

these are the subroutine calls just before and after

CALL h5screate_simple_f(1, adims, aspace_id, hdferr)
CALL h5tcopy_f(H5T_NATIVE_CHARACTER, atype_id, hdferr)
CALL h5tset_size_f(atype_id, 18, hdferr)
CALL h5acreate_f(dset_id, 'FullName', atype_id, aspace_id, attr_id, hdferr)
CALL h5awrite_f(attr_id, atype_id, 'Precipitation Rate', adims, hdferr)
CALL h5aclose_f(attr_id, hdferr)

I can't figure out where the problem is.

Thanks

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@lists.hdfgroup.org
http://lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org
Twitter: https://twitter.com/hdf5

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@lists.hdfgroup.org
http://lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org
Twitter: https://twitter.com/hdf5

The argument needs to be a scalar, so pass test(1), test(2), etc… If you have multiple calls to h5tset_size then you will have to do this in a loop, and you will probably have to make atype_id an array.

These examples at http://www.hdfgroup.org/HDF5/examples/api18-fortran.html use h5tset_size_f

h5ex_t_cmpdatt_F03.f90
h5ex_t_cmpd_F03.f90
h5ex_t_stringCatt_F03.f90
h5ex_t_stringC_F03.f90
h5ex_t_string_F03.f90

they might help you.

Scot

···

On Feb 4, 2015, at 10:36 AM, Fabio Berzaghi <fabe@uw.edu<mailto:fabe@uw.edu>> wrote:

Scot thanks,

But I am still not able to make this work. I have multiple calls of h5tset_size and each of them needs a different size.
I tried to declare an integer variable
integer(SIZE_T),dimension(4) :: test
CALL h5tset_size_f(atype_id, test, hdferr)

but I get Rank mismatch in argument 'size' at (1) (scalar and rank-1), which refers to test.

I also tried to declare the variable in the subroutine call but it doesn't work either.

Is there a specific way of doing it?

Thank you

On 4/2/15 17:05, Scot Breitenfeld wrote:
h5tset_size is expecting an integer(size_t) in the second argument, but you are passing and integer (constant 18), instead pass INT(18,size_t).

Scot

On Feb 4, 2015, at 9:34 AM, Fabio Berzaghi <fabe@uw.edu<mailto:fabe@uw.edu>> wrote:

Dear All,

I am not able to find what throws this error when compiling this .f90 file with gfortran. I am copying part of the code which doesn't give any other errors.

the variables are declared as
integer :: hdferr
integer(HID_T):: atype_id

these are the subroutine calls just before and after

CALL h5screate_simple_f(1, adims, aspace_id, hdferr)
CALL h5tcopy_f(H5T_NATIVE_CHARACTER, atype_id, hdferr)
CALL h5tset_size_f(atype_id, 18, hdferr)
CALL h5acreate_f(dset_id, 'FullName', atype_id, aspace_id, attr_id, hdferr)
CALL h5awrite_f(attr_id, atype_id, 'Precipitation Rate', adims, hdferr)
CALL h5aclose_f(attr_id, hdferr)

I can't figure out where the problem is.

Thanks

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@lists.hdfgroup.org<mailto:Hdf-forum@lists.hdfgroup.org>
http://lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org
Twitter: https://twitter.com/hdf5

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@lists.hdfgroup.org<mailto:Hdf-forum@lists.hdfgroup.org>
http://lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org
Twitter: https://twitter.com/hdf5

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@lists.hdfgroup.org<mailto:Hdf-forum@lists.hdfgroup.org>
http://lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org
Twitter: https://twitter.com/hdf5

Thank you Scot, that worked perfectly!

But the strange thing is that this code was running just fine a couple of years ago, maybe this subroutine call has been changed?

···

On 4/2/15 20:15, Scot Breitenfeld wrote:

The argument needs to be a scalar, so pass test(1), test(2), etc� If you have multiple calls to h5tset_size then you will have to do this in a loop, and you will probably have to make atype_id an array.

These examples at http://www.hdfgroup.org/HDF5/examples/api18-fortran.html use h5tset_size_f

h5ex_t_cmpdatt_F03.f90
h5ex_t_cmpd_F03.f90
h5ex_t_stringCatt_F03.f90
h5ex_t_stringC_F03.f90
h5ex_t_string_F03.f90

they might help you.

Scot

On Feb 4, 2015, at 10:36 AM, Fabio Berzaghi <fabe@uw.edu >> <mailto:fabe@uw.edu>> wrote:

Scot thanks,

But I am still not able to make this work. I have multiple calls of h5tset_size and each of them needs a different size.
I tried to declare an integer variable
integer(SIZE_T),dimension(4) :: test
CALL h5tset_size_f(atype_id, test, hdferr)

but I get Rank mismatch in argument 'size' at (1) (scalar and rank-1), which refers to test.

I also tried to declare the variable in the subroutine call but it doesn't work either.

Is there a specific way of doing it?

Thank you

On 4/2/15 17:05, Scot Breitenfeld wrote:

h5tset_size is expecting an integer(size_t) in the second argument, but you are passing and integer (constant 18), instead pass INT(18,size_t).

Scot

On Feb 4, 2015, at 9:34 AM, Fabio Berzaghi <fabe@uw.edu >>>> <mailto:fabe@uw.edu>> wrote:

Dear All,

I am not able to find what throws this error when compiling this .f90 file with gfortran. I am copying part of the code which doesn't give any other errors.

the variables are declared as
integer :: hdferr
integer(HID_T):: atype_id

these are the subroutine calls just before and after

CALL h5screate_simple_f(1, adims, aspace_id, hdferr)
CALL h5tcopy_f(H5T_NATIVE_CHARACTER, atype_id, hdferr)
CALL h5tset_size_f(atype_id, 18, hdferr)
CALL h5acreate_f(dset_id, 'FullName', atype_id, aspace_id, attr_id, hdferr)
CALL h5awrite_f(attr_id, atype_id, 'Precipitation Rate', adims, hdferr)
CALL h5aclose_f(attr_id, hdferr)

I can't figure out where the problem is.

Thanks

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@lists.hdfgroup.org <mailto:Hdf-forum@lists.hdfgroup.org>
http://lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org
Twitter: https://twitter.com/hdf5

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@lists.hdfgroup.org <mailto:Hdf-forum@lists.hdfgroup.org>
http://lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org
Twitter: https://twitter.com/hdf5

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@lists.hdfgroup.org <mailto:Hdf-forum@lists.hdfgroup.org>
http://lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org
Twitter: https://twitter.com/hdf5

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@lists.hdfgroup.org
http://lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org
Twitter: https://twitter.com/hdf5

Thank you Scot, that worked perfectly!

But the strange thing is that this code was running just fine a couple of years ago, maybe this subroutine call has been changed?

I’m not aware of the API changing, more likely is size_t was 4 bytes on the machine you were using. Glad it works now.

Scot

···

On Feb 5, 2015, at 12:09 PM, Fabio Berzaghi <fabe@uw.edu<mailto:fabe@uw.edu>> wrote:

On 4/2/15 20:15, Scot Breitenfeld wrote:
The argument needs to be a scalar, so pass test(1), test(2), etc… If you have multiple calls to h5tset_size then you will have to do this in a loop, and you will probably have to make atype_id an array.

These examples at http://www.hdfgroup.org/HDF5/examples/api18-fortran.html use h5tset_size_f

h5ex_t_cmpdatt_F03.f90
h5ex_t_cmpd_F03.f90
h5ex_t_stringCatt_F03.f90
h5ex_t_stringC_F03.f90
h5ex_t_string_F03.f90

they might help you.

Scot

On Feb 4, 2015, at 10:36 AM, Fabio Berzaghi <fabe@uw.edu<mailto:fabe@uw.edu>> wrote:

Scot thanks,

But I am still not able to make this work. I have multiple calls of h5tset_size and each of them needs a different size.
I tried to declare an integer variable
integer(SIZE_T),dimension(4) :: test
CALL h5tset_size_f(atype_id, test, hdferr)

but I get Rank mismatch in argument 'size' at (1) (scalar and rank-1), which refers to test.

I also tried to declare the variable in the subroutine call but it doesn't work either.

Is there a specific way of doing it?

Thank you

On 4/2/15 17:05, Scot Breitenfeld wrote:
h5tset_size is expecting an integer(size_t) in the second argument, but you are passing and integer (constant 18), instead pass INT(18,size_t).

Scot

On Feb 4, 2015, at 9:34 AM, Fabio Berzaghi <fabe@uw.edu<mailto:fabe@uw.edu>> wrote:

Dear All,

I am not able to find what throws this error when compiling this .f90 file with gfortran. I am copying part of the code which doesn't give any other errors.

the variables are declared as
integer :: hdferr
integer(HID_T):: atype_id

these are the subroutine calls just before and after

CALL h5screate_simple_f(1, adims, aspace_id, hdferr)
CALL h5tcopy_f(H5T_NATIVE_CHARACTER, atype_id, hdferr)
CALL h5tset_size_f(atype_id, 18, hdferr)
CALL h5acreate_f(dset_id, 'FullName', atype_id, aspace_id, attr_id, hdferr)
CALL h5awrite_f(attr_id, atype_id, 'Precipitation Rate', adims, hdferr)
CALL h5aclose_f(attr_id, hdferr)

I can't figure out where the problem is.

Thanks

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@lists.hdfgroup.org<mailto:Hdf-forum@lists.hdfgroup.org>
http://lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org
Twitter: https://twitter.com/hdf5

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@lists.hdfgroup.org<mailto:Hdf-forum@lists.hdfgroup.org>
http://lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org
Twitter: https://twitter.com/hdf5

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@lists.hdfgroup.org<mailto:Hdf-forum@lists.hdfgroup.org>
http://lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org
Twitter: https://twitter.com/hdf5

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@lists.hdfgroup.org<mailto:Hdf-forum@lists.hdfgroup.org>
http://lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org
Twitter: https://twitter.com/hdf5

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@lists.hdfgroup.org<mailto:Hdf-forum@lists.hdfgroup.org>
http://lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org
Twitter: https://twitter.com/hdf5