Specify a time for a variable

From: Ping Yang <pyang_at_nyahnyahspammersnyahnyah>
Date: Thu Oct 11 2012 - 08:10:17 MDT

Hi NCL,

I have a similar question about how to specify a time for plotting,
I used

Here is the script content:

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

;Open the merged monthly file for plotting
   fili = "NEUS_Precipitation_HadGEM2-ESv3_30min_monthly1970-1999.nc"
   f = addfile(fili,"r")
; x = short2flt(f->precipitation)
   x = f->precipitation
   print("PRICP: min="+min(x)+" max="+max(x))
printVarSummary(x)

; you can plot right now
;***************************************************
; Specify user desired yyyymm to be plotted
;***************************************************
  YYYYMM = (/190001,190007,198001,198007,199001,199007/)
;***************************************
; Replace the input time coordinate with the yyyymm
;***************************************
; x&time = f->yyyymm
;***************************************
  pwks = gsn_open_wks("ps","cru") ; open ps file
  xwks = gsn_open_wks("x11","cru") ; open x11 file

  gsn_define_colormap(pwks,"BlAqGrYeOrReVi200")
  gsn_define_colormap(xwks,"BlAqGrYeOrReVi200")

  plot_p = new (dimsizes(YYYYMM), graphic) ; create graphical array
  plot_x = new (dimsizes(YYYYMM), graphic) ; create graphical array

  res = True ; plot mods desired
  res@gsnDraw = False ; don't draw yet
  res@gsnFrame = False ; don't advance frame yet

  res@cnFillOn = True ; color contours
  res@cnLinesOn = False ; turn off contour lines
  res@cnFillMode = "RasterFill" ; Raster Mode
  res@cnInfoLabelOn = False
  res@cnLineLabelsOn = False

  res@cnLevelSelectionMode = "ManualLevels" ; set manual contour levels
  res@cnMinLevelValF = 0 ; set min contour level
  res@cnMaxLevelValF = 300 ; set max contour level
  res@cnLevelSpacingF = 10

;---This resource not needed in NCL V6.1.0
  res@gsnSpreadColors = True ; use full range of color map

  res@lbLabelBarOn = False ; turn off individual lb's

  res@gsnAddCyclic = False ; regional grid so not cyclic
  res@mpMinLatF = min(x&latitude)
  res@mpMaxLatF = max(x&latitude)
  res@mpMinLonF = min(x&longitude)
  res@mpMaxLonF = max(x&longitude)

; do nt = 0,dimsizes(YYYYMM)-1
  do nt = 0,5
    print("nt = " + nt)
     res@gsnLeftString = "Monthly Total Precipitation"

     res@gsnRightString = YYYYMM(nt)
     plot_x(nt) = gsn_csm_contour_map_ce(xwks,x(nt,:,:),res)
     plot_p(nt) = gsn_csm_contour_map_ce(pwks,x(nt,:,:),res)
  end do

;************************************************
; create panel plot
;************************************************

  resP = True ; modify the panel plot
  resP@txString = fili ; plot title
  resP@gsnMaximize = True ; make ps, eps, pdf, ...
large
   resP@lbLabelAutoStride = True
  resP@gsnPanelLabelBar = True ; add common label bar
  gsn_panel(xwks,plot_x(0:5),(/3,2/),resP) ; now draw as one
plot
  gsn_panel(pwks,plot_p(0:5),(/3,2/),resP) ; now draw as one
plot

end

The problem is whatever I change the time
In this example(I attached the script the data file in this email), I
changed it to a wrong time:
YYYYMM = (/190001,190007,198001,198007,199001,199007/)

I used PrintSummary of the variable here:
Variable: x
Type: float
Total Size: 1641600 bytes
            410400 values
Number of Dimensions: 3
Dimensions and sizes: [time | 360] x [latitude | 30] x [longitude | 38]
Coordinates:
            time: [ 30..10956]
            latitude: [35.25..49.75]
            longitude: [-83.75..-65.25]
Number Of Attributes: 5
  long_name : Global, HadGEM2-ESv3 Precipitation (30min, DailyTS, 1970) Vv3
  standard_name : Precipitation
  _FillValue : -9999
  var_desc : Precipitation
  actual_range : ( 0, 400 )

but the script still runs the same. Would you please help me on this?

Ping

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Oct 11 08:10:27 2012

This archive was generated by hypermail 2.1.8 : Fri Oct 12 2012 - 15:38:19 MDT