On Mon, 20 Feb 2012 12:37:22 -0800, Sheldon wrote: > Hi, > > I'm trying to read a netCDF4 variable from a file (no problem) and then > scale it before writing over the original variable in the file. > > I'm using python 2.7 and the latest netCDF4 module. It's not that I keep > getting an error message but I want to do this without using for loops > and all the manuals seems to be skipping this task as if it is never > done. I'm new to python and coming over from matlab. Does anyone know > how to modify the netCDF4 variable in python and then write it back > without creating a new variable, or using for loops?
There is no such thing as "the netCDF4 variable" in Python -- it is not a built-in part of the language, and therefore there is no built-in feature for manipulating it. You are going to have to be more specific about what you want than just "how do I modify a variable with for loops?". My wild guess is that you have some sort of config file which includes a field called "netCDF4" and you want to update it in place. We can't tell you how to do this without knowing what the config file is -- is it an INI file, XML, JSON, YAML, Unix-style rc file, a binary pickle, or something else? -- Steven -- http://mail.python.org/mailman/listinfo/python-list