NCAR / pynio

PyNIO is a multi-format data I/O package with a NetCDF-style interface
http://www.pyngl.ucar.edu/Nio.shtml
Apache License 2.0
112 stars 37 forks source link

Putting variables in files, NCL style #34

Open gabriel-abrahao opened 5 years ago

gabriel-abrahao commented 5 years ago

Hi everyone,

One of the most useful functionalities of NCL was that metadata was passed along with the variables, which made writing NC files from scratch (among many other things) much easier. For example, if you wanted to isolate just variable T from a big file containing several others in a file with just it, it was as simple as:

fbig = addfile("thebigfile.nc","r")
var = fbig->T
fnew = addfile("thenewfile.nc","c")
fnew->T = var

However, in PyNIO you apparently have to create the variable beforehand in the file, and have the dimensions created beforehand. Also, subsetting generally breaks the metadata and there is no copy_VarCoods-like function. Is there a plan to implement those behaviours, or maybe something already implemented that I'm not aware of?

If there's a plan, I'd be glad to contribute if someone points me in the right direction, at least with some testing.

Thanks, Gabriel