Re: Error while plotting NCEP data

From: A.R Ragi <ar.ragi_at_nyahnyahspammersnyahnyah>
Date: Tue Mar 09 2010 - 01:32:12 MST

Dear NCL users..,

With inclusion of short2flt i got the plot,which am attaching with it.
But it is not showing the label bar,even i set the resource.

res@lbOrientation = "vertical" ; vertical label bar

I would like to see the label bar. What changes want to do in the below
code?

; NCL Code for Wind pattern using ECHAM output
;***********************************************
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"
;************************************************
begin
;************************************************
; Read in ECHAM output file
;************************************************
 u = addfile("/newhdd/guest/NCL_codes/CMAP/WIND/uwnd.mon.mean.nc","r")
 v = addfile("/newhdd/guest/NCL_codes/CMAP/WIND/vwnd.mon.mean.nc","r")

;************************************************
; read in zonal [u] and meridional [v] winds
;************************************************
  U = u->uwnd(:,:,:,:)
  V = v->vwnd(:,:,:,:)

  printVarSummary(U)
  printVarSummary(V)

  t = u->time(:)
  printVarSummary(t)
  time = ut_calendar(t, -3)

  lev = u->level(:)
  printVarSummary(lev)

  asciiwrite("time.txt",t)
  asciiwrite("level.txt",lev)
  asciiwrite("decodedtime.txt",time)

  uwind = short2flt(U(:,2,:,:))
  vwind = short2flt(V(:,2,:,:))

  printVarSummary(uwind)
  printVarSummary(vwind)
  printVarSummary(time)

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

wks = gsn_open_wks("ps","windpattern_cmap_850hpa") ; open ps file

 gsn_define_colormap(wks,"BlAqGrYeOrReVi200") ; choose color map
  i = NhlNewColor(wks,0.8,0.8,0.8) ; add gray to colors

  res = True ; plot mods desired
  res@gsnSpreadColors = True ; use full colormap
  res@gsnSpreadColorEnd = -2 ; don't use added gray

* res@lbOrientation = "vertical" ; vertical label bar
  res@pmLabelBarDisplayMode = "Always" ; Turn on a label bar.
  res@pmLabelBarWidthF = 0.1
*
  res@tiMainString = "Windpattern"

  res@vcRefMagnitudeF = 30.0 ; make vectors larger
  res@vcRefLengthF = 0.024 ; ref vec length
  res@vcMinDistanceF = 0.017 ; thin out windbarbs
  res@vcGlyphStyle = "WindBarb" ; choose wind barbs
  res@vcMonoWindBarbColor = False ; color barbs by scalar
  res@vcWindBarbTickLengthF = 0.3 ; length of the barb tick
  res@vcWindBarbTickSpacingF = 0.3 ; distance between ticks

; zoom in on map

  minlat = -20
  maxlat = 40
  minlon = 40
  maxlon = 120

  res@mpMinLatF = minlat
  res@mpMaxLatF = maxlat
  res@mpMinLonF = minlon
  res@mpMaxLonF = maxlon

;******************************************************
; Plot wind barb
;******************************************************

 plot=gsn_csm_vector_map_ce(wks,uwind(653,:,:),vwind(653,:,:),res)

end

-- 
*********************************************************************
Thanks,
A.R.Ragi
M.Tech Atmospheric science
Department of Atmospheric science
Cochin University of Science and Technology
Email : ar.ragi@gmail.com
************************************************************************
"I want to know how God created this world.I am not interested in this or
that phenomenon. I want to know, his thought, the rest are details"   .
                         ---Albert Einstein
