Greetings! This file briefly describes the Unidata netCDF Perl package.
The netCDF Perl package is no longer being actively maintained or supported by the Unidata Program Center.
The netCDF Perl package is a perl extension module for scientific data access via the netCDF API.
The netCDF Perl package is a perl extension for accessing netCDF datasets based on version 2 of the netCDF package (netCDF-2). For example, the following netCDF-2 actions:
-
Open dataset "foo.nc";
-
Write a 2 x 3 array of double-precision values into the starting corner of the first variable; and
-
Close the dataset.
can be accomplished by the following C fragment:
int ncid = ncopen("foo.nc", NC_WRITE);
int varid = 0;
long start[2], count[2];
double values[6];
ncid = ncopen("foo.nc", NC_WRITE);
start[0] = 0;
start[1] = 0;
count[0] = 2;
count[1] = 3;
values[0] = 0.0;
values[1] = 1.0;
values[2] = 2.0;
values[3] = 3.0;
values[4] = 4.0;
values[5] = 5.0;
ncvarput(ncid, varid, start, count, values);
ncclose(ncid);
or by this equivalent perl fragment:
use NetCDF;
$ncid = NetCDF::open("foo.nc", NetCDF::WRITE);
$varid = 0;
@start = (0, 0);
@count = (2, 3);
@values = (0, 1, 2, 3, 4, 5);
NetCDF::varput($ncid, $varid, \@start, \@count, \@values);
NetCDF::close($ncid);
There are perl-callable functions for all appropriate functions of the netCDF-2 API.
netCDF-2 vs. netCDF-3
Currently, the netCDF Perl extension module is implemented using version 2 of the netCDF API (netCDF-2). On 1997-05-16, version 3 of the netCDF package was released (netCDF-3). This newer version, however, contains a netCDF-2 backward compatibility interface. Thus, with a few minor changes already made, netCDF Perl works with netCDF-3 as well as netCDF-2.
Users should be aware, however, that the netCDF Perl user-interface is based on netCDF-2. In particular, the netCDF Perl documentation doesn't describe the netCDF Perl interface in detail but instead describes the differences between it and the netCDF-2 interface. The intention was that users would use the netCDF Perl and netCDF-2 documentation together in order to program using netCDF Perl.
With the deprecation of the netCDF-2 interface, this has become slightly problematical -- but not unworkable. The solution is to ensure the availability of the netCDF-2 documentation.
The Unidata netCDF library web site contains user guides, manual pages, information on the various versions of netCDF, and more.
Unidata netCDF Perl
The source for netCDF Perl is here on GitHub.
Other Sources
Note: The following are third-party and have not been verified or validated by the Unidata Program Center.
RedHat RPM & ncmanipulate
Alan Iwi's source and binary RPMs for RedHat Linux and ncmanipulate module to manipulate NetCDF files.
Fedora Installation
Fedora provides a package called "netcdf-perl".
PDL::NetCDF
Doug Hunt's perl interface which uses the PDL (perl data language) extension.
See the file INSTALL in the top-level directory of the netCDF Perl distribution for instructions on how to incorporate netCDF Perl into your perl utility.
Note: You will need write access to your installed perl(1) libraries in order to install netCDF Perl.
The netCDF Perl manual page details how to use the NetCDF Perl package.
Read the list of known problems with the netCDF Perl package.
Requesting Support
NetCDF Perl is under community development. Please post any questions or bugs to the GitHub Issues for this repository.
You can also view past netCDF perl support questions answered by Unidata developers.
Defunct Mailing List
Perl had a community mailing list associated with it at one time. The mailing list is no longer active, but the list archive is still available for reference.
netCDFPerl doesn't install under OSF/1
make install
might fail to install the netCDFPerl package under OSF/1. This might be due to a bug in make(1). The solution is to move the line
.PRECIOUS: Makefile
in the file perl/Makefile to after the all target.