|*||The number, order, and semantics of the arguments are identical. Note, however, that it is not necessary to specify the number of elements in an array because perl arrays carry that information.|
|*||The behavior is the same in terms of the netCDF dataset.|
|*||A value of <B>-1B> is returned to indicate an error.|
Scalar argument types are mapped in an obvious way:
.in 0 3trans].nr 3crow 0 CPerl 5 3trans].nr 3brule 1 3trans].nr 3crow 1 char *string charinteger 3trans].nr 3brule 1 3trans].nr 3crow 3 shortinteger 3trans].nr 3crow 4 intinteger
The individual elements of an array argument are similarly mapped.
Array arguments themselves are passed by reference for both input and output. For example, the following Perl 5 code will write and then read a hyperslab of values:
@start = (0, 0, 0); @count = (1, 2, 3); @out = (1, 2, 3, 4, 5, 6); NetCDF::varput($ncid, $varid, start, count, out); NetCDF::varget($ncid, $varid, start, count, in);
(The above assumes that <B>$ncidB> and <B>$varidB> have been appropriately set.) After this code is executed, the array <B>@inB> will have the same values as the array <B>@outB>. The previous contents, if any, of an array used for input are destroyed (e.g. <B>@inB> in the above example).
NetCDF::vardef($ncid, "scalar_variable", NetCDF::FLOAT, \());
The interface doesnt support null arguments. One cannot use a void pointer to indicate that no value is requested for a particular argument: all arguments must be present.
For technical reasons, output variables must be initialized, i.e. any variable argument that is to have its value set by a function must already have a value. For example, if the first occurrence of the variable <B>$attvalB> is in the following:
NetCDF::attget($ncid, NetCDF::GLOBAL, "history", \$attval);
then a core dump will probably result. The solution is to initialize the variable before using it:
$attval=""; NetCDF::attget($ncid, NetCDF::GLOBAL, "history", \$attval);
Two additional functions are provided for error handling. <B>NetCDF::opts(i)B> determines the handling of errors by setting the <B>ncoptsB> variable to <B>iB>. It returns the previous value. <B>NetCDF::err()B> returns the value of the error code variable, <B>ncerrB>.
In addition to the above functions, most C macro constants that are defined in the netCDF header file <B>netcdf.hB> are also available to a perl script by dropping any <B>NC_B> substring and using the <B>NetCDF::B> prefix, e.g. <B>NetCDF::LONGB>.
|Printed: n(yr-n(mo-n(dy||NETCDFPERL (1)||1999-07-21|