Re: Plotting partial data

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Thu Apr 01 2010 - 13:37:09 MDT

On 04/01/2010 01:16 PM, Tong Qi wrote:
> Is there an equivalent function for 1d latitude/longitude arrays?

The is *basic* NCL syntax

      say x(time,lat,lon) ... where lat[*] and [lon[*]

         latS = -20
         latN = 50
         lonE = 30
         lonW = 110

      x = f->XXX(:,{latS:latN},{lonE:lonW})

Please read the mini-Labguage Manual at:

      http://www.ncl.ucar.edu/Document/Manuals/

>
>
> On Tue, Mar 30, 2010 at 12:09 PM, Dennis Shea <shea@ucar.edu
> <mailto:shea@ucar.edu>> wrote:
>
> See:
>
> http://www.ncl.ucar.edu/Document/Functions/Contributed/region_ind.shtml
>
> On 03/30/2010 11:03 AM, Tong Qi wrote:
> > Dennis,
> >
> > Most of the data fields I work with do not contain the time
> dimension.
> > Assuming the simple case of YDim and XDim which are shared by the
> > Latitude/Longitude and data, if I do what you have suggested
> (which is
> > similar to my current method), the range will be properly zoomed
> in on,
> > however all of the values of x will be read, rather than just the
> area
> > of interest.
> >
> > I'm wondering if there is some way to restrict reading only the
> values
> > in the zoomed in range for x automatically.
> >
> > Let's say x(YDim, XDim), and YDim ranges from 0-179, XDim ranges from
> > 0-359.
> > The geolocation fields of Latitude(YDim, XDim) and
> Longitude(YDim, XDim)
> > are mapped to x by:
> > x@lat2d=Latitude
> > x@lon2d=Longitude
> >
> > If I want to focus only on the western hemisphere, for example, I
> would
> > use res@mpMaxLonF=0 and
> > plot=gsn_csm_contour_map_ce(wks,x,res)
> >
> > The resultant plot would only have the western hemisphere, but all of
> > the values of x were read. A solution I found was to limit x:
> >
> > plot=gsn_csm_contour_map_ce(wks, x(:,0:179), res)
> >
> > This limit is easily found because there is a simple mapping from the
> > latitude/longitude to YDim and XDim. However, if I'm interested in a
> > smaller area that has different latS/latN/lonE/lonW, the mappings are
> > not so easily found.
> >
> >
> >
> > On Mon, Mar 29, 2010 at 9:50 PM, Dennis Shea <shea@ucar.edu
> <mailto:shea@ucar.edu>
> > <mailto:shea@ucar.edu <mailto:shea@ucar.edu>>> wrote:
> >
> > You need to be more specific.
> >
> > say x(time,lat,lon) ... the following may work for you
> >
> > latS = -20
> > latN = 50
> > lonE = 30
> > lonW = 110
> >
> > res@mpMinLatF = latS ; range to zoom in on
> > res@mpMaxLatF = latN
> > res@mpMinLonF = lonE
> > res@mpMaxLonF = lonW
> >
> > res@mpCenterLonF = (lonE+lonW)*0.5 ; optional
> > res@pmTickMarkDisplayMode = "Always"; use NCL default
> lat/lon labels
> >
> > do nt=0,ntim-1
> > plot = gsn_csm_contour_map_ce(wks,x(nt,:,:), res)
> > end do
> >
> >
> > Tong Qi wrote:
> > > Hello,
> > >
> > > I was wondering if there is any way for NCL to automatically
> > filter out
> > > parts of a plotted data field when only a certain subset of the
> > data is
> > > plotted. For example, if I plot only the western hemisphere vs. the
> > > entire globe, since NCL was assigned the full data, it will
> > adjust its
> > > labels to include all values from the entire globe, even if they
> > are not
> > > present in the area of interest. I know one way is to first look
> > at the
> > > data, then assign only the subset that I am interested in, such as
> > >
> > > data=file->data(0:179,:)
> > >
> > > to correspond with
> > >
> > > res@mpMaxLonF=0
> > >
> > > This would ensure that values outside of the area of interest
> are not
> > > included in the plot, but the situation becomes tricky if the
> > file uses
> > > non-standard latitude/longitude mappings and I want to subset a
> more
> > > precise area rather than just a hemisphere. I am hoping there
> is some
> > > sort of automatic solution for subset plots.
> > >
> > > Thanks,
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Apr 1 13:37:17 2010

This archive was generated by hypermail 2.1.8 : Wed Apr 07 2010 - 07:12:50 MDT