Re: a problem with streamline

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Tue Dec 29 2009 - 10:11:09 MST

There are no streamline routines explicitly for WRF data.

However, I think you almost have it with your script below and the
use of gsn_csm_streamline_contour_map.

Try attaching "lat" and "lon" to your data arrays using the special
"lat2d" and "lon2d" attributes:

u_plane@lat2d = lat
u_plane@lon2d = lon
v_plane@lat2d = lat
v_plane@lon2d = lon
spd@lat2d = lat
spd@lon2d = lon

You may also need to set:

res@gsnAddCyclic = False

--Mary

On Dec 23, 2009, at 10:44 PM, orangeboy wrote:

> Hi,everyone,
>
> I want to display the streamlines(or vector)+windspeed for
> wrfout, which looks like fig.1 but streamlines instead for barb.
> But it's only barb+windspeed when I use "wrf_vector". So I prepare
> the nclsrcipt as follow:
>
> load "$NCARG_ROOT/lib/ncarg/nclex/gsun/gsn_code.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl" ; Add
> special wrf functions
> load "$NCARG_ROOT/lib/ncarg/nclex/gsun/gsn_csm.ncl"
>
> a = addfile("/data2/zhai/shf_wrf/case/090724/ctl/
> wrfout_d01_2009-07-23_00:00:00.nc","r")
> type = "ps"
>
> wks = gsn_open_wks(type,"wind-stream")
>
> times = wrf_user_list_times(a) ; get times in the file
> ntimes = dimsizes(times) ; number of times in the file
>
> pressure_levels = (/ 850., 700., 500., 200./) ; pressure levels
> to plot
> nlevels = dimsizes(pressure_levels) ; number of
> pressure levels
>
> do it = 0,ntimes-1,48 ; TIME LOOP
> print("Working on time: " + times(it) )
>
> u = wrf_user_getvar(a,"ua",it) ; u averaged to mass points
> v = wrf_user_getvar(a,"va",it) ; v averaged to mass points
> p = wrf_user_getvar(a, "pressure",it) ; pressure is our
> vertical coordinate
> lat = wrf_user_getvar(a,"lat",it)
> lon = wrf_user_getvar(a,"lon",it)
>
> do level = 0,nlevels-1 ; LOOP OVER LEVELS
> pressure = pressure_levels(level)
> u_plane = wrf_user_intrp3d( u,p,"h",pressure,0.,False)
> v_plane = wrf_user_intrp3d( v,p,"h",pressure,0.,False)
> spd = (u_plane*u_plane + v_plane*v_plane)^(0.5) ; m/sec
> spd@description = "Wind Speed"
> spd@units = "m/s"
> u_plane@units = "m/s"
> v_plane@units = "m/s"
>
> ; Set some Basic Plot options
> res = True
> res@tiMainString = "Wind-Stream"
> res@mpGeophysicalLineColor = "Black" ; Overwrite map
> settings
> res@mpLimitMode = "LatLon"
> res@mpMinLonF = min(lon)
> res@mpMaxLonF = max(lon)
> res@mpMinLatF = min(lat)
> res@mpMaxLatF = max(lat)
> res@mpLimbLineColor = "Black"
> res@mpNationalLineColor = "Black"
> res@mpPerimLineColor = "Black"
> res@mpUSStateLineColor = "Black"
> res@mpDataBaseVersion = "MediumRes"
> res@mpDataSetName = "Earth..4"
> res@mpOutlineSpecifiers = (/"China:states"/)
> res@mpGeophysicalLineThicknessF = 1.0
> res@mpGridLineThicknessF = 1.0
> res@mpLimbLineThicknessF = 1.0
> res@mpNationalLineThicknessF = 1.0
> res@mpUSStateLineThicknessF = 1.0
>
> ; MAKE PLOTS
> if ( pressure .eq. 850 ) then ; plot windspeed,vector
> plot = gsn_csm_streamline_contour_map
> (wks,u_plane,v_plane,spd,res)
> end if
>
> end do ; END OF LEVEL LOOP
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> end do ; END OF TIME LOOP
> end
>
> However,I can't obtain what I want. The result is Fig.2. The
> problem is: 1), map; 2) attribution of windspeed
> It's also somt warning :
> (0) check_for_y_lat_coord: Warning: Data either does not
> contain a valid latitude coordinate array or doesn't contain one at
> all.
> (0) A valid latitude coordinate array should have a 'units'
> attribute equal to one of the following values:
> (0) 'degrees_north' 'degrees-north' 'degree_north' 'degrees
> north' 'degrees_N' 'Degrees_north' 'degree_N' 'degreeN' 'degreesN'
> 'deg north'
> (0) check_for_lon_coord: Warning: Data either does not contain
> a valid longitude coordinate array or doesn't contain one at all.
>
>
> Thanks a lot
> 2009-12-24
> Hangfeng Shen
>
>
>
> <fig1.JPG><fig.2.JPG>
> _______________________________________________
> 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
Received on Tue Dec 29 10:11:30 2009

This archive was generated by hypermail 2.1.8 : Tue Dec 29 2009 - 10:29:16 MST