gfortran variable declaration to store 32-bit integer netcdf

57 views Asked by At

I'm having problems to understand what's going on with my fortran subroutine (2003 standard) to read netCDF-4 data. The compiler I'm using is gfortran.

I have to read a 32-bit integer from a netCDF file, to read the file a declare an allocatable variable as integer(KIND=4). However, if I do that the netCDF variable is not correctly stored (only 0 values are saved).

Instead, if I declare the variable as integer(KIND=8) or double the variable is correctly stored (it is, of course, stored as read using double precision).

Why I cannot use the corresponding KIND for a 32-bit variable?

I could simply do that and ignore the problem, but I'm afraid that I will do something wrong with some other variables if I don't understand what's happening.

Any ideas?

Thanks!!

0

There are 0 answers