Good day,
I am having problems getting a meridional average of the v-wind to
plot correctly. The zonal average of the same region plots without no
problems.
The error seems to be related to the plotting of the longitude axis
(the x-axis in this case). See my script and error messages below.
The plot image is attached.
Thanks in advance for your help.
Cheers,
Arlene Laing
NCAR/MMM, x 8147
---------start NCL routine-------------
;*************************************************
; plot meridional average for a small box in the domain
; with pressure as vertical axis
;
;************************************************
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"
load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
;************************************************
begin
;************************************************
; variable and file handling
;************************************************
a =
addfile("/datatmp2/laing/wrfout_d01_2006-08-18_06:00:00.cdf","r")
;************************************************
; What kind of plot?
; type = "x11"
; type = "pdf"
type = "ps"
; type = "ncgm"
outfilename_prefix = "merid_avg_v_081806"
wks = gsn_open_wks(type, outfilename_prefix)
res = True ; plot mods
desired
; mpres = True
; mpres_at_mpGridAndLimbOn = False
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
FirstTime = True
times = wrf_user_list_times(a) ; get times in the file
ntimes = dimsizes(times) ; number of times in the file
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
it = 0
res_at_TimeLabel = times(it) ; Set Valid time to use on plots
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; First get the variables we will need
; th = wrf_user_getvar(a,"th",it) ; theta (K)
; rh = wrf_user_getvar(a,"rh",it) ; relative humidity
z = wrf_user_getvar(a, "z",it) ; grid point height
p = wrf_user_getvar(a, "pressure",it) ; grid point full pressure
(hPa)
; tk = wrf_user_getvar(a,"tk", it)
; qv = wrf_user_getvar(a,"QVAPOR", it) ; mixing ratio (kg/kg)
; pvo = wrf_user_getvar(a,"pvo",it) ; potential vorticity
; 1 PV Unit = 10^6 K m^2 kg^-1 s^-1
p2 = p*100.
w = wrf_user_getvar(a,"wa",it) ; vertical velocity (m s
-1)
uvm = wrf_user_getvar(a,"uvmet",it) ; umet and vmet averaged
to mass points
; This is a 4D array where
; uvm(0,:,:,:) is umet,
and
; uvm(1,:,:,:) is vmet,
and
; This function rotate
winds to earth coord
; extract u and v from uvm array
u = uvm(0,:,:,:)
v = uvm(1,:,:,:)
u_at_description = "U Wind Velocity"
v_at_description = "V Wind Velocity"
;***********************************************
; create subset of zone within 3 degs of 12.N, 32E
lats = (/ 9.0, 15.0 /)
lons = (/ 29.0, 35.0 /)
loc_zoom = wrf_user_latlon_to_ij(a, lats, lons)
y_start = loc_zoom(0,0)
y_end = loc_zoom(1,0)
x_start = loc_zoom(0,1)
x_end = loc_zoom(1,1)
v_small = v(:,y_start:y_end,x_start:x_end)
p_small = p(:,y_start:y_end,x_start:x_end)
;printVarSummary(v_small)
; interpolate to pressure levels (on Y-axis)
pressure_levels = (/1000.,975.,950., 925., 875., 850., 800.,750.,\
700.,650.,600.,550.,500.,450.,400.,350.,300., 250.,200./) ;
pressure levels to plot
v_plane_h_small =
wrf_user_intrp3d(v_small,p_small,"h",pressure_levels,0.,True)
lat2d = a->XLAT(0,:,:) ; need for x axis latitude
labels
lon2d = a->XLONG(0,:,:) ; need for x axis longitude
labels
v_plane_h_small_at_lat2d = lat2d
v_plane_h_small_at_lon2d = lon2d
v_plane_h_small!0 = "plev"
; Create meridional averages for small sector
; use named dimension to reorder lat to last dimension
; you will get v_merid(plev|:,lon|:)
v_merid = dim_avg_Wrap (v_plane_h_small(plev|:, west_east|:,
south_north|:))
printVarSummary(v_merid)
wrf_smooth_2d(v_merid,3)
;***********************************************
; set plot resources
res_at_vpWidthF = .9 ; overwrite basic plot size
res_at_vpHeightF = 1.0
pltres = True
res_xy = res
res_xy_at_tiYAxisString = "Pressure (hPa)"
res_xy_at_AspectRatio = 0.75
res_xy_at_cnMissingValPerimOn = True
res_xy_at_cnMissingValFillColor = 0
res_xy_at_cnMissingValFillPattern = 11
res_xy_at_sfYCStartV = max(pressure_levels)
res_xy_at_sfYCEndV = min(pressure_levels)
res_xy_at_trYReverse = True ;
reverse Y axis
res_xy_at_trYLog = True ; Log
scale
res_xy_at_tmYLMode = "Explicit"
res_xy_at_tmYLValues = (/1000., 850., 700., 600., 500., 400.,
\
300., 250., 200./)
res_xy_at_tmYLLabels = (/"1000","850","700","600","500","400",
\
"300","250","200"/)
; res_xy_at_sfYArray = pressure_levels
res_xy_at_tiXAxisFontHeightF = 0.02
res_xy_at_tiYAxisFontHeightF = 0.02
res_xy_at_tmXBMajorLengthF = 0.02
res_xy_at_tmYLMajorLengthF = 0.02
res_xy_at_tmYLLabelFontHeightF = 0.015
res_xytxFontHeightF = 0.015
res_xy_at_tiXAxisString = "Longitude"
res_xy_at_sfXArray = lon2d(0,:)
; Plotting options for V
res_v = res_xy
; res_v_at_cnInfoLabelOrthogonalPosF = 0.00
res_v_at_cnInfoLabelOn = False ; turn off cn info
label
res_v_at_cnLineLabelPerimOn = False ; turn off label
perimeter
res_v_at_cnLabelMasking = True ; do not draw labels
over contour
res_v_at_cnLineLabelFontHeightF = 0.018
res_v_at_cnLineLabelBackgroundColor = "white"
res_v_at_cnLineThicknessF = 1.2
res_v_at_ContourParameters = (/ -20., 20., 2. /)
res_v_at_gsnContourNegLineDashPattern = 1
contour_v = wrf_contour(a,wks,v_merid,res_v)
; MAKE PLOTS
plot = wrf_overlays(a,wks,(/contour_v/),pltres)
end
-------------end NCL routine---------------------------
-------------------------------------------------------
-------------start run time messages-------------------
bay-mmm:/mmmtmp/laing>ncl merid_avg_test.ncl
Copyright (C) 1995-2009 - All Rights Reserved
University Corporation for Atmospheric Research
NCAR Command Language Version 5.1.0
The use of this software is governed by a License Agreement.
See http://www.ncl.ucar.edu/ for more details.
Variable: times
Type: string
Total Size: 4 bytes
1 values
Number of Dimensions: 1
Dimensions and sizes: [1]
Coordinates:
Number Of Attributes: 2
description : times in file
_FillValue : missing
(0) 2006-08-18_06:00:00
Variable: v_merid
Type: float
Total Size: 12768 bytes
3192 values
Number of Dimensions: 2
Dimensions and sizes: [plev | 19] x [west_east | 168]
Coordinates:
Number Of Attributes: 9
coordinates : XLONG XLAT
stagger :
FieldType : 104
units : m s-1
description : V Wind Velocity
_FillValue : -999999
lat2d : <ARRAY of 497585 elements>
lon2d : <ARRAY of 497585 elements>
average_op_ncl : dim_avg over dimension: south_north
warning:ScalarFieldSetValues: coordinate array sfXArray requires
146071259 elements: defaulting
fatal:LegendSetValues: Error getting label information
fatal:LegendSetValues: Error setting MultiText object values
fatal:PlotManagerSetValues: Error updating Legend object
warning:["SetValues.c":474]:SetValuesChild never occurred on
merid_avg_v_081806_contour.TickMark: Error in plotManagerClass
warning:["SetValues.c":474]:SetValuesChild never occurred on
merid_avg_v_081806_contour.LabelBar: Error in plotManagerClass
warning:tmXBMajorLengthF is not a valid resource in
merid_avg_v_081806_contour.PlotManager at this time
warning:tmYLMajorLengthF is not a valid resource in
merid_avg_v_081806_contour.PlotManager at this time
warning:tmYLLabelFontHeightF is not a valid resource in
merid_avg_v_081806_contour.PlotManager at this time
warning:lbLabelStrings is not a valid resource in
merid_avg_v_081806_contour.PlotManager at this time
warning:lbFillColors is not a valid resource in
merid_avg_v_081806_contour.PlotManager at this time
warning:lbBoxCount is not a valid resource in
merid_avg_v_081806_contour.PlotManager at this time
warning:lbFillPatterns is not a valid resource in
merid_avg_v_081806_contour.PlotManager at this time
warning:lbFillScales is not a valid resource in
merid_avg_v_081806_contour.PlotManager at this time
warning:tiYAxisString is not a valid resource in
merid_avg_v_081806_contour.PlotManager at this time
warning:tiXAxisString is not a valid resource in
merid_avg_v_081806_contour.PlotManager at this time
warning:tmYLMode is not a valid resource in
merid_avg_v_081806_contour.PlotManager at this time
warning:tmYLValues is not a valid resource in
merid_avg_v_081806_contour.PlotManager at this time
warning:tmYLLabels is not a valid resource in
merid_avg_v_081806_contour.PlotManager at this time
warning:tiMainString is not a valid resource in
merid_avg_v_081806_contour.PlotManager at this time
fatal:ContourPlotSetValues: error setting overlay object view
fatal:LegendSetValues: Error getting label information
fatal:LegendSetValues: Error setting MultiText object values
fatal:PlotManagerSetValues: Error updating Legend object
warning:["SetValues.c":474]:SetValuesChild never occurred on
merid_avg_v_081806_contour.TickMark: Error in plotManagerClass
warning:["SetValues.c":474]:SetValuesChild never occurred on
merid_avg_v_081806_contour.Title: Error in plotManagerClass
warning:["SetValues.c":474]:SetValuesChild never occurred on
merid_avg_v_081806_contour.LabelBar: Error in plotManagerClass
fatal:ContourPlotSetValues: error setting overlay object view
fatal:LegendSetValues: Error getting label information
fatal:LegendSetValues: Error setting MultiText object values
fatal:PlotManagerSetValues: Error updating Legend object
warning:["SetValues.c":474]:SetValuesChild never occurred on
merid_avg_v_081806_contour.TickMark: Error in plotManagerClass
warning:["SetValues.c":474]:SetValuesChild never occurred on
merid_avg_v_081806_contour.Title: Error in plotManagerClass
warning:["SetValues.c":474]:SetValuesChild never occurred on
merid_avg_v_081806_contour.LabelBar: Error in plotManagerClass
fatal:ContourPlotSetValues: error setting overlay object view
fatal:LegendSetValues: Error getting label information
fatal:LegendSetValues: Error setting MultiText object values
fatal:PlotManagerSetValues: Error updating Legend object
fatal:PlotManagerSetValues: error setting overlay plot member view
warning:["SetValues.c":474]:SetValuesChild never occurred on
merid_avg_v_081806_contour.TickMark: Error in plotManagerClass
warning:["SetValues.c":474]:SetValuesChild never occurred on
merid_avg_v_081806_contour.Title: Error in plotManagerClass
warning:["SetValues.c":474]:SetValuesChild never occurred on
merid_avg_v_081806_contour.LabelBar: Error in plotManagerClass
fatal:ContourPlotSetValues: error setting overlay object view
warning:PSWorkstationInitialize:Device X Coordinates invalid,
defaulting
warning:PSWorkstationInitialize:Device Y Coordinates invalid,
defaulting
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
This archive was generated by hypermail 2.2.0 : Tue Sep 29 2009 - 10:11:39 MDT