Bug#611346: PDL::NetCDF should support OPeNDAP, just as current NetCDF does

2011-01-31 Thread Ivan Shmakov
 IS == Ivan Shmakov i...@main.uusia.org writes:

[…]

 IS The version of NetCDF currently in Debian Sid supports retrieving
 IS datasets via OpenDAP (see below for an example.)  On the contrary,
 IS PDL::NetCDF doesn't:

  pdl my $nc = PDL::NetCDF-new 
  (http://test.opendap.org:8080/dods/dts/test.01;); 
  new:  Cannot create netCDF file -- No such file or directory

  pdl 

 IS I've traced this issue down to the PDL::NetCDF::nc_open () wrapper
 IS (newlines added to for readability):

[…]

Strangely enough, but it seems that it's the OCLOGFILE=/dev/null
workaround for Debian Bug#611338 that makes
PDL::NetCDF-nc_open () fail.  With OCLOGFILE unset or empty, it
seems to work.

As for the PDL::NetCDF-new () constructor, the “if (-e $file)”
logic has to be amended to check for a “looks like an URI” case.
(A regular expression, perhaps?)  Or, alternatively, I'd vote
for a completely separate new_from_uri () constructor to handle
the URI objects and strings.  (And then would hope for NetCDF to
follow with a similar change.)

-- 
FSF associate member #7257


pgpKgjPY5c1Yz.pgp
Description: PGP signature


Bug#611346: PDL::NetCDF should support OpenDAP, just as current NetCDF does

2011-01-28 Thread Ivan Shmakov
Package: libpdl-netcdf-perl
Version: 4.03-1
Severity: wishlist

The version of NetCDF currently in Debian Sid supports
retrieving datasets via OpenDAP (see below for an example.)  On
the contrary, PDL::NetCDF doesn't:

pdl my $nc = PDL::NetCDF-new 
(http://test.opendap.org:8080/dods/dts/test.01;); 
new:  Cannot create netCDF file -- No such file or directory

pdl 

I've traced this issue down to the PDL::NetCDF::nc_open ()
wrapper (newlines added to for readability):

pdl use PDL::NetCDF;
pdl my $ncid;
 my $nc_status = PDL::NetCDF::nc_open 
(http://test.opendap.org:8080/dods/dts/test.01;, 0, $ncid = -999);
 printf (nc_status = %3d;\nncid = 0x%x;\n, $nc_status, $ncid);
nc_status = -68;
ncid = 0x;


pdl 

The seemingly equivalent C program apparently succeeds there:

$ cat  nc-example.c 
#include assert.h
#include netcdf.h
#include stdio.h

int
main (int argc, char *argv[])
{
  assert (argc - 1 == 1);

  int ncid;
  int nc_status
= nc_open (argv[1], NC_NOWRITE, ncid);

  printf (nc_status = %3d;\nncid = 0x%x;\n,
  nc_status, ncid);

  /* . */
  return 0;
}
$ gcc nc-example.c -o nc-example -lnetcdf 
$ ./nc-example http://test.opendap.org:8080/dods/dts/test.01 
nc_status =   0;
ncid = 0x1;
$ 

Of course, there's an option to use nccopy(1) here, like:

$ nccopy http://test.opendap.org:8080/dods/dts/test.01 test.nc 

But it's inconvenient.  (And note also Debian Bug#611338.)

PS.  I guess that with OpenDAP support in PDL::NetCDF, some very
impressive demos could be made using the OpenDAP service of the
weather data available from the NOMADS project [1].

[1] http://nomads.ncep.noaa.gov/

-- 
FSF associate member #7257


pgptOJmxWd0na.pgp
Description: PGP signature