Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #20636
| Date | 2012-02-20 17:52 -0500 |
|---|---|
| From | Dave Angel <d@davea.name> |
| Subject | Re: netCDF4 variable manipulation |
| References | <d9f5aa39-4541-46da-bfc5-aad7b022c24e@do4g2000vbb.googlegroups.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.22.1329778379.3037.python-list@python.org> (permalink) |
On 02/20/2012 03:37 PM, 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? > > Appreciate the help, > /S Are you using netcdf version 4, or is that name just a coincidence? If you're using a 3rd party library, you really should say so, and post a link, for those curious. in any case, if you are, I can't help you. This is apparently some special kind of variable similar to a numpy array. On the other hand, you may just be asking how to update some bytes in a file, in place. if you read the file in binary mode, then you can use seek() to go back the appropriate distance, and simply write it. -- DaveA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
netCDF4 variable manipulation Sheldon <shejo284@gmail.com> - 2012-02-20 12:37 -0800
Re: netCDF4 variable manipulation Dave Angel <d@davea.name> - 2012-02-20 17:52 -0500
Re: netCDF4 variable manipulation Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-02-20 23:53 +0000
Re: netCDF4 variable manipulation Sheldon <shejo284@gmail.com> - 2012-02-21 00:29 -0800
Re: netCDF4 variable manipulation Chris Rebert <clp2@rebertia.com> - 2012-02-21 01:10 -0800
csiph-web