Go Back   HDF-EOS Forums > Library > FORTRAN

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 03-14-2011, 06:45 AM
sakalli sakalli is offline
Junior Member
 
Join Date: Mar 2011
Posts: 2
Default gfortran hdfeos

Hi Guys,
i installed the hdfeos to reading hdf-eos files from MODIS Terra 15A2 (LAI and FPAR). But unfortunately, the tool doesn't work. Before i installed the hdfeos, i installed also the currently szip, zlib, jpeg6b and hdf4.2.5

the commands with which i installed the tools are:
Zlib:
Code:
./configure --libdir=/home/kelbek/lib --includedir=/home/kelbek/include
make
make install
Szip:
Code:
F77=gfortran ./configure --bindir=/home/kelbek/bin --sbindir=/home/kelbek/sbin --includedir=/home/kelbek/include --libdir=/home/kelbek/lib
make
make install
Jpeg:
Code:
./configure --bindir=/home/kelbek/bin --sbindir=/home/kelbek/sbin --libdir=/home/kelbek/lib --includedir=/home/kelbek/include
make
make install
Code:
./configure F77=gfortran --bindir=/home/kelbek/bin --sbindir=/home/kelbek/sbin --libdir=/home/kelbek/lib --includedir=/home/kelbek/include --enable-fortran --with-zlib=/home/kelbek/lib --with-jpeg=/home/kelbek/bin --with-szlib=/home/kelbek/lib

make 

make install
and the hdfeos was installed:
Code:
F77=gfortran ./configure CC='/home/kelbek/bin/h4cc -Df2cFortran' --bindir=/home/kelbek/bin --libdir=/home/kelbek/lib --includedir=/home/kelbek/include --with-jpeg=/home/kelbek/bin --with-zlib=/home/kelbek/lib --with-szlib=/home/kelbek/lib --with-hdf4=/home/kelbek/bin
if i want to compile this program:
Code:
     Program deneme
      implicit none

      integer*4 gridfile1
      integer*4 grid1
      integer status
      integer*4 datafield1rank(32)
      integer*4 datafield1dimsize(32)
      integer*4 datafield1type(1)
      character*512 datafield1dimname
      integer*2 datafield1data(7200,3600)
      integer*4 datafield1start(2)
      integer*4 datafield1stride(2)
      integer*4 datafield1edge(2)
      integer*4 i, j
      integer gdrdfld, gdfldinfo, gddetach, gdclose
      external gdrdfld, gdfldinfo, gddetach, gdclose
      integer*4 gdopen, gdattach
      external gdopen, gdattach
      integer*4 DFACC_READ
      parameter (DFACC_READ=1)                                                                                                                                                                             
c Open '../MOD15A2.A2010169.gd00v08.005.2010178214837.hdf' using grid API                                                                                                                                  
      gridfile1=gdopen("MCD43C4.A2006033.005.2008076094541.hdf"                                                                                                                                            
     $,DFACC_READ)                                                                                                                                                                                         
                                                                                                                                                                                                           
c Open a grid named 'MCD_CMG_BRDF_0.05Deg'                                                                                                                                                                 
      grid1 = gdattach(gridfile1, 'MOD_Grid_MOD15A2')                                                                                                                                                      
                                                                                                                                                                                                           
c Retrieve information about 'Nadir_Reflectance_Band1' datafield                                                                                                                                           
      status = gdfldinfo(grid1, 'Lai_1km',                                                                                                                                                                 
     $  datafield1rank, datafield1dimsize, datafield1type,                                                                                                                                                 
     $  datafield1dimname)                                                                                                                                                                                 
c Select necessary range of elements                                                                                                                                                                       
      datafield1start(1) = 0                                                                                                                                                                               
      datafield1stride(1) = 1                                                                                                                                                                              
      datafield1edge(1) = 1200
      datafield1start(2) = 0
      datafield1stride(2) = 1
      datafield1edge(2) = 1200
c Read data from 'Lai_1km'
      status = gdrdfld(grid1, 'Lai_1km',
     $  datafield1start, datafield1stride, datafield1edge,
     $  datafield1data)
c Dump data from 'Lai_1km'
      do i = 1, 36
        do j = 1, 72
          write(*,*), datafield1data(j,i)
        enddo
        write(*,*)
      enddo

c Close tgde grid named 'MCD_CMG_BRDF_0.05Deg'
      status = gddetach(grid1)

c Close 'MCD43C4.A2000049.005.2006271205532.gddf'
       status= gdclose(gridfile1)

      end

i get this errors:
Code:
fortranprogramhdfeos.o: In function `MAIN__':
fortranprogramhdfeos.f:(.text+0x43): undefined reference to `gdopen_'
fortranprogramhdfeos.f:(.text+0x61): undefined reference to `gdattach_'
fortranprogramhdfeos.f:(.text+0xac): undefined reference to `gdfldinfo_'
fortranprogramhdfeos.f:(.text+0x10e): undefined reference to `gdrdfld_'
fortranprogramhdfeos.f:(.text+0x1d7): undefined reference to `gddetach_'
fortranprogramhdfeos.f:(.text+0x1e2): undefined reference to `gdclose_'
collect2: ld returned 1 exit status

the compile code is:
Code:
HDF4_DIR=/home/kelbek
HDFEOS2_DIR=/home/kelbek
FC=$(HDF4_DIR)/bin/h4fc

FFLAGS=-fno-underscoring
LDFLAGS=-L$(HDFEOS2_DIR)/lib
LIBS=-lmfhdf -ldf -ljpeg -lz

read_grid: fortranprogramhdfeos.f
        $(FC) $(FFLAGS) $(LDFLAGS) $< $(LIBS) -o $@

Unfortunately, i can't fix this Problem. Anybody can help me?
thank you very much in advance
best regards
Reply With Quote
  #2  
Old 03-15-2011, 03:22 PM
kyang kyang is offline
Member
 
Join Date: Nov 2009
Posts: 37
Default

Hi sakalli,

Your building logs look right to me.
Have you tried g77? I think g77 should work.
You can also follow the procedure described at http://hdfeos.org/examples/fort_grid.php

to see if it works.


I am not sure if hdfeos2 works with gfortran.

Go to the HDF/HDF-EOS workshop agenda page
http://hdfeos.org/workshops/ws14/agenda.php

Go to Day 2 and find the presentation given by
Abe Taaheri. There is a page describing the compiler support. I don't see gfortran is supported for Linux.

Kent
Reply With Quote
  #3  
Old 03-22-2011, 02:57 AM
sakalli sakalli is offline
Junior Member
 
Join Date: Mar 2011
Posts: 2
Default

Hi Kyang,
thank you very much for your reply. I was on a meeting, therefore, i couldn't reply you. I will try with g77. Actually, gfortran is not supported for linux. It is just for Mac Intel. May be, this is the problem, why i can not get working the gopen, gclose and other functions. When i have tried it, i will let you know, whether it works or not.


Best regards
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 11:59 AM.


Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
About Us | Contact Info | Archive Info | Disclaimer
Sponsored by NASA Cooperative Agreement Grant Number NNX08AO77A / Maintained by The HDF Group