[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

960124: building Fortran netCDF executables on MSDOS



>From: Renata Rybka <address@hidden>
>Organization: CSU
>Keywords: 199601242138.AA16970 netCDF MSDOS

Renata,

>I am trying to use Fortran interface to NetCDF on MsDOS machine.
>I am using Microsoft C v.6.00 
>      and  Microsoft Fortran v. 5.1

OK, this should work fine.

>I wrote a simple program to write a data into a netcdf file, and
>it does not work. Could you please help me to find where I make
>a mistake??? 

Sure, as soon as I understand what you have done.

>I spent quite a time already on that program, and 
>don't know what else to try.
>
>I include the program on the bottom.
>I compile it with the command:
>
>
>   fl /c /AL %1.for
>   link /st:1000 /noe /nod %1.obj+jackets.obj+fslen.obj,,,
>              netcdf.lib+xdr.lib+llibc7.lib+llibfor7.lib
>
>and I got errors F3607 and F3606 for NCVPT1 and NCVPT, about
>lenght and type mismatch. 

These errors are actually non-maskable warnings.  You should ignore them.

>I have checked the archive mailing
>list for netcdfgroup, and find out that one should ignore these 
>errors. 

Oops, I should have read ahead!

>After compilation the  .exe file is created but when I 
>run it I got an error:
>
>    run-time error R6000
>    - stack overflow

This is due to you not making the stack size large enough for your program.
If you look at the makefile, msoft.mk, in the fortran subdirectory, you
will see how we link our fortran test routine.  Specifically, the stack
size should be set to be rather large:

LFLAGS    = /st:10000 /nod /noe

You noted that you set the stack size to 1000 instead of 10000.  You will
need to keep adjusting this value up until your routine does not crash with
the stack overflow error.

>The NetCDF file is created, but no data are written to it.
>That file looks like:
>
>   netcdf file {
>   dimensions:
>       time = UNLIMITED ; // (0 currently)
>       x = 5 ;
>       y = 3 ;
>
>   variables:
>       short iidata(time) ;
>       short idata(time, y, x) ;
>
>   data:
>   }
>
>
>
>I include the Fortran program on the bottom
>
>Thanks for any help,

Please let us know the outcome of you increasing the stack size of the
executable during the link phase.

>Renata Rybka
>address@hidden
>(970) 491 8295
>
>
>
>============================================
>$include: "msoft.int" 
>
>         program write_nc
>$include: "netcdf.inc"
>
>         parameter(ntime=3,nx=5,ny=3)
>         integer*2 idata(nx,ny),iidata
>         integer idnc,idtim,idx,idy,ierr,idvar1,idvar2
>         integer dimvar(3)
>c         save idvar1,idvar2,idtim,idx,idy
>         integer*4 istart(3),icount(3),it
>
>         do 10 itime=1,1
>
>           do 20 iy=1,ny
>             do 20 ix=1,nx
>               idata(ix,iy)=ix+iy
> 20        continue
>
>           if(itime.eq.1) then
>             idnc=nccre('file.nc',ncclob,ierr)
>             idtim=ncddef(idnc,'time',ncunlim,ierr)
>             idx=ncddef(idnc,'x',nx,ierr)
>             idy=ncddef(idnc,'y',ny,ierr)
>
>             idvar1=ncvdef(idnc,'iidata',ncshort,1,idtim,ierr)
>
>             dimvar(1)=idx
>             dimvar(2)=idy
>             dimvar(3)=idtim
>             idvar2=ncvdef(idnc,'idata',ncshort,3,dimvar,ierr)
>
>             call ncendf(idnc,ierr) 
>             call ncclos(idnc,ierr)
>           endif
>
>c open file to write:
>           idnc=ncopn('file.nc',ncwrite,ierr)
>
>           iidata=idata(1,1)           
>           it=itime
>           call ncvpt1(idnc,idvar1,it,iidata,ierr)
>
>           istart(1)=1
>           istart(2)=1
>           istart(3)=itime
>
>           icount(1)=nx
>           icount(2)=ny
>           icount(3)=1
>
>           call ncvpt(idnc,idvar2,istart,icount,idata,ierr)
>           call ncclos(idnc,ierr)
>
> 10      continue    
>         stop
>         end  
>==============================================================

Tom Yoksas

>From:      Renata Rybka <address@hidden>
>Date:      Wed, 24 Jan 96 17:30:12 -0700

>Hi!
>Thanks a lot!!! Increasing stack size did help and the program
>is now running fine.  Renata.