- To: netcdfgroup@xxxxxxxxxxxxxxxx
- Subject: [netcdfgroup] PDL::NetCDF reading char data
- From: Brice Lambi <lambi@xxxxxxxx>
- Date: Mon, 10 Aug 2009 16:23:45 -0600
Hello,
I'm having some more problems reading char data from nc files. In this
example I have written one record to the nc file and now I am trying to
read that record, append to it and re-write it. I try reading the data
with this call:
$tmp = $nc->get("rep_type", [0,0], [$recn, 4]);
(where $recn will be 1)
I get this error:
Invalid position at
/d1/lambi/local/lib/perl5/site_perl/5.8.9/x86_64-linux/PDL/Char.pm line 278.
Attached is the netcdf file I am using, and this is the script that
gives me the error message:
#!/usr/bin/env perl
use PDL;
use PDL::Char;
use PDL::NetCDF;
use Fcntl;
#open nc file and put some string data
$nc = PDL::NetCDF->new("testnc.nc", {MODE=>O_RDWR});
$recn = $nc->dimsize("recNum");
print $recn . "\n";
if ($recn > 0) {
$tmp = $nc->get("rep_type", [0,0], [$recn, 4]);
}
$nc->close();
Attachment:
testnc.nc
Description: Cdf file