Re: [Matplotlib-users] Area averaged

2014-02-23 Thread Alex Goodman
Hi Fadzil, Ah sorry, I glossed over that part of your question. There are actually two solutions to this, one would be to actually find the indices where the latitudes and longitudes are within your desired bounds using numpy.where(). However I generally prefer to use numpy's built-in fancy indexi

Re: [Matplotlib-users] Area averaged

2014-02-23 Thread Fadzil Mnor
Thanks Alex for the reply. So, that script calculates the global SST. What if when we want to calculate for only in specific box? For example, SST over this area only: --- 10 N | | |

Re: [Matplotlib-users] Area averaged

2014-02-23 Thread Alex Goodman
Hi Fadzil, All you actually need to do is use numpy.average(), which is numpy's implementation of the weighted average. It can be shown geometrically that using the cosine of the latitude as the weights in the weighted average would give you approximately the area average, though if your SST data

[Matplotlib-users] Area averaged

2014-02-23 Thread Fadzil Mnor
Hi, I just started using Python for the last few weeks, and previously been using GrADS for around 4 years. I have trouble looking for a simplest way to calculate area average, let say I need to calculate a SST over a region of 20S-10N and 130E-170E. I know how to get one point values of SST vs Tim