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
indexing for this type of problem. For example:

# lat and lon are extracted from the netcdf file, assumed to be 1D
# Determine which latitudes are between 20S and 10N
latidx = (lat >= -20) & (lat <= 10)

# Determine which longitudes are between 130E and 170E.
# The numbers here may differ depending on the longitude convention in your
data.
lonidx = (lon >= 130) & (lon <= 170)

# Now we will actually subset the data. We need to subset lat too to make
sure weights are consistent.
sst = sstv[:]
sst = sst[:, latidx][..., lonidx]
lat = lat[latidx]

Yes, the indexing does get a little tricky but it should work if you do it
this way, then follow the same procedure outlined in the previous email.

Thanks,
Alex

On Sun, Feb 23, 2014 at 6:02 PM, Fadzil Mnor <fadzilmno...@gmail.com> wrote:

> 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
> |                                             |
> |                                             |
> |                                             |
> |                   SST                  |
> |                                             |
> |                                             |
> ----------------------------------- 20 S
> 130 E                                 170E
>
> Thanks.
>
> Fadzil
>



-- 
Alex Goodman
Graduate Research Assistant
Department of Atmospheric Science
Colorado State University
------------------------------------------------------------------------------
Flow-based real-time traffic analytics software. Cisco certified tool.
Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer
Customize your own dashboards, set traffic alerts and generate reports.
Network behavioral analysis & security monitoring. All-in-one tool.
http://pubads.g.doubleclick.net/gampad/clk?id=126839071&iu=/4140/ostg.clktrk
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to