[ncl-talk] Fwd: Sub : Objective analysis

Adv advita6 at gmail.com
Sat Jan 23 16:24:44 MST 2016


Hi Ncl users,

This is the code i use to produce attached plots . I didn't get any error.
But there is a skewed parts here and there in the plots. I don't understand
where is the problem. I think problem is choosing the rscan array. Could
someone help me to pick right one? Figure shows unsmoothened values.

I would appreciate any help and suggestions.
Thank you,
Adv

;****************************************************
;****************************************************
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
;***************************************************

;***************************************************
begin
;***************************************************
strll  = asciiread("stationmac.txt", -1, "string") ;
  print(strll)   ; STATION","STATION_NAME", "LAT", "LON"
  print("=====")

sloc = str_get_field(strll , 2, ",")
  lat  = tofloat( str_get_field(strll , 3, ",")  )
  lon  = tofloat( str_get_field(strll , 4, ",")  )
  print(sloc +" : "+lat+" "+lon)
mnlat=(min(lat))
mxlat=(max(lat))
mnlon=(min(lon))
mxlon=(max(lon))
;print(lon)
print(mnlon)
print(mxlon)
print(mnlat)
print(mxlat)
mlon = 390
dlon = -90.35 / mlon
lonn  = fspan (-116, (mlon - 1) * dlon, mlon)
print(lonn)
mlat = 390
dlon = -90.35 / mlon
lonn  = fspan (-116, (mlon - 1) * dlon, mlon)
print(lonn)
mlat = 390
dlat = 49.0 / mlat
latt  = fspan (40.01, (mlat - 1) * dlat, mlat)
print(latt)
diri="/home/dailysimms/prec-obs/"
z1 = asciiread(diri+"t_avg_Jan-Dec1965-2005",-1,"float")
print(z1)
printVarSummary(z1)
;a = (/1,2,3,4,5,6,7,8/)
;Dimensions and sizes:  [192372]
;390 rows by 50 columns
a0 = onedtond(z1,(/390,492/))
printVarSummary(a0)
v = ispan (0,390,1)
print(v)
;tenth of mm
x=(regCoef(v,z1))*492
print(x)
set_default_fillvalue("string",  "")
  opt    = True
  rscan  = (/5,3,1 /)
grid   = obj_anal_ic_deprecated(lon, lat, z1, lonn, latt, rscan, True)
printVarSummary(grid)
;return
;print(grid)
print(min(grid))
print(max(grid))
;return
grid&lat at units="degrees_north"
grid&lon at units="degrees_east"
printVarSummary(grid)
;return
;**************************************************
; plot parameters
;**************************************************

  wks = gsn_open_wks("x11","Climatemn_Temp_1965-2005")                  ;
Open ps file
 gsn_define_colormap(wks,"testcmap")
  plot = new(1,graphic)

 res                       = True
res at gsnDraw             = False           ; don't draw
res at gsnFrame            = False           ; don't advance frame
res at cnInfoLabelOn       = False           ; turn off cn info label
 res at cnLinesOn       = False                   ; turn off contour lines
   res at cnFillOn        = True               ; color plot desired
   res at cnLineLabelsOn  = False
 res at lbLabelBarOn        = False           ; turn off individual cb's
;res at txFontHeightF = 0.015                   ; adjust font height of
gsnLeftString/gsnRightString titles
;res at cnLevelSelectionMode = "ExplicitLevels"                     ; set
explicit contour levels
;res at cnLevels    = (/-2,-1,0,1,2,3,4/)
 res at vpWidthF              = 0.90                ; change aspect ratio of
plot
  res at vpHeightF             = 0.90
  res at vpXF                  = 0.05
  res at vpYF                  = 0.95

; map resources for projection
res at mpGridAndLimbOn       = False
res at gsnTickMarksOn = False
;***************************************************
res at mpLimitMode           = "LatLon"
  res at mpMinLatF             =   40.
  res at mpMaxLatF             =   49.
  res at mpMinLonF             = -116
  res at mpMaxLonF             =  -90.1

   res at mpPerimOn              = True                    ; draw box around
map
res at mpGeophysicalLineThicknessF = 3.0
res at mpGeophysicalLineColor = "Black"; (/22/)
;res at mpNationalLineThicknessF  = 3.0
res at mpOutlineBoundarySets = "GeophysicalAndUSStates" ; add state boundaries
res at mpNationalLineColor  = res at mpGeophysicalLineColor
res at mpUSStateLineThicknessF = 3.0
res at mpUSStateLineColor  = res at mpGeophysicalLineColor

res at gsnAddCyclic            = False

res at gsnCenterStringFontHeightF     = 0.02
res at gsnCenterString     = "Obs"
plot(0) = gsn_csm_contour_map_ce(wks,grid,res)
;************************************************
; create panel
;************************************************
  resP                  = True                   ; modify the panel plot
  resP at gsnFrame         = False                  ; don't advance the frame,
so we can use gsn_text_ndc
  resP at gsnPanelLabelBar = True                   ; add common colorbar
  resP at lbLabelFontHeightF = 0.015                ; set font height of Label
Bar labels
resP at gsnPanelBottom   = 0.2                    ; shrink panel plot by
setting bottom edge of plot
  resP at gsnPanelTop      = 0.9                    ; shrink panel plot by
setting top edge of plot
 resP at pmLabelBarWidthF  = 0.3                 ; make thinner
  resP at pmLabelBarHeightF = 0.05
  resP at gsnPanelYWhiteSpacePercent = 5.           ; increase spacing along
Y-axis between panel plots
 resP at cnLinesOn       = False                   ; turn off contour lines
;   resP at cnFillOn        = True               ; color plot desired
;  resP at lbTitleOn        = True                  ; turn on title
  resP at lbTitleString    = "degC"
  resP at lbTitleFontHeightF= .012                 ; make title smaller
   resP at cnLineLabelsOn  = False
  resP at txString    = "Climatemn_Temp_1965-2005"
resP at txFontHeightF   = 0.019
  gsn_panel(wks,plot,(/1,1/),resP)               ; now draw as one plot


;  txres               = True
;  txres at txFontHeightF = 0.015
;  gsn_text_ndc(wks,"Figure 16: A smaller panel plot",0.5,0.16,txres)
  frame(wks)

end
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160123/02f2602d/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Climatemn_Temp_1965-2005.pdf
Type: application/pdf
Size: 83229 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160123/02f2602d/attachment.pdf 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Climatemn_Prec_1965-2005.pdf
Type: application/pdf
Size: 78513 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160123/02f2602d/attachment-0001.pdf 


More information about the ncl-talk mailing list