[Numpy-discussion] loop through values in a array and find maximum as looping

Tim Burgess Tim.Burgess at noaa.gov
Tue Dec 6 23:42:44 EST 2011


On 07/12/2011, at 1:49 PM, questions anon wrote:


>             fillvalue=ncfile.variables['T_SFC']._FillValue
>             TSFC=MA.masked_values(TSFC, fillvalue)

You can probably also eliminate the above two lines from your code.

>             TSFC=ncfile.variables['T_SFC'][:]

If your NetCDF files are properly structured, 
the above line will give you a masked array.

If you really need to put a fill value in to go to a non-masked array,
better to do this just once after the maximums have been determined.

Tim 




More information about the NumPy-Discussion mailing list