Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Any simple way to remove or replace variables in a NCDataset? #260

Closed
Datseris opened this issue Jun 11, 2024 · 2 comments
Closed

Any simple way to remove or replace variables in a NCDataset? #260

Datseris opened this issue Jun 11, 2024 · 2 comments

Comments

@Datseris
Copy link
Contributor

I have two variables x, y in a NCDataset. From them I can produce z = f(x, y). I want to add z to the dataset and remove x,y. Is there a simple way to achieve this? I would be very happy to know! I can even write a tutorial about this for the docs!

@Alexander-Barth
Copy link
Member

Sadly, the NetCDF C API does not allow this, e.g.

Unidata/netcdf4-python#940
https://www.unidata.ucar.edu/mailing_lists/archives/netcdfgroup/1998/msg00052.html

But as you probably know, you can re-create a NetCDF file by excluding the variable that you do not want to keep.
https://alexander-barth.github.io/NCDatasets.jl/stable/dataset/#Base.write

@ctroupin
Copy link
Collaborator

With nco I think it's pretty simple, in particular with https://nco.sourceforge.net/nco.html#ncap2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants