Re: why are the contour and map out of phase?

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Tue, 2 Sep 2008 11:03:40 -0600 (MDT)

Xuguang,

In order to overlay data correctly on a map, you need to either have
data that has already been projected onto some map projection, or you
must have latitude/longitude information about where your data is to
be overlaid.

For example, if you have a 1D array of latitude values (length
'nlato') and a 1D array of longitude values (length 'nlono') that
represents the lat/lon locations of your grid, then you can attach
them to your variable 'ps' as metadata, and this information will be
used by NCL to do the overlay correctly.

For example, if your arrays are called 'lat1d' and 'lon1d', then
attaching the metadata would look something like this:

   lat1d_at_units = "degrees_north"
   lon1d_at_units = "degrees_east"
   ps!0 = "lat"
   ps!1 = "lon"
   ps&lat = lat1d
   ps&lon = lon1d

Now, when you call gsn_csm_contour_map, the "ps" variable has the
necessary lat/lon information to plot it correctly over a map.

For an example of a script that calls fbindirread, and then calculates
the lat/lon information somehow, go to:

    http://www.ncl.ucar.edu/Applications/mcsst.shtml

and look at the first example.

If your data has already been projected over a map, then you must know
what the exact map projection is, and then set res_at_tfDoNDCOverlay =
True to tell NCL not to put your data through a projection. For an
example, go to:

    http://www.ncl.ucar.edu/Applications/native.shtml

and look at the first example. It also calls fbindirread, but
it sets some resources to get the map projection exactly right.

If you have 2D latitude/longitude variables (called, for example,
"lat2d" and "lon2d") that represent the lat/lon locations of your 2D
grid, then you would do:

   ps_at_lat2d = lat2d
   ps_at_lon2d = lon2d

See:

http://www.ncl.ucar.edu/Applications/roms.shtml

for some examples of this.

--Mary

On Tue, 2 Sep 2008, Xuguang Sun wrote:

> Hi, everyone,
>
> I have a binary data file, and open and read it by
> fbindirread() function correctly. Then, I open wks by
> gsn_open_wks() and try to draw it by
> gsn_csm_contour_map(). To illustrate my question
> clearly, suppose the variable is "ps", and the snippet
> code like the following,
>
> ps_rec = 0
> ps_dims= (/nlato, nlono/)
> ps = fbindirread(psfile, ps_rec, ps_dims, "float")
>
>
>
> res =True
> res_at_mpCenterLonF = 180.
> wks =gsn_open_wks("X11","xx")
> plot =gsn_csm_contour_map(wks, ps, res)
>
> the plotted figure shows that ps contour is out of
> phase with the map, if I use False instead of res in
> function gsn_csm_contour_map, the same error occurs
> except that both contour and map shift at 180 degree.
>
> So how to solve this problem?
>
> Thanks in advance.
>
> SUN Xuguang
> Department of Atmospheric Sciences, Nanjing University
> 22 Hankou Road,Nanjing,P.R.China (210093)
> Tel: +86-025-83597203 (O)
> Email: sunxg007_at_yahoo.com.cn
>
>
> ___________________________________________________________
> ÑÅ»¢ÓÊÏ䣬ÄúµÄÖÕÉúÓÊÏ䣡
> http://cn.mail.yahoo.com/
> _______________________________________________
> ncl-talk mailing list
> ncl-talk_at_ucar.edu
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>

_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Sep 02 2008 - 11:03:40 MDT

This archive was generated by hypermail 2.2.0 : Wed Sep 03 2008 - 11:24:29 MDT