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.
Kevin, > To: address@hidden > cc: address@hidden, > cc: address@hidden > From: "Kevin Robbins" <address@hidden> > Subject: NetCDF Perl Problem > Organization: Louisiana State University/Southern Regional Climate Center > Keywords: 199709170115.TAA14094 In the above message, you wrote: > > I am having a problem creating a 'scalar variable' using the perl interface. I > followed the NetCDFPerl manual page suggestion of using: > > NetCDF::vardef($ncid, "scalar_variable", NetCDF::FLOAT,\()); > > but the program fails with the error message: > > Usage: NetCDF::vardef(ncid, name, type, dimids) at rcc2nrcs.observed.pl > line 105, <CDBSVAR> chunk 10. > > The line I am using in my perl program is: > > NetCDF::vardef($ncid_cdbs,'base_time',NetCDF::DOUBLE,\()); > > If I do not include this line, everything else works fine. Global variables, > variables, attributes, and dimensions are all created fine. If I use a > reference to a dimensioned array with no values to create my 'base_time > variable, I get a 'base_time' variable with the unlimited dimension. I even > tried a 'dimids' reference to a null valued array (@null_dim = ();) with no > success. > > Any thoughts on how a can successfully create a 'scalar variable' having no > dimensions using the perl interface? This is the last thing to complete in a > 320-line perl program! > > Kevin > > - -- > Kevin Robbins, Assoc. Dir. __/| Phone: (504) 388-1063 (I hate calls) > Southern Regional Climate Center \o0| FAX: (504) 388-2912 ^^^^ > Louisiana State University =(~ )= email: address@hidden Try the following (it worked for me): NetCDF::vardef($ncid, "scalar_variable", NetCDF::FLOAT, []); Regardless of the perl documentation, "\()" isn't the same as "[]". :-( Please let me know if this helps. -------- Steve Emmerson <http://www.unidata.ucar.edu>