Mary,
Thank you for your very useful suggestion.
Now I am not getting any errors but warnings:
warning:vcRefAnnoOrthogonalPosF is not a valid resource in WRF_po_contour at this time
warning:vcMinDistanceF is not a valid resource in WRF_po_contour at this time
warning:vcRefLengthF is not a valid resource in WRF_po_contour at this time
warning:vcRefMagnitudeF is not a valid resource in WRF_po_contour at this time
I could overlay the vectors over the contour map but I am not sure if still there is some other error.
The vector plot which I print before the overlay does not resemble the overlayed vectors on the contour plots.
I am attaching the modified script for your possible review. If you advice, I can e-mail the postscript file of the plots.
Thank you again for your help.
Moti
Script:
1 ;*************************************************
2 ; WRF: color over map with lat/lon labels
3 ;************************************************
4 load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
5 load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
6 load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRF_contributed.ncl"
7 load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
8 begin
9 ;************************************************
10 ; open file and read in data
11 ;************************************************
12 f = addfile ("/home/mmittal/CHENNAI/CHEM/WRFOUT/MAY/wrfout_d01_2007-05-03_06:00:00.n c", "r")
13 ;************************************************
14 ; Read character variable Times; Convert to string for plots
15 ; Read vertical coordinate for plot labels
16 ;************************************************
17 times = chartostring(f->Times) ; built-in function
18 znu = f->ZNU(0,:) ; (Time, bottom_top)
19 lat2d = f->XLAT(0,:,:)
20 lon2d = f->XLONG(0,:,:)
21 U = f->U
22 V = f->V
23 ;************************************************
24 ; U and V are on different grids
25 ; determine the size of the "west_east_stag" dimension
26 ; determine the size of the "south_north_stag" dimension
27 ;************************************************
28 dimU = dimsizes(U) ; demo "dimsizes"
29 mlonU = dimU(3) ; number of "west_east_stag" longitudes
30
31 dimV = dimsizes(V)
32 nlatV = dimV(2) ; number of "south_north_stag" latitudes
33
34
35
36 ;************************************************
37 ; Read ozone at all times and levels
38 ;************************************************
39 x = f->o3 ; (Time, bottom_top, south_north, west_eas t)
40 x = x*1000
41 x_at_units = "ppbv"
42 x_at_description = "O3 concentration"
43
44 ;************************************************
45 ; create plots
46 ;************************************************
47 wks = gsn_open_wks("x11" ,"WRF_po") ; ps,pdf,x11,ncgm,eps
48 ;wks = gsn_open_wks("x11" ,"gsn_vec_scal") ; ps,pdf,x11,ncgm,eps
49 gsn_define_colormap(wks,"BlAqGrYeOrReVi200") ; select color map
50 ;************************************************
51
52 dimx = dimsizes(x) ; dimensions of x
53 ntim = dimx(0) ; number of time steps
54 klev = dimx(1) ; number of "bottom_top" levels
55
56 do nt=0,ntim-1 ; uncomment for loop
57 do kl=0,1
58 res = True ; plot mods desired
1,1 Top
60 res_at_gsnSpreadColors = True ; use full range of colormap
61 res_at_cnFillOn = True ; color plot desired
62 res_at_cnLinesOn = False ; turn off contour lines
63 res_at_cnLineLabelsOn = True ; turn off contour labels
64 res_at_lbLabelAutoStride = True ; Control labelbar spacing
65 res_at_cnLevelSelectionMode = "ManualLevels"
66 res_at_cnMinLevelValF = 25.
67 res_at_cnMaxLevelValF = 35.
68 res_at_cnLevelSpacingF = 2.
69
70 ;************************************************
71 ; Use WRF_contributed procedure to set map resources
72 ;************************************************
73 ; WRF_map_c (f, res, 0)
74 ;************************************************
75 ; set True for native projection (faster)
76 ;************************************************
77 res_at_tfDoNDCOverlay = True
78 ;************************************************
79 res_at_mpMinLatF = 12.5
80 res_at_mpMaxLatF = 13.5
81 res_at_mpMinLonF = 79.5
82 res_at_mpMaxLonF = 80.5
83 x_at_lat2d = lat2d
84 x_at_lon2d = lon2d
85
86
87 ;************************************************
88 ; Turn on lat / lon labeling
89 ;************************************************
90 res_at_pmTickMarkDisplayMode = "Always" ; turn on tickmarks
91
92 ;************************************************
93 ; Loop over all times and levels ( uncomment )
94 ; Demo: one arbitrarily closen time and level
95 ;************************************************
96 ;************************************************
97 ; associate the 2-dimensional coordinates to the variable for plotting
98 ; only if not a native projection [ res_at_tfDoNDCOverlay = False ]
99 ;************************************************
100 res_at_tiMainString = times(nt)
101 res_at_gsnLeftString = x_at_description+" z="+znu(kl)
102
103 plot2 = gsn_csm_contour_map(wks,x(nt,kl,:,:),res)
104 ; now change the size of the tickmark labels
105 res_at_tmXBLabelFontHeightF = 0.02 ; resize tick labels
106 res_at_tmYLLabelFontHeightF = 0.02
107 ;***********************************************
108 u = 0.5*(U(nt,kl,:,0:mlonU-2)+U(nt,kl,:,1:mlonU-1))
109 v = 0.5*(V(nt,kl,0:nlatV-2,:)+V(nt,kl,1:nlatV-1,:))
110 u_at_lat2d = lat2d
111 u_at_lon2d = lon2d
112 v_at_lat2d = lat2d
113 v_at_lon2d = lon2d
114 ;***********************************************
115
116 delete(res)
117 res = True
118
119 res_at_vcRefMagnitudeF = 1. ; define vector ref mag
120 res_at_vcRefLengthF = 0.0080 ; define length of vec ref
121 res_at_vcRefAnnoOrthogonalPosF = -1.0 ; move ref vector
122 res_at_vcMinDistanceF = 0.001 ; larger means sparser
123 ;res_at_vcLineArrowHeadMaxSizeF = 0.0075 ; default: 0.05 (LineArrow), 0.012 (CurlyVe ctor)
124 ;res_at_vcGlyphStyle = "LineArrow" ; default: "LineArrow"
125
126 ;plot1 = gsn_csm_vector_map(wks,u, v, res)
127
128 plot1 = gsn_csm_vector(wks,u, v, res)
129
130
131 ;***********************************************
132 overlay(plot2,plot1)
133 psres =True
134 maximize_output(wks,psres)
135 end do
136 end do
137 end
138
Professor, Department of Environment and Occupational Health
College of Public Health
University of South Florida
13201 Bruce B. Downs Blvd., MDC56
Tampa, Fl 33612-3805
Tel: (813) 974-9571
Fax: (813) 974-4986
Email: mmittal_at_health.usf.edu
________________________________________
From: Mary Haley [haley_at_ucar.edu]
Sent: Tuesday, May 05, 2009 9:46 AM
To: Mittal, Moti
Cc: ncl-talk_at_ucar.edu
Subject: Re: Overlay plots
Moti,
The error message is occuring because you are trying to overlay a map
plot on a map plot. You can't overlay maps on other maps, but you can
overlay vectors and contours on maps.
At the least, you need to change:
plot1 = gsn_csm_vector_map(wks,u, v, res)
to
plot1 = gsn_csm_vector(wks,u, v, res)
Also, I didn't look at your whole script, but I did notice that you
are sharing resources between the two plot calls.
Since one plot is for contours and the other is for vectors, you
should use different resource lists, or make sure you call:
delete(res)
once you are finished with the first plot. This way you start with a
clean resource list and you aren't trying to apply contour resources
to a vector plot (or vice versa).
--Mary
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed May 06 2009 - 13:23:37 MDT
This archive was generated by hypermail 2.2.0 : Wed May 06 2009 - 16:48:59 MDT