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

20010626: need help with ncvdef call



Devon,

>Date: Tue, 26 Jun 2001 15:48:39 -0400
>From: "Devon S. Prichard" <address@hidden>
>Organization: Virginia Tech/VCES
>To: Steve Emmerson <address@hidden>
>Subject: Re: 20010626: need help with ncvdef call
>Keywords: 200106261950.f5QJou102336

The above message contained the following:

> I wasn't using an unlimited-dimension array (generally I have
> been using fixed-size arrays, since that's the way other
> codes here have used netCDF; hope that's OK practice). The
> dims array was dimensioned to 3 elements, and the values
> I tried were 4,2,0 and 4,2,1. Neither worked.
> 
> What I did do was replace a hard value for nvdims in the argument
> list with a local variable with value two, and that seems
> to make the library happy;
> 
>       nvdims = 2
>       dims(1) = dim_Nflt
>       dims(2) = dim_ThreeD
>       id_XYZac = ncvdef(ncfilid,"XYZac",NCDOUBLE,nvdims,dims,rcode)
> ccc      id_XYZac = ncvdef(ncfilid,"XYZac",NCDOUBLE,2,dims,rcode)
> 
> It would seem that the value of "2" was not passed happily
> across the interface.

I've seen a problem like this before with Fortran-77 routines.  If one
makes a call like the following:

    call sub1(2)

and the subroutine expects a vector and modifies it:

    subroutine sub1(i)
    integer i(1)
    i(1) = 3
    return

then, from then on, the "constant" 2 will have the value 3.

You might check your code for occurances of the constant 2 in argument 
lists.

> So anyways, my code seems to run OK now. On to the next bug...
> 
> But if there's any documentation anywhere which describes
> the Fortran/C wrapper setup, let me know.

There's no such documentation.

Regards,
Steve Emmerson   <http://www.unidata.ucar.edu>