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

Re: writing data to netcdf file - need help



Hi 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
> 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??? 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 program.for with the command:
> 
> 
>    fl /c /AL program.for
>    link /st:1000 /noe /nod program.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. I have checked the archive mailing
> list for netcdfgroup, and find out that one should ignore these 
> errors. After compilation the  .exe file is created but when I 
> run it I got an error:
> 
>     run-time error R6000
>     - stack overflow
> 
> 
> 
> 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:
>    }

Since we don't have Microsoft C v.6.00 here, I first tried compiling and
testing your program on a Unix platform using the released version 2.3.2pl2
that you were using, where it worked fine and created the file you probably
expect:

    netcdf file {
    dimensions:
            time = UNLIMITED ; // (1 currently)
            x = 5 ;
            y = 3 ;
    variables:
            short iidata(time) ;
            short idata(time, y, x) ;
    data:

     iidata = 2 ;

     idata =
      2, 3, 4, 5, 6,
      3, 4, 5, 6, 7,
      4, 5, 6, 7, 8 ;
    }

Our Microsoft FORTRAN Reference Manual provides some suggestions for the
R6000 stack overflow run-time error:

    The program has run out of stack space.  This can occur when a program
    uses a large amount of local data or is heavily recursive.

    There are several ways to allocate a larger stack:

    - Recompile using the /F compiler option.
    - Relink using LINK's /Stack option.
    - Run EXEHDR on the program using the /STACK option.

I don't know if any of these would work, but I don't see why your program
should run out of stack space, since it's not recursive and it doesn't
use much local data.

In our testing, I notice we use the LINK options

  /st:10000 /nod /noe

in our netcdf/fortran/msoft.mk file, so you might try that to increase the
available stack space (I don't know what the /nod and /noe options are for).

______________________________________________________________________________

Russ Rew                                           UCAR Unidata Program
address@hidden                              http://www.unidata.ucar.edu