[Tutor] Python Help

Chris Calloway cbc at unc.edu
Wed Apr 9 23:48:50 CEST 2014

On 4/9/2014 3:59 PM, Adam Grierson wrote:
> I'm using 3D climate data (ending in “.nc”). The cube contains time,
> longitude and latitude. I would like to look at the average output over
> the last 20 years. The time field spans back hundreds of years and I
> only know how to collapse the entire field into a mean value. How can I
> tell python to collapse just the last 20 years into a mean value?

An ".nc" file extension is NetCDF. NetCDF can be served by a DAP server. 
A DAP server can be sent a DAP request by a Python DAP client to drill 
for results confined to particular variables, a geographic bounding box, 
and a stop and start timestamp. See:


Or you can simply subset the desired subarray of NetCDF data using SciPy:


Here's a tutorial:



Chris Calloway http://nccoos.org/Members/cbc
office: 3313 Venable Hall   phone: (919) 599-3530
mail: Campus Box #3300, UNC-CH, Chapel Hill, NC 27599

More information about the Tutor mailing list