help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: How to append new variables to existing netcdf?


From: zs1992
Subject: RE: How to append new variables to existing netcdf?
Date: Thu, 31 Oct 2019 03:31:16 -0500 (CDT)

JohnD wrote
>> Message: 1
>> Date: Tue, 29 Oct 2019 07:21:24 -0500 (CDT)
>> From: zs1992 <

> zs1992name@

> >
>> To: 

> help-octave@

>> Subject: How to append new variables to existing netcdf?
>> Message-ID: <

> 1572351684004-0.post@.nabble

>>
>> Content-Type: text/plain; charset=us-ascii
>> 
>> Hi everyone, I'm using Octave 5.1 and I'd like to do the following:
>> Create a
>> netcdf with plenty of variables. If new variables are founded in the
>> future,
>> append them to existing netcdf.variables.
>> 
>> I created a netcdf with ncwriteschema('mynetcdf.nc',Var), where known
>> variables are stored in Var.variables. Now I have come across a new
>> variable, and I've stored it in a new group NewVar.Variables. I tried to
>> do
>> ncwriteschema('mynetcdf.nc',NewVar), but it failed with a message "error,
>> netcdf, File exist && NC_noclobber".
>> 
>> I noticed that there's not other input argument for 'ncwriteschema',
>> therefore I can't define nc mode as clobber with this command. So I did
>> the
>> following:
>> ncid=netcdf_create('mynetcdf','CLOBBER');
>> netcdf_reDef(ncid);
>> ncwriteschema('mynetcdf',Var);
>> This time, another error popped up, saying 'error, netcdf, operation not
>> allowed in define mode'.
>> 
>> Now I'm out of options. Is there any way to append new variables to
>> exising
>> netcdf file?
>> 
>> 
> 
> Can you provide a small working example code of what you are doing ?

Sure.
I guess I've replied to your response in the wrong way, so here is my
program.
A few notes on my program:
1,I have more than 100 variables, in the example I only listed 3.
2,As it is mentioned in the program,the first part and second part are run
separately, therefore when new variables are found, they are stored in
different groups.
Basically, I'm looking for a solution that appends new variables to existing
variables in existing netcdf file. Feel free to contact me if more
information is needed.
example_program.m
<https://octave.1599824.n4.nabble.com/file/t373531/example_program.m>  



--
Sent from: https://octave.1599824.n4.nabble.com/Octave-General-f1599825.html



reply via email to

[Prev in Thread] Current Thread [Next in Thread]