>
> Hi Sylvia,
>
> thanks for your hint. I got your example working (after setting
> gsn_csm_map_ce(wks, res) ).
>
> Trying to get it working with gsn_csm_contour_map failed. It seems to
> conflict with 'pmTickMarkDisplayMode'. Setting it to 'noCreate' or
> 'Never' will not plot any ticks, setting it to 'Conditional' or 'Always'
> gives the warning:
>
> warning:MapPlotSetValues: tm[XB|XT|YL|YR]Mode resources are not
> currently enabled for MapPlot tick marks
> warning:tmYLValues is not a valid resource in map at this time
> warning:tmYLLabels is not a valid resource in map at this time
> warning:tmXBValues is not a valid resource in map at this time
> warning:tmXBLabels is not a valid resource in map at this time
>
> Best regards,
>
> Heiko
Heiko,
If you want tick marks and labels at your actual grid cell locations,
then you might be better off just drawing a regular contour plot
without using any lat/lon coordinate information, and then overlaying
this on a map plot (using the "overlay" procedure). This way, you
don't need to try to tweak gsn_csm_contour_map_map to *not* do map
labels, which it is explicitly set up to do.
To draw a "regular" contour plot without any lat/lon information, just
use "gsn_contour" instead of "gsn_csm_contour", and then use
"gsn_csm_map" to generate your map. Since you have a native grid, you
need to make sure your map is set up such that when you overlay the
contour plot over it, the contour plot will be overlaid over the
proper area of the map. You also need to be sure to set
"tfDoNDCOverlay" to True, so the contour data is not transformed again
into your map space.
Below is an example taken from the first example of Sylvia's "native
grid" examples at:
http://www.cgd.ucar.edu/csm/support/CSM_Graphics/native.shtml
With these mods, you end up with contours over a map that is labeled
by grid tickmark locations, rather than lat/lon values.
--Mary
----------------------------------------------------------------------
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
begin
;*******************************************
; open file and read in data
;*******************************************
f = addfile ("/cgd/cas/murphys/Data/RCM2_Yale/pre.8912.mon.nc", "r")
P = f->pre
LAT2D= f->lat
LON2D= f->lon
;********************************************
;reorder arrays
;********************************************
p = P(time|:,ycoord|:,xcoord|:)
lon2d=LON2D(ycoord|:,xcoord|:)
lat2d=LAT2D(ycoord|:,xcoord|:)
;********************************************
; get some parameters
;********************************************
nlat = dimsizes(lat2d&ycoord)
nlon = dimsizes(lon2d&xcoord)
;********************************************
; create plot
;********************************************
wks = gsn_open_wks ("ncgm", "native") ; open workstation
mpres = True ; map resources
mpres@gsnDraw = False
mpres@gsnFrame = False
; !!!!! any plot of data that is on a native grid, must use the "corners"
; method of zooming in on map.
mpres@mpLimitMode = "Corners" ; choose range of map
mpres@mpLeftCornerLatF = lat2d(0,0)
mpres@mpLeftCornerLonF = lon2d(0,0)
mpres@mpRightCornerLatF = lat2d(nlat-1,nlon-1)
mpres@mpRightCornerLonF = lon2d(nlat-1,nlon-1)
; The following 4 pieces of information are REQUIRED to properly display
; data on a native lambert conformal grid. This data should be specified
; somewhere in the model itself.
mpres@mpProjection = "LambertConformal"
mpres@mpLambertParallel1F = 30.
mpres@mpLambertParallel2F = 55.
mpres@mpLambertMeridianF = 45.
map = gsn_csm_map(wks,mpres)
cnres = True ; contour resources
cnres@gsnDraw = False ; don't draw plot
cnres@gsnFrame = False ; don't advance frame
cnres@cnFillOn = True ; color fill
; Usually, when data is placed onto a map, it is TRANSFORMED to the specified
; projection. Since this model is already on a native lambert conformal grid,
; we want to turn OFF the tranformation.
cnres@tfDoNDCOverlay = True
cnres@pmTickMarkDisplayMode = "Always" ; force tickmarks on
contour = gsn_contour(wks,p(0,:,:),cnres)
overlay(map,contour)
draw(map)
frame(wks)
end
>
> Sylvia Murphy wrote:
> > heiko,
> >
> > you can do this, but you need to do it explicitly.
> > ;================================================;
> > ; mptick_6.ncl
> > ;================================================;
> > load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> > load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
> > ; ================================================;
> > begin
> > wks = gsn_open_wks("ps","mptick") ; open a ps file
> >
> > res = True
> > res@tmXBMode = "Explicit"
> > res@tmXBValues = (/-180, -90, 0, 90, 180/)
> > res@tmXBLabels = (/"180","90W","EQ","90E","180"/)
> > plot = gsn_csm_map_ce(wks,False) ; draw global map
> > end
> >
> >
> >
> > in this case we tried changing the 0 label to "EQ", but in your case
> > you can put in grid cell numbers. It requires that you
> > know the lat/lon "Value" of each of the grid cell numbers that
> > you want.
> >
> > sm
> >
> >
> >
> > ******************************************************
> > Sylvia Murphy EML: murphys@ucar.edu
> > NCAR CGD/CAS PHN: 303-497-1720
> > 3080 Center Green Drive FAX: 303-497-1333
> > Boulder CO 80301
> >
> >
> > WEB: http://www.cgd.ucar.edu/csm/support/
> > http://www.cgd.ucar.edu/csm/support/CSM_Graphics/
> > ******************************************************
> >
> >
> >
>
>
> --
> Dr. Heiko Klein Tel. + 47 22 96 33 44
> Air pollution Section/Research Department Fax. + 47 22 69 63 55
> Norwegian Meteorological Institute http://www.met.no
> P.O. Box 43 Blindern 0313 Oslo NORWAY http://www.emep.int
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk@ucar.edu
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
-- ------------------------------------------------- Mary Haley haley@ucar.edu NCAR/SCD/VETS 303-497-1254 (voice) 1850 Table Mesa Dr 303-497-1804 (fax) Boulder, CO 80305 ------------------------------------------------- _______________________________________________ ncl-talk mailing list ncl-talk@ucar.edu http://mailman.ucar.edu/mailman/listinfo/ncl-talk
This archive was generated by hypermail 2b29 : Mon May 12 2003 - 08:39:29 MDT