************************************************************************
On Tue, Mar 9, 2010 at 10:30, A.R Ragi <ar.ragi@gmail.com> wrote:
> Dear Adam..,
> Thanks for the information. The NCEP uwnd/vwnd data am having is also of
> type short.
> I used short2flt But now am getting a small error that am not able to
> solve.
>
>
> The error am getting is:
> *
> fatal:NclMalloc Failed:[errno=12]
> fatal:New: could not create new array:[errno=12]
> fatal:Execute: Error occurred at or near line 1421 in file
> $NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl
>
> fatal:Execute: Error occurred at or near line 33 in file NCL_wind.ncl*
>
> Can you please help me to solve this?
>
>
>
> --
> *********************************************************************
> Thanks,
>
> A.R.Ragi
> M.Tech Atmospheric science
> Department of Atmospheric science
> Cochin University of Science and Technology
> Email : ar.ragi@gmail.com
>
> ************************************************************************
> "I want to know how God created this world.I am not interested in this or
> that phenomenon. I want to know, his thought, the rest are details"   .
>                          ---Albert Einstein
>
> ************************************************************************
>
>
>
> On Mon, Mar 8, 2010 at 22:02, Adam Phillips <asphilli@ucar.edu> wrote:
>
>> Hi A.R.,
>> Also, you might want to check to make sure that your data is of type
>> float, and not of type short. In my NCEP Reanalysis holdings, uwnd/vwnd
>> data is of type short. (Add a printVarSummary(U) line in after you read
>> in the variable to check.) If the data is of type short, use short2flt
>> to convert it to floats:
>> http://www.ncl.ucar.edu/Document/Functions/Contributed/short2flt.shtml
>> Adam
>>
>> On 03/08/2010 09:07 AM, Mary Haley wrote:
>> > A.R.
>> >
>> > With an error like this, it helps to debug it by turning off some of
>> > your resources. Perhaps
>> > you have them set to values that are not in the range of your data.
>> >
>> > I would start by commenting out these three lines, and see what you get
>> > by default, and
>> > also see if you still get the error message:
>> >
>> >> res@vcRefMagnitudeF = 5.0 ; make vectors larger
>> >> res@vcRefLengthF = 0.005 ; ref vec length
>> >> res@vcMinDistanceF = 0.017 ; thin out windbarbs
>> >
>> > If you don't get an error message, then look at the plot to see
>> > what the default reference vector is, and use this information
>> > to help determine if the one you picked was too large.
>> >
>> > --Mary
>> >
>> >
>> > On Mar 8, 2010, at 1:12 AM, A.R Ragi wrote:
>> >
>> >> Dear NCl users..,
>> >> I'm getting error while coding wind vectors using NCEP data.
>> >> I'm attaching the code.
>> >>
>> >>
>> >>
>> >> begin
>> >>
>> >> u = addfile("/CMAP/WIND/uwnd.mon.mean.nc <http://uwnd.mon.mean.nc
>> >","r")
>> >> v = addfile("/CMAP/WIND/vwnd.mon.mean.nc <http://vwnd.mon.mean.nc
>> >","r")
>> >>
>> >> U = u->uwnd(:,:,:,:)
>> >> V = v->vwnd(:,:,:,:)
>> >>
>> >> wks = gsn_open_wks("ps","windpattern_cmap") ; open ps file
>> >>
>> >> gsn_define_colormap(wks,"BlAqGrYeOrReVi200") ; choose color map
>> >> i = NhlNewColor(wks,0.8,0.8,0.8) ; add gray to colors
>> >>
>> >> res = True ; plot mods desired
>> >> res@gsnSpreadColors = True ; use full colormap
>> >> res@gsnSpreadColorEnd = -2 ; don't use added gray
>> >> res@lbOrientation = "vertical" ; vertical label bar
>> >>
>> >> res@tiMainString = "Windpattern"
>> >>
>> >>
>> >> res@vcRefMagnitudeF = 5.0 ; make vectors larger
>> >> res@vcRefLengthF = 0.005 ; ref vec length
>> >> res@vcMinDistanceF = 0.017 ; thin out windbarbs
>> >> res@vcGlyphStyle = "WindBarb" ; choose wind barbs
>> >> res@vcMonoWindBarbColor = False ; color barbs by scalar
>> >> res@vcWindBarbTickLengthF = 0.3 ; length of the barb tick
>> >> res@vcWindBarbTickSpacingF = 0.3 ; distance between ticks
>> >>
>> >>
>> >> ; zoom in on map
>> >>
>> >> minlat = -20
>> >> maxlat = 40
>> >> minlon = 40
>> >> maxlon = 120
>> >>
>> >> res@mpMinLatF = minlat
>> >> res@mpMaxLatF = maxlat
>> >> res@mpMinLonF = minlon
>> >> res@mpMaxLonF = maxlon
>> >>
>> >> ;******************************************************
>> >> ; Plot wind barb
>> >> ;******************************************************
>> >>
>> >> plot=gsn_csm_vector_map_ce(wks,U(653,3,:,:),V(653,3,:,:),res)
>> >>
>> >> end
>> >>
>> >>
>> >> I want to plot winds at 2002 june....so converted time using
>> >> *ut_calenda*r function and i got it is :653 and level is 850 hpa -->3
>> >> thus U(653,3,:,:) and V(653,3,:,:). I hope the calculation is correct.
>> >>
>> >> The error am getting is:
>> >>
>> >>
>> >> fatal:VectorPlotDraw: VVECTR - VECTOR NDC LENGTH TOO GREAT
>> >> fatal:VectorPlotDraw: error drawing vectors
>> >> fatal:VectorPlotDraw: draw error
>> >> fatal:PlotManagerDraw: error in plot draw
>> >> fatal:_NhlPlotManagerDraw: Draw error
>> >>
>> >>
>> >>
>> >> Thanks in advance
>> >>
>> >>
>> >> --
>> >> *********************************************************************
>> >> A.R.Ragi
>> >> M.Tech Atmospheric science
>> >> Department of Atmospheric science
>> >> Cochin University of Science and Technology
>> >> Email : ar.ragi@gmail.com <mailto:ar.ragi@gmail.com>
>> >>
>> >>
>> ************************************************************************
>> >> "I want to know how God created this world.I am not interested in this
>> >> or that phenomenon. I want to know, his thought, the rest are details"
>> >> . ---Albert Einstein
>> >>
>> >>
>> ************************************************************************
>> >>
>> >> _______________________________________________
>> >> ncl-talk mailing list
>> >> List instructions, subscriber options, unsubscribe:
>> >> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>> >
>> >
>> >
>> > _______________________________________________
>> > ncl-talk mailing list
>> > List instructions, subscriber options, unsubscribe:
>> > http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>> --
>> __________________________________________________
>> Adam Phillips
>> asphilli@ucar.edu
>> National Center for Atmospheric Research   tel: (303) 497-1726
>> Climate and Global Dynamics Division         fax: (303) 497-1333
>> P.O. Box 3000
>> Boulder, CO 80307-3000    http://www.cgd.ucar.edu/cas/asphilli
>> _______________________________________________
>> ncl-talk mailing list
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>
>


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

windpattern_cmap_850hpa.jpg
Received on Tue Mar 9 01:32:39 2010

This archive was generated by hypermail 2.1.8 : Thu Mar 11 2010 - 11:17:07 MST