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.
Dan, > To: address@hidden > From: address@hidden (Dan Schmitt) > Subject: netcdf-perl-1.2 > Organization: Texas A&M University/Department of Rangeland Ecology and > Management > Keywords: 199803132329.QAA15292 In the above message, you wrote: > I just gave you the report on the sucsessful install > on the RedHat 4.2 alpha (gcc 2.7.2.1 and netcdf 3.3.1). Well, > I have some questions now. > > $ncid = NetCDF::open("foo.nc",WRITE); > > opens the file for read only, but > > $ncid = NetCDF::open("foo.nc",1); > > does what I want. It looks like the constants don't get > pushed to the ncopen statement correctly (at least WRITE) > and it's not tested in test.pl. Does the following work? $ncid = NetCDF::open("foo.nc",NetCDF::WRITE); > > With a netcdf file that looks like: > > dimensions: > record = UNLIMITED ; // (0 currently) > wdescription = 512 ; > variables: > char name(record, wdescription) ; > name:long_name = "Simulation Name" ; > char soil(record, wdescription) ; > soil:long_name = "Soil Coverage" ; > char plant(record, wdescription) ; > plant:long_name = "Plant Coverage" ; > char grazer(record, wdescription) ; > grazer:long_name = "Grazer Coverage" ; > char weather(record, wdescription) ; > weather:long_name = "Weather Coverage" ; > > from the ncdump world, I can't get values into the individual > variables. > > $fname = NetCDF::varid($ncid,"name"); > NetCDF::varput($ncid,$fname,(0,0),(1,1),"a"); > > Won't "do the right thing" because the varput does a dim_inquire > to check sizes and doesn't like the fact that the record dim has > a current length of zero and my total data content is greater than > that (there used to be a simlar bug in the C++ interface), and > recput wants me to set all 5 of the variables (which I guess > I could do, but is pretty unweildy for me.) Does the following work? NetCDF::varput($ncid,$fname,\(0,0),\(1,1),\"a"); As I recall, "(0,0)" will cause two *arguments* to be passed to "NetCDF::varput" rather than a single reference to an array of two scalar values. > > My XSUB programming is pretty weak, but I'm open for suggestions > from you guys on what I should try. Monday I'll hit the XSUB stuff > and see if I can relax the varput requirements, or look into the > varput1 stuff. > > Thanks, > > Dan S. > > Dan Schmitt http://ranch.tamu.edu/~dmschmit > Systems Analyst > > Ranching Systems Group Phone # (409) 845-7333 > Department of Rangeland Ecology and Management Fax # (409) 846-6430 > Texas A&M University Home # (409) 846-3914 > College Station Texas 77843-2126 ICBM: 30.67 N, 96.37 W > > When life presents you with two impossible tasks, always pick the really BIG > one. I mean, if you're determined to do the impossible anyway, why aim low? > -Jaffo -------- Steve Emmerson <http://www.unidata.ucar.edu>