switch map from 0-360 to -180 to 180

From: ousmane ndiaye <ondiaye70_at_nyahnyahspammersnyahnyah>
Date: Sun Sep 23 2012 - 07:17:19 MDT

Hi,
I have a problem, I'm correlating an index with a field and when I plot the
correlation map either there is a band (as in map1 attached) or if I try
using (r1&X = r1&X-180 ) it doesn't work.
Any help my script is below
ousmane

==
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"

; READING DATA
ff=addfile("Z500200_OND7911.cdf","r")
Zond=ff->phi
ff=addfile("Z500200_JanFeb7911.cdf","r")
Zjnfb=ff->phi

; reading index
ind1=asciiread("file1.dat",(/33,7/),"float")

; global correlation between indices and 2 fields
r1=new((/6,2,73,144/),float)
do i=1,3
     r1(i-1,:,:,:)=escorc(ind1(:,i),Zond(P|:,Y|:,X|:,T|:))
end do
do i=4,6
     r1(i-1,:,:,:)=escorc(ind1(:,i),Zjnfb(P|:,Y|:,X|:,T|:))
end do

; create a dummy variable same dimension as r1 in order to use
copy_VarCoords
; is there a better way to copy the coordinate ?
tt=Zond(1:6,:,:,:)
copy_VarCoords(tt,r1)
delete(tt)
;r1&X = r1&X-180 ; make long goes from -180 to 180 but doesn't work

plot = new(6,graphic)
begin
  wks = gsn_open_wks("pdf","map1")
  res = True
  gsn_define_colormap(wks,"precip_diff_12lev")
  gsn_reverse_colormap(wks)
  res@gsnDraw = False ; do not draw frame since we will be adding a
polyline and paneling
  res@gsnFrame = False ; do not advance frame
  res@gsnMaximize = True ; maximize the plot space on page - this
will apply to each individual plot
  res@cnFillOn = True ; turn on color fill
   res@lbLabelBarOn = False ; turn off label bars for the individual plots
     res@lbOrientation = "vertical"
     res@tiXAxisOn = False
     res@tiYAxisOn = False
     res@tiMainOn = False
res@mpMinLatF = 0
res@mpMaxLatF = 70
res@mpMinLonF = -80
res@mpMaxLonF = 70

  res@cnLevelSelectionMode = "ManualLevels" ; Manually set the cn Levels
  res@cnMinLevelValF = -0.8
  res@cnMaxLevelValF = 0.8
  res@cnLevelSpacingF = .1
  res@gsnAddCyclic = False ; regional plot

  do i=0,5
  plot(i) = gsn_csm_contour_map_ce(wks,r1(i,0,:,:), res) ; create plot
  end do

  pres = True
  pres@gsnMaximize = True
  pres@gsnPanelXWhiteSpacePercent = 5 ; set a bit of extra white space
between panels in the x and y directions
  pres@gsnPanelYWhiteSpacePercent = 8
  pres@gsnPanelLabelBar = True ; common labelbar for the entire panel
plot

  pres@lbTitlePosition = "Bottom" ; put it below the plot
  gsn_panel(wks,plot,(/3,2/),pres)
 end
delete(plot)
delete(wks)
===

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk

Received on Sun Sep 23 07:17:40 2012

This archive was generated by hypermail 2.1.8 : Wed Sep 26 2012 - 13:56:04 MDT