This has arisen as a problem of converting NETCDF4 to NETCDF3_CLASSIC which is still used by some old software. I did try nc4tonc3 provided with netCDF4 but that one also wanted the input file in NETCDF4_CLASSIC format... That is why I wrote this little script to actually copy variables and dimensions. There were no attributes in the files, so I did not care to handle attributes.
From a comment by Nikolay Koldunov, there is a utility for this tasks nccopy ...
3 comments:
Thanks a lot, I needed this for my script :-)
I get syntax error at line
outVar.setncatts({k: varin.getncattr(k) for k in varin.ncattrs()})
^
SyntaxError: invalid syntax
I'm using python 2.6, could this be the problem?
Ivano:
Yes Python 2.6 was your problem, dictionary comprehensions appeared in Python 2.7
Cheers
Post a Comment