comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: changing the content of a NCDF file
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: changing the content of a NCDF file [message #78319] Fri, 11 November 2011 07:07
natha is currently offline  natha
Messages: 482
Registered: October 2007
Senior Member
Ok, here is the solution (I was missing teh WRITE keyword in
NCDF_OPEN)

ncdf_id=NCDF_OPEN(file,/WRITE)
var_id=NCDF_VARID(ncdf_id,var)
NCDF_VARPUT, ncdf_id, var_id, new_data
NCDF_CLOSE, ncdf_id

Thank you,
nata
Re: changing the content of a NCDF file [message #78321 is a reply to message #78319] Fri, 11 November 2011 06:16 Go to previous message
Kenneth P. Bowman is currently offline  Kenneth P. Bowman
Messages: 585
Registered: May 2000
Senior Member
In article
<5478db14-2c54-4393-b293-3ade2518d1a7@o9g2000vbc.googlegroups.com>,
nata <bernat.puigdomenech@gmail.com> wrote:

> Before start trying things, do you know if it's possible to change the
> content of a NCDF file without reading the whole content and writing
> it back to a new file ?

This is possible as long as you don't add new dimensions or variables.
That is, as long as you do not go into define mode with

NCDF_CONTROL, id, /REDEF

This explains why, although not in a completely clear way

http://www.unidata.ucar.edu/software/netcdf/docs/netcdf/Clas sic-File-Parts.html#Classic-File-Parts


Ken Bowman
Re: changing the content of a NCDF file [message #84636 is a reply to message #78321] Fri, 11 November 2011 07:04 Go to previous message
natha is currently offline  natha
Messages: 482
Registered: October 2007
Senior Member
Ok, this is what I try and It doesn't work:

ncdf_id=NCDF_OPEN(file)
ar_id=NCDF_VARID(ncdf_id,var)
NCDF_VARPUT, ncdf_id, var_id, new_DATA
NCDF_CLOSE, ncdf_id

What am I missing ? I am not changing dimensions I just want to
replace the content...
Bernat
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: GRIB data question
Next Topic: Re: Find the nearest location only on left/right side in SRCOR and MATCH_2D function

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 13:33:49 PDT 2025

Total time taken to generate the page: 0.00413 seconds