Re: grid boxes

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Thu, 8 Jun 2006 09:16:53 -0600 (MDT)

>I would like to use the NCL-equivalent of grads "set gxout grid."
>For an XY plot (month versus year), I would like grid boxes to
>be plotted with the numerical value appearing at the center of
>each box. How do I do this?
>
>Example:
>
>y ------------
>e | 2 | 4 |
>a ------------
>r | 3 | 5 |
> ------------
> month
>_______________________________________________

So .... Assuming your grid is defined by lat[*], lon[*]
        Don't know how Grads numbers grid boxes

        A crude way which assumes lat [S->N]
        
        I am assiming you have drawn a map [plot], possibly
        with gridlines ..

  tres = True ; text mods desired
  tres@txFontHeightF = 0.015 ; make smaller than defailt
 ;tres@txJust = CenterCenter ; this is the default
        
   nBox = 0
   do nl=0,nlat-2
      LAT = (lat(nl)+lat(nl+1))*0.5
     do ml=0,mlon-2
        nBox = nBox+1
        LON = (lon(ml)+lon(ml+1))*0.5
        
        gsn_text(wks,plot,sprinti("%0.3i", i) ,LON,LAT,tres)
     end do
   end do
   
there are fancier/faster ways of doing the above but
this will do the job.

---
If your grid is cyclic, you may want to create 
   nLAT = nlat+1
   mLON = mlon+1
   latitude = new (nLAT, typeof(lat) )
   longitude=      mLON     
   
   latitude(0:nlat-1) = (/ lat /)
   longitude(0:mlon-1)= (/ lon /)
   latitude(nlat) = lat(nlat-1) + dlat
   longitude(mlon)= lon(mlon-1) + dlon
   
and use these in the above loop with max values
    nLAT-1
    mLON-1
good luck
D
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Jun 08 2006 - 09:16:53 MDT

This archive was generated by hypermail 2.2.0 : Thu Jun 08 2006 - 13:13:21 MDT