Re: [netcdfgroup] PDL::NetCDF cannot write to existing netcdf files

Also in the docs it mentions:

If this file exists and you want to write to it, prepend the name with
the '>' character: ">name.nc"

So with this code:

my $nc = PDL::NetCDF->new(">testnc.nc", {MODE=>O_RDWR,REVERSE_DIMS=>1});

I get the same error:

MODE set and testnc.nc starts with >: suppressing > at ./testme.pl line 7
Cannot write read-only netCDF file testnc.nc at ./testme.pl line 9



Brice Lambi wrote:
> The docs don't mention an open function and I've tried various things to
> find one, but it doesn't seem to exist.  In the examples on the website:
> 
> http://search.cpan.org/~dhunt/PDL-NetCDF-4.01/netcdf.pd
> 
> They have this example:
> 
>   # opening existing file for reading and writing
>   $nc = PDL::NetCDF->new ("file2.nc", {MODE => O_RDWR,
>                         REVERSE_DIMS => 1});
> 
> Which is what I'm doing, but I get the same error when I try to put data
> (line 9 is the $nc->put).
> 
> Thanks,
> Brice
> 
> 
> Ted Mansell wrote:
>> I don't know anything about PDL, but I see the function is "new" so
>> maybe there is an "open" function call?  Perhaps "new" assumes that the
>> file doesn't exist already and doesn't like it when it does.  (Is line 9
>> the "my $nc =" or "$nc->put"?)
>>
>> -- Ted
>>
>>
>> On Jul 15, 2009, at 4:03 PM, Brice Lambi wrote:
>>>
>>> my $nc = PDL::NetCDF->new("testnc.nc", {MODE=>O_RDWR|REVERSE_DIMS=>1});
>>> my $data = pdl [1,2,3];
>>> $nc->put('time_nominal', ['recNum'], $data);
>>> $nc->close();
>>>
> 
> _______________________________________________
> netcdfgroup mailing list
> netcdfgroup@xxxxxxxxxxxxxxxx
> For list information or to unsubscribe,  visit: 
> http://www.unidata.ucar.edu/mailing_lists/ 



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