About... Prerequisites Examples Home Bugs Download Manual Links

Example 1

    import Numeric
    from Scientific.IO.NetCDF import NetCDFFile
    from pyclimate.ncstruct import nccopystruct
    
    ncf = NetCDFFile("data/data.nc")
    var = ncf.variables["slp"][:]
    ave = Numeric.sum(var) / float(len(var))
    dims = ("lat","lon")
    onc = nccopystruct("data/avedata.nc",ncf,
                       dims,dims,dims)
    onc.title = "My new NetCDF"
    ncvar = onc.createVariable("ave","d",dims)
    ncvar.long_name = "My averaged variable"
    ncvar[:,:] = ave
    onc.close()
    



Contact the
Webmaster