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

Re: 950119: bad dimension id



>Keywords: 199501191629.AA06571

Hi Jim,

> I am writing a Fortran program to convert some data into
> the netCDF format.  The compiler is SPARCompiler FORTRAN 3.0
> running on a SPARCstation2 with Solaris 2.3
> 
> The line:
> AASASP_001id = ncvdef (ncid, 'AASASP_001', NCFLOAT, 3, pmsdims, iret)
> 
> caused the error:
> ncvardef: Bad dimension id -1
> 
> At the time of execution, the variables:
> ncid = 0
> pmsdims(1) = 3
> pmsdims(2) = 2
> pmsdims(3) = 1
> iret = 0
> ncfloat = 5
> 
> 
> I don't see anything wrong with the syntax of this line but 
> perhaps you could give me some suggestions as to where I should
> be looking.  I've been stumped.

Is the array "pmsdims" declared to be of type INTEGER, or is it instead
typed implicitly as REAL?  If the latter is the case, that might explain
the symptoms, since ncvdef expects integer dimension IDs, and a
floating-point representation of an integer dimension ID would be
interpreted as a bad dimension ID.  That wouldn't explain why the error
message says the dimension id is "-1" though.

Have you actually called ncddef previous to this at least 3 times, so that
the dimension IDs 1, 2, and 3 correspond to defined dimensions?  If not,
that could also explain the message.  Ordinarily you wouldn't assign
integers explicitly as dimension IDs to an array, but would instead use the
values returned from previous ncddef calls or ncdid calls, as in

        pmsdims(1) = ncdid(ncid, 'latdim', iret)

or
        pmsdims(2) = ncddef(ncid, 'londim', nlons, iret)

If these suggestions don't help, we'll need to see a small but complete
example program that demonstrates the problem so we can reproduce it here.

--Russ
______________________________________________________________________________

Russ Rew                                                UCAR Unidata Program
address@hidden                                          P.O. Box 3000
http://www.unidata.ucar.edu/                          Boulder, CO 80307-3000
______________________________________________________________________________