MODIS file reading problem

Hello,
I inherited a code that converts MODIS (MYD04_L2 type) data to bufr. I
compiled the code and checked files for content and they contain the data I
want to use. Also I checked that the code is got the name of the file
right.
When I try to read dimensions of latititude the code crashed with segfault.
The code was compiled with ifort, icc
(12-12.0.4.191) hdf4/4.2.7-intel-12.0.4.191, szip/2.1-intel-12.0.4.191
Can you suggest what the problem is?
Thanks,
Mark

      PRINT *,SDS_ID, Field_Name

   Status = SFGINFO (SDS_ID, Field_Name, Number_of_Dimensions, &
                     Dimension_Sizes, Number_Type, Number_of_Attributes)

Processing MYD04_L2.AAA.hdf
      262145 Latitude
forrtl: severe (174): SIGSEGV, segmentation fault occurred
Image PC Routine Line Source

modis_products_to 000000000054FA72 Unknown Unknown Unknown
modis_products_to 0000000000515D5B Unknown Unknown Unknown
modis_products_to 0000000000517579 Unknown Unknown Unknown
modis_products_to 00000000004AF2B9 get_hdf_dimension 151
get_hdf_dimensions.f90
modis_products_to 0000000000435A4B modis_products_to 435
modis_products_to_BUFR.f90
modis_products_to 000000000040C107 MAIN__ 342
modis_products_to_BUFR.f90
modis_products_to 000000000040582C Unknown Unknown Unknown
libc.so.6 00000038B8C1ECDD Unknown Unknown Unknown
modis_products_to 0000000000405729 Unknown Unknown Unknown

get_hdf_dimensions.f90 (4.91 KB)

Nothing jumps out as incorrect, have you verified Max_HDF_Array_Size and what KIND is LONG?

···

On 2013-03-04 10:02, M Pa wrote:

Hello,
I inherited a code that converts MODIS (MYD04_L2 type) data to bufr.
I compiled the code and checked files for content and they contain the
data I want to use. Also I checked that the code is got the name of
the file right.
When I try to read dimensions of latititude the code crashed with segfault.
The code was compiled with ifort, icc

(12-12.0.4.191) hdf4/4.2.7-intel-12.0.4.191, szip/2.1-intel-12.0.4.191
Can you suggest what the problem is?

HDF4 expects Fortran integers to be 4 bytes. Are you sure your INTEGER(LONG) are 4 bytes?

···

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Elena Pourmal The HDF Group http://hdfgroup.org
1800 So. Oak St., Suite 203, Champaign IL 61820
217.531.6112
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

On Mar 4, 2013, at 11:05 PM, brtnfld@hdfgroup.org wrote:

On 2013-03-04 10:02, M Pa wrote:

Hello,
I inherited a code that converts MODIS (MYD04_L2 type) data to bufr.
I compiled the code and checked files for content and they contain the
data I want to use. Also I checked that the code is got the name of
the file right.
When I try to read dimensions of latititude the code crashed with segfault.
The code was compiled with ifort, icc
(12-12.0.4.191) hdf4/4.2.7-intel-12.0.4.191, szip/2.1-intel-12.0.4.191
Can you suggest what the problem is?

Nothing jumps out as incorrect, have you verified Max_HDF_Array_Size and what KIND is LONG?

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

For reasons somewhat hard to understand my kinds are defined as
  integer, parameter :: Byte = selected_int_kind(1), & ! Byte integer
                        Short = selected_int_kind(4), & ! Short integer
                        Long = selected_int_kind(8), & ! Long integer
                        Single = selected_real_kind(6), & ! Single precis\
ion
                        Double = selected_real_kind(12) ! Double precis\
ion

while with intel compiler short should be kind(2), long - kind(4) etc.

I cannot change that because of other dependencies in the code.

However, the source of error is actually different:
in call

Status = SFGINFO (SDS_ID, Field_Name, Number_of_Dimensions, &
                     Dimension_Sizes, Number_Type, Number_of_Attributes)

Field_Name is OUT while in the routine where it is imbedded it is defined
as IN - and it crashed due to the conflict.

Thanks for helping,
Mark

···

On Tue, Mar 5, 2013 at 1:58 PM, Elena Pourmal <epourmal@hdfgroup.org> wrote:

HDF4 expects Fortran integers to be 4 bytes. Are you sure your
INTEGER(LONG) are 4 bytes?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Elena Pourmal The HDF Group http://hdfgroup.org
1800 So. Oak St., Suite 203, Champaign IL 61820
217.531.6112
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

On Mar 4, 2013, at 11:05 PM, brtnfld@hdfgroup.org wrote:

On 2013-03-04 10:02, M Pa wrote:

Hello,

I inherited a code that converts MODIS (MYD04_L2 type) data to bufr.

I compiled the code and checked files for content and they contain the

data I want to use. Also I checked that the code is got the name of

the file right.

When I try to read dimensions of latititude the code crashed with
segfault.

The code was compiled with ifort, icc

(12-12.0.4.191) hdf4/4.2.7-intel-12.0.4.191, szip/2.1-intel-12.0.4.191

Can you suggest what the problem is?

Nothing jumps out as incorrect, have you verified Max_HDF_Array_Size and
what KIND is LONG?

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org