<div dir="ltr">Hi Frank,<div>Sorry for the delay in answering. Only map plots themselves have the concept of a projection. When you overlay a contour plot on a map plot the contour data locations are transformed into the current map projection. That is, as long as the contour data has the appropriate coordinate arrays attached. If the u1 data has 1d coordinates that are defined in the file using the usual NetCDF-style conventions, then the coordinates will be automatically known to the gsn routines and the data will be mapped correctly into the current map projection.</div><div>In this case, a printVarSummary of the u1 variable should show something like:</div><div><br></div><div>
Variable: u1<br>Type: float<br>Total Size: 32768 bytes<br> 8192 values<br>Number of Dimensions: 2<br>Dimensions and sizes: [lat | 64] x [lon | 128]<br>Coordinates: <br> lat: [-87.8638..87.8638]<br> lon: [-180..177.1875]<br>Number Of Attributes: 5<br> time : 1<br> _FillValue : -999</div><div> long_name :<span class="">        </span>Zonal Wind</div><div> short_name :<span class="">        </span>U<br></div><div> units : m/s</div><div><br></div><div>which indicates that there are 1D variables in the file named lat and lon that have the same dimensions as the two dimensions of the u1 variable.</div><div>The names of these don't matter but in order to overlay properly these variables need a compatible 'units' attribute, usually 'degrees_east' for longitude and 'degrees_north' for latitude.</div><div><br></div><div>If u1 is on some sort of pre-projected grid, then an overlay into a arbitrary map projection requires that that a set of 2D coordinate variables that define the individual position of each grid point be passed along with the contour data. There are two ways to do this:</div><div>1) define the special attributes lon2d and lat2d for the u1 variable:</div><div>u1@lat2d = <2d lat coordinates></div><div>u1@lon2d = <2d lon coordinates></div><div><br></div>2) define the resources sfXArray and sfYArray with these same coordinates:<br>resNatVar@sfXArray = <2d lon coordinates><div>resNatVar@sfYArray = <2d lat coordinates></div><div><br></div><div>If these 2D coordinates are not available in the file, then you will need to use an external program such as PROJ4 to calculate them based on the projection used for the u1 data.</div><div><br></div><div>If this does not answer your questions, then we will need sample data files plus a complete runnable script in order to help further.</div><div> -dave</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Mar 18, 2015 at 1:08 AM, Kreienkamp Frank <span dir="ltr"><<a href="mailto:Frank.Kreienkamp@dwd.de" target="_blank">Frank.Kreienkamp@dwd.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="white" lang="DE" link="blue" vlink="purple">
<div>
<p class="MsoNormal"><span lang="EN-US">Hello,<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"> <u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">i want to plot a grid based plot, including an contour overlay. The grid based plot is drawn in Stereographic projection using mpProjection = "Stereographic" and plot = gsn_csm_map(wks,res). On top of this map I want
to add a contour-plot showing if changes are significant or not. <u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">Unfortunately both plots do not use the same projection.<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">But if I use resNatVar@mpProjection = "Stereographic" I get the information: warning:mpProjection is not a valid resource in ..<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">I have added the source-code part and an example plot.<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">What can I do?<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">Thanks in advance<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">Frank <br>
<br>
<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"> <u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"> ;************************************************<br>
; create plot<br>
wtype = "png"<br>
wtype@wkWidth = 970 ; Set the pixel size of image.<br>
wtype@wkHeight = 1000 ; Set the pixel size of image.<br>
wks = gsn_open_wks(wtype,"test") <br>
;************************************************<br>
res = True <br>
res@gsnMaximize = True<br>
res@gsnDraw = False<br>
res@gsnFrame = False<br>
res@mpProjection = "Stereographic"<br>
res@mpCenterLatF = 50 ; Centered over Germany<br>
res@mpCenterLonF = 10 ; Centered over Germany<br>
res@mpLimitMode = "Corners" ; choose range of map<br>
res@mpLeftCornerLatF = 55.8<br>
res@mpLeftCornerLonF = 2.6<br>
res@mpRightCornerLatF = 45.1<br>
res@mpRightCornerLonF = 19.5<br>
res@mpGridLatSpacingF = 2<br>
res@mpGridLonSpacingF = 2<br>
res@mpOutlineDrawOrder = "PostDraw" ; draw continental outline last<br>
res@mpFillDrawOrder = "PreDraw"<br>
res@mpDataBaseVersion = "HighRes" ; use finer database<br>
res@mpOutlineBoundarySets = "National"<br>
res@mpFillOn = False ; turns off continent gray<br>
res@mpLeftAngleF = 7<br>
res@mpRightAngleF = 8<br>
res@mpBottomAngleF = 6<br>
res@mpTopAngleF = 8<br>
res@mpMinLatF = 10.0<br>
res@pmTickMarkDisplayMode = "Always" ; Nicer tickmark labels<br>
res@mpGridAndLimbOn = True ; Turn on lat/lon grid<br>
res@mpGridLineDashPattern = 2 ; Dashed lines<br>
res@tmXTOn = False ; turn tickmarks of<br>
res@tmXBOn = False ; turn tickmarks of<br>
res@tmYLOn = False ; turn tickmarks of<br>
res@tmYROn = False ; turn tickmarks of<br>
res@gsnLeftString = ""<br>
;************************************************<br>
; Plot will just be created, and not drawn yet.<br>
plot = gsn_csm_map(wks,res) ; Create plot<br>
;************************************************<br>
; adding color definition<br>
cmap = RGBtoCmap("/kp/kp06/VisTool/data/konstdat/Farben_rgb_temp.dat")<br>
gsn_define_colormap(wks,cmap) <br>
;************************************************<br>
; adding map<br>
res@cnFillOn = True ; color Fill <br>
res@cnFillMode = "RasterFill" ; Raster Mode<br>
res@cnLinesOn = False ; Turn off contour lines<br>
res@cnLevelSelectionMode = "ManualLevels"<br>
res@cnMinLevelValF = -90.0 ; min contour level<br>
res@cnMaxLevelValF = 90.0 ; max contour level<br>
res@cnLevelSpacingF = 20.0 ; contour spacing<br>
res@cnLabelBarEndStyle = "ExcludeOuterBoxes" ; no additional ColorBoxes<br>
res@gsnAddCyclic = False ; regional data: not cyclic<br>
;************************************************<br>
; Plot will just be created, and not drawn yet.<br>
plot = gsn_csm_contour_map(wks,u,res)<br>
;************************************************<br>
; add Info robust signal<br>
resNatVar = True <br>
resNatVar@gsnMaximize = True<br>
resNatVar@gsnDraw = False<br>
resNatVar@gsnFrame = False <br>
resNatVar@gsnLeftString = "" <br>
resNatVar@lbLabelBarOn = False<br>
resNatVar@cnFillOn = True ; color Fill <br>
resNatVar@cnLinesOn = False ; Turn off contour lines<br>
resNatVar@cnLevelSelectionMode = "AutomaticLevels"<br>
resNatVar@cnFillMode = "AreaFill" ; Raster Mode <br>
resNatVar@cnFillPattern = 17 <br>
resNatVar@cnFillBackgroundColor = -1<br>
resNatVar@cnInfoLabelOn = False<br>
resNatVar@cnLineLabelsOn = False<br>
resNatVar@cnMonoFillColor = True<br>
resNatVar@cnConstFEnableFill = True<br>
resNatVar@cnConstFLabelOn = False<br>
resNatVar@cnFillColor = "black"<br>
;************************************************<br>
; Plot will just be created, and not drawn yet.<br>
plot1 = gsn_csm_contour(wks,u1,resNatVar) <br>
overlay(plot,plot1) <br>
<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span><img width="751" height="729" src="cid:image001.png@01D0614F.B2E6B880"></span><span lang="EN-US"><u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"> <u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"> <u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"> <u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"> <u></u><u></u></span></p>
</div>
</div>
<br>_______________________________________________<br>
ncl-talk mailing list<br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>