Dear PDL:ers,

I am revisiting an old project and need to reuse bits of code I wrote nearly a decade ago. The code uses PDL:NetCDF to write piddles with the results of some modelling to netCDF for use in other software.

The part of the code that writes NetCDF is this:

# write NetCDF

my $ncobjout;
$ncobjout = PDL::NetCDF->new("matrix.grd",'w','y','x',{MODE => O_CREAT|O_RDWR,REVERSE_DIMS => 1, NC_FORMAT => PDL::NetCDF::NC_FORMAT_NETCDF4});
$ncobjout->putatt('COARDS/CF-1.0','Conventions');
$ncobjout->put('y',['y'],$y);
$ncobjout->put('x',['x'],$x);
$ncobjout->put('w',['y','x'],$matrix(:,:));
$ncobjout->close;

It fails with a strange message:

Can't locate object method "dims" via package "100" (perhaps you forgot to load "100"?) at /usr/local/perls/perl-5.32.0/lib/site_perl/5.32.0/x86_64-linux/PDL/NetCDF.pm line 1333

But it worked fine 8-10 yrs ago. Also there is no reference to a package called "100"(?) in the code for PDL::NetCDF.

Now, on CPAN PDL:NetCDF is v 4.2 från 2013 (!) and although it compiles fine, 17/21 tests fail on HDF5 conflicts. That may explain something. My netCDF is version 4.7.4.

A part of me tells me that I should not reuse old PDL code but just rewrite everything needed in numpy and move on. Another part of me would prefer not to and believes (perhaps naively?) that there is an easy solution. Any ideas?

Thanks in advance

Hernán




_______________________________________________
pdl-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pdl-general

Reply via email to