I would like to calculate the max and min of many netcdf files. <br>I know how to create one big array and then concatenate and find the numpy.max but when I run this on 1000's of arrays I have a memory error. What I would prefer is to loop through the arrays and produce the maximum without having the make a big array.<br>
My idea goes something like:<br><br>netCDF_list=[]<br>maxarray=[]<br><br>for dir in glob.glob(MainFolder + '*/01/')+ glob.glob(MainFolder + '*/02/')+ glob.glob(MainFolder + '*/12/'):<br>        for ncfile in glob.glob(dir + '*.nc'):<br>
            netCDF_list.append(ncfile)<br>for filename in netCDF_list:<br>        ncfile=netCDF4.Dataset(filename)<br>        TSFC=ncfile.variables['T_SFC'][:]<br>        fillvalue=ncfile.variables['T_SFC']._FillValue<br>
        TSFC=MA.masked_values(TSFC, fillvalue)<br>        for i in TSFC:<br>                if i == N.max(TSFC, axis=0):<br>                        maxarray.append(i)<br>                else:<br>                        pass <br>
<br>print maxarray<br><br><br><br>