[Numpy-discussion] what python module to modify NetCDF data?

Benjamin Root ben.root at ou.edu
Sat Oct 8 12:25:20 EDT 2011


On Saturday, October 8, 2011, Kiko <kikocorreoso at gmail.com> wrote:
> Quoting Chao YUE <chaoyuejoy at gmail.com>:
>>
>> > Dear all,
>> >
>> > I want to change some variable values in a series of NetCDF file. Did
>> > anybody else did this before using python?
>> > Now I use pupynere for reading data from NetCDF files and making plots.
but
>> > the document of pupynere for writing data to NetCDF file is quite
simple and
>> > I still feel difficult to do this with pupynere.
>> >
>> > the NetCDF file I want to change is a global data (0.5X0.5d resolution,
>> > 360X720grid with 12 time steps) and have approx. 10 variables. I just
want
>> > to change some points for a specific
>> > variable for all 12 time steps. I know it's possible use NCO ncap2
utility
>> > to do the job. but now I have some problem in using ncap2 within a
shell
>> > script.
>> > I guess there is some easy way to use some python module to do the job?
like
>> > mainly altering the data that need to change while let the others
remaining
>> > intact?
>> >
>> > Any idea will be greatly appreciated. I will all a good weekend,
>> >
>> > Chao
>
> Hi.
>
> Have a look to [1] and [2].
>
> [1] http://code.google.com/p/netcdf4-python/
> [2] http://www.scipy.org/doc/api_docs/SciPy.io.netcdf.html
>

Just a caveat about scipy.io.netcdf, it only reads and writes.  It does not
modify.  So, what one has to do with that module is to load up all data,
modify some of it, and then save it all back to a new file.

Ben Root
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20111008/687debf6/attachment.html>


More information about the NumPy-Discussion mailing list