NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.

To learn about what's going on, see About the Archive Site.

[netcdfgroup] PDL::NetCDF reading char data

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

  • 2009 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdfgroup archives: