[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: How to append new variables to existing netcdf?
From: |
JohnD |
Subject: |
RE: How to append new variables to existing netcdf? |
Date: |
Tue, 29 Oct 2019 13:57:53 -0400 |
> Message: 1
> Date: Tue, 29 Oct 2019 07:21:24 -0500 (CDT)
> From: zs1992 <address@hidden>
> To: address@hidden
> Subject: How to append new variables to existing netcdf?
> Message-ID: <address@hidden>
> 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 ?