This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.
Sunil, > To: address@hidden > From: Sunil M Sawani <address@hidden> > Subject: ncvarinq > Organization: UCAR/Unidata > Keywords: 200007261903.e6QJ3XT06819 The above message contained the following: > I have a piece of code using the netCDF library. I have a single variable > out of a bunch that is giving me problems. As far as I can tell, there is > nothing different in this one ncvpt (I am using the FORTRAN interface) > call from the rest of them, yet, it gives me an error. The error is: > "ncvarinq: invalid use of GLOBAL variable". My entire department is > stumped! If you could give any possibly causes, that would be lovely. The > code fragment follows. I have omitted the declaration of the variables, > and only included the ncvpt calls. If any more code is needed to diagnose > this, please let me know. Thanks! > > BTW, the call that causes this error is the one for the variable called > "chisq". > > Sunil Sawani > Space Physics Research Lab > University of Michigan > > --------------------------------------------------- > c store region > call ncvpt(ncid, regionid, start, count, region, iret) > > c store local_time > call ncvpt(ncid, local_timeid, start, count, local_time, iret) > > c store lat > call ncvpt(ncid, latid, start, count, lat, iret) > > c store chisq > write(*,*) 'write_rec: before the store chisq call' > write(*,*) 'write_rec: THE PROBLEM AREA' > call ncvpt(ncid, chisqid, start, count, chisq, iret) > write(*,*) 'write_rec: store chisq ncvpt()' > > c store lon > call ncvpt(ncid, lonid, start, count, lon, iret) > > c store chisq_0 > call ncvpt(ncid, chisq_0id, start, count, chisq_0, iret) The error message should be "Action prohibited on NC_GLOBAL varid" if you're using the latest netCDF package. This message occurs if the variable ID in a variable-access routine is NC_GLOBAL (which is -1) rather than a valid variable ID (which is a positive integer). I'd guess, therefore, that the variable "chisqid" has the value -1. Regards, Steve Emmerson <http://www.unidata.ucar.edu>