<div dir="ltr"><div class="gmail_default" style="font-family:verdana,sans-serif">addition, subtraction etc on a variable and returning to a new variable doesn't retain any of the original metadata. </div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif"><div class="gmail_default"><br></div><div class="gmail_default"><div style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:12.800000190734863px"><font color="#000000" face="arial, helvetica, sans-serif"> U10_0 = (u10*u1)+u2 ;y=ax+b siendo x=u10</font></div><div style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:12.800000190734863px"><span style="font-family:arial,helvetica,sans-serif"> V10_0 = (v10*v1)+v2 ;y=ax+b siendo x=v10</span></div><div><span style="font-family:arial,helvetica,sans-serif"><br></span></div><div><span style="font-family:arial,helvetica,sans-serif"><br></span></div></div></div><div class="gmail_default" style="font-family:verdana,sans-serif">Your printVarSummary() will have shown U10_0 as an array with no attributes and no coordinates. </div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif">You can apply a copy_VarCoords(u10, U10_0) to copy over the needed info after you've defined the new variable. Also similar for the meridional wind and magnitude variable. </div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif">I'm also not sure you have to apply the offset and scale factor yourself. I was under the impression that NCL did this automatically, but you'll work this out pretty quickly once you can plot the data. </div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif">Good luck, </div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif">Alan</div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jul 18, 2017 at 11:34 AM, Lara Quitián Hernández <span dir="ltr"><<a href="mailto:laraquitianhernandez@gmail.com" target="_blank">laraquitianhernandez@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><font face="arial, helvetica, sans-serif">Good afternoon from Spain, </font><div><span style="font-family:arial,helvetica,sans-serif;color:rgb(0,0,0)"><br></span></div><div><span style="font-family:arial,helvetica,sans-serif;color:rgb(0,0,0)">I'm attempting to produce a vector/contour plot of a specific area from ECMWF </span>analysis data. Firstly, my script decodes<font color="#000000" face="arial, helvetica, sans-serif"> the ECMWF variables u10 and v1 with the "doubletofloat" function. Secondly, I calculate the wind module (SPD) in order to generate a </font><span style="font-family:arial,helvetica,sans-serif;color:rgb(0,0,0)">contour plot of the wind speed (succesfully obtained). </span></div><div><span style="font-family:arial,helvetica,sans-serif;color:rgb(0,0,0)">The problem arises when I try to overlay the vector plot on this contour plot. In this case, I obtained a vector plot that has nothing to do with the contour plot. </span></div><div><font color="#000000" face="arial, helvetica, sans-serif"><br></font></div><div><font color="#000000" face="arial, helvetica, sans-serif">Appear to be specific problems associated with coordinates and other issues, because I received error messages such as: </font><font face="garamond, serif"><font color="#000000">"</font><span style="font-variant-ligatures:no-common-ligatures;color:rgb(12,12,12)">A valid longitude coordinate array should have a 'units' attribute equal to one of the following values:</span><span class="m_-4059470921305255398gmail-Apple-converted-space" style="font-variant-ligatures:no-common-ligatures;color:rgb(12,12,12)"> </span>(0)<span class="m_-4059470921305255398gmail-Apple-tab-span">        </span><span class="m_-4059470921305255398gmail-Apple-converted-space"> </span>'degrees_east' 'degrees-east' 'degree_east' 'degrees east' 'degrees_E' 'Degrees_east' 'degree_E' 'degreeE' 'degreesE' 'deg east' "</font></div>
<div><span style="font-family:arial,helvetica,sans-serif;color:rgb(0,0,0)"><br></span></div><div><span style="font-family:arial,helvetica,sans-serif;color:rgb(0,0,0)">Here is the </span><span style="font-family:arial,helvetica,sans-serif;color:rgb(0,0,0)">script: </span></div><div><span style="font-family:arial,helvetica,sans-serif;color:rgb(0,0,0)"><br></span></div><div><div><font color="#000000" face="arial, helvetica, sans-serif">load "$NCARG_ROOT/lib/ncarg/<wbr>nclscripts/csm/gsn_code.ncl"</font></div><div><font color="#000000" face="arial, helvetica, sans-serif">load "$NCARG_ROOT/lib/ncarg/<wbr>nclscripts/csm/gsn_csm.ncl"</font></div><div><font color="#000000" face="arial, helvetica, sans-serif">load "$NCARG_ROOT/lib/ncarg/<wbr>nclscripts/wrf/WRFUserARW.ncl"</font></div><div><font color="#000000" face="arial, helvetica, sans-serif"><br></font></div><div><font color="#000000" face="arial, helvetica, sans-serif"><br></font></div><div><font color="#000000" face="arial, helvetica, sans-serif">begin</font></div><div><font color="#000000" face="arial, helvetica, sans-serif"><br></font></div><div><font color="#000000" face="arial, helvetica, sans-serif">input = addfile("../<a href="http://10wind_an.nc" target="_blank">10wind_an.nc</a>", "r")</font></div><div><font color="#000000" face="arial, helvetica, sans-serif"><br></font></div><div><font color="#000000" face="arial, helvetica, sans-serif"> Lon <span style="white-space:pre-wrap">        </span> = input->longitude</font></div><div><font color="#000000" face="arial, helvetica, sans-serif"> Lat <span style="white-space:pre-wrap">        </span> = input->latitude</font></div><div><font color="#000000" face="arial, helvetica, sans-serif"> v10 = input->v10</font></div><div><font color="#000000" face="arial, helvetica, sans-serif"> u10 = input->u10</font></div><div><font color="#000000" face="arial, helvetica, sans-serif"> timean =input->time</font></div><div><font color="#000000" face="arial, helvetica, sans-serif"><br></font></div><div><font color="#000000" face="arial, helvetica, sans-serif">;;;;;;;; variables u10 y v10 se encuentran codificadas ;;;;;;;;;;;;;;</font></div><div><font color="#000000" face="arial, helvetica, sans-serif"><br></font></div><div><font color="#000000" face="arial, helvetica, sans-serif">u1 = doubletofloat(u10@scale_factor<wbr>) ;a=scale_factor</font></div><div><font color="#000000" face="arial, helvetica, sans-serif">u2 = doubletofloat(u10@add_offset) ;b=add_offset</font></div><div><font color="#000000" face="arial, helvetica, sans-serif"><br></font></div><div><font color="#000000" face="arial, helvetica, sans-serif">v1 = doubletofloat(v10@scale_factor<wbr>)</font></div><div><font color="#000000" face="arial, helvetica, sans-serif">v2 = doubletofloat(v10@add_offset)</font></div><div><font color="#000000" face="arial, helvetica, sans-serif"> </font></div><div><font color="#000000" face="arial, helvetica, sans-serif"> </font></div><div><font color="#000000" face="arial, helvetica, sans-serif"> U10_0 = (u10*u1)+u2 ;y=ax+b siendo x=u10</font></div><div><span style="color:rgb(0,0,0);font-family:arial,helvetica,sans-serif"> V10_0 = (v10*v1)+v2 ;y=ax+b siendo x=v10</span></div><div><div><font color="#000000" face="arial, helvetica, sans-serif"><br class="m_-4059470921305255398gmail-Apple-interchange-newline">;printVarSummary(U10_0) ;24x141x201</font></div></div><div><font color="#000000" face="arial, helvetica, sans-serif"><br></font></div><div><span style="color:rgb(0,0,0);font-family:arial,helvetica,sans-serif">;Wind Speed module</span></div><div><font color="#000000" face="arial, helvetica, sans-serif"> SPD_0=(U10_0^2+V10_0^2)^(0.5)</font></div><div><font color="#000000" face="arial, helvetica, sans-serif"><br></font></div><div><font color="#000000" face="arial, helvetica, sans-serif">; Set basic resources</font></div><div><font color="#000000" face="arial, helvetica, sans-serif"> res=True</font></div><div><font color="#000000" face="arial, helvetica, sans-serif"> pltres = True ; Plotting resources</font></div><div><font color="#000000" face="arial, helvetica, sans-serif"> mpres = True ; Map resources</font></div><div><span style="color:rgb(0,0,0);font-family:arial,helvetica,sans-serif"> time_utc=cd_calendar(timean,<wbr>3)</span><br></div><div><font color="#000000" face="arial, helvetica, sans-serif"> ntimes = dimsizes(time_utc) </font></div><div><font color="#000000" face="arial, helvetica, sans-serif"><br></font></div><div><font color="#000000" face="arial, helvetica, sans-serif"> do it = 0,ntimes-1,1 ; TIME LOOP </font></div><div><span style="color:rgb(0,0,0);font-family:arial,helvetica,sans-serif"> </span><br></div><div><font color="#000000" face="arial, helvetica, sans-serif"> SPD = SPD_0(it,:,:) </font></div><div><font color="#000000" face="arial, helvetica, sans-serif"> U10 = U10_0(it,:,:)</font></div><div><font color="#000000" face="arial, helvetica, sans-serif"> V10 = V10_0(it,:,:)</font></div><div><font color="#000000" face="arial, helvetica, sans-serif"><br></font></div><div><font color="#000000" face="arial, helvetica, sans-serif">;printVarSummary(U10) ;141x201</font></div><div><font color="#000000" face="arial, helvetica, sans-serif"><br></font></div><div><font color="#000000" face="arial, helvetica, sans-serif"> SPD@description = "Wind Speed"</font></div><div><font color="#000000" face="arial, helvetica, sans-serif"> SPD@units = "m/s"</font></div><div><font color="#000000" face="arial, helvetica, sans-serif"><br></font></div><div><font color="#000000" face="arial, helvetica, sans-serif"> wks_type = "png"</font></div><div><font color="#000000" face="arial, helvetica, sans-serif"> wks_type@wkWidth = 2000</font></div><div><font color="#000000" face="arial, helvetica, sans-serif"> wks_type@wkHeight = 2000</font></div><div><font color="#000000" face="arial, helvetica, sans-serif"> wks = gsn_open_wks(wks_type, "../spd_AN/SPD_AN_" + time_utc(it) + "")</font></div><div><font color="#000000" face="arial, helvetica, sans-serif"> gsn_define_colormap(wks,"<wbr>BlAqGrYeOrRe")</font></div><div><font color="#000000" face="arial, helvetica, sans-serif"><br></font></div><div><font color="#000000" face="arial, helvetica, sans-serif"><br></font></div><div><font color="#000000" face="arial, helvetica, sans-serif"> res@cnFillOn = True ; turn on color for contours</font></div><div><font color="#000000" face="arial, helvetica, sans-serif"> res@cnLinesOn = False ; turn off contour lines</font></div><div><font color="#000000" face="arial, helvetica, sans-serif"> res@cnLineLabelsOn = False ; turn off contour line labels</font></div><div><font color="#000000" face="arial, helvetica, sans-serif"> res@gsnScalarContour = True ; contours desired</font></div><div><font color="#000000" face="arial, helvetica, sans-serif"> res@cnFillPalette = "WhiteBlueGreenYellowRed"</font></div><div><font color="#000000" face="arial, helvetica, sans-serif"><br></font></div><div><font color="#000000" face="arial, helvetica, sans-serif"> res@mpLandFillColor = "gray" ; set land to be gray</font></div><div><font color="#000000" face="arial, helvetica, sans-serif"> res@mpMinLatF = 26.50 ; set the minimum latitude</font></div><div><font color="#000000" face="arial, helvetica, sans-serif"> res@mpMaxLatF = 40.00 ; set the maximum latitude</font></div><div><font color="#000000" face="arial, helvetica, sans-serif"> res@mpMinLonF = -30.50 ; set the minimum longitude</font></div><div><font color="#000000" face="arial, helvetica, sans-serif"> res@mpMaxLonF = -11.50 </font></div><div><font color="#000000" face="arial, helvetica, sans-serif"> </font></div><div><font color="#000000" face="arial, helvetica, sans-serif"> res@lbOrientation = "Vertical" ; vertical label bar</font></div><div><font color="#000000" face="arial, helvetica, sans-serif"> res@pmLabelBarOrthogonalPosF = -0.01 ; move label bar closer</font></div><div><br></div><div><font color="#000000" face="arial, helvetica, sans-serif">; note, when doing a subregion, NCL determines the range of the data from</font></div><div><font color="#000000" face="arial, helvetica, sans-serif">; the full domain. If you wish to just consider the domain you are plotting,</font></div><div><font color="#000000" face="arial, helvetica, sans-serif">; you must manually set those levels.</font></div><div><font color="#000000" face="arial, helvetica, sans-serif"><br></font></div><div><font color="#000000" face="arial, helvetica, sans-serif"> res@cnLevelSelectionMode = "ManualLevels" ; set manual contour levels</font></div><div><font color="#000000" face="arial, helvetica, sans-serif"> res@cnMinLevelValF = 0.0 ; set min contour level</font></div><div><font color="#000000" face="arial, helvetica, sans-serif"> res@cnMaxLevelValF = 24 ; set max contour level</font></div><div><font color="#000000" face="arial, helvetica, sans-serif"> res@cnLevelSpacingF = 2.0 ; set contour spacing</font></div><div><font color="#000000" face="arial, helvetica, sans-serif"><br></font></div><div><font color="#000000" face="arial, helvetica, sans-serif"> res@vcRefMagnitudeF = 4.0 ; define vector ref mag</font></div><div><font color="#000000" face="arial, helvetica, sans-serif"> res@vcRefLengthF = 0.045 ; define length of vec ref</font></div><div><font color="#000000" face="arial, helvetica, sans-serif"> res@vcRefAnnoOrthogonalPosF = -1.0 ; move ref vector</font></div><div><font color="#000000" face="arial, helvetica, sans-serif"> res@vcRefAnnoArrowLineColor = "black" ; change ref vector color</font></div><div><font color="#000000" face="arial, helvetica, sans-serif"> res@vcRefAnnoArrowUseVecColor = False ; don't use vec color for ref</font></div><div><font color="#000000" face="arial, helvetica, sans-serif"><br></font></div><div><font color="#000000" face="arial, helvetica, sans-serif"> res@vcGlyphStyle = "WindBarb" ; turn on curly vectors</font></div><div><font color="#000000" face="arial, helvetica, sans-serif"> res@vcLineArrowColor = "white" ; change vector color</font></div><div><font color="#000000" face="arial, helvetica, sans-serif"> res@vcLineArrowThicknessF = 2.0 ; change vector thickness</font></div><div><font color="#000000" face="arial, helvetica, sans-serif"> res@vcVectorDrawOrder = "PostDraw" ; draw vectors last</font></div><div><font color="#000000" face="arial, helvetica, sans-serif"><br></font></div><div><span style="color:rgb(0,0,0);font-family:arial,helvetica,sans-serif"> plot=gsn_csm_vector_scalar_<wbr>map_ce(wks,U10,V10,SPD,res)</span><br></div><div><br></div><div><font color="#000000" face="arial, helvetica, sans-serif">draw(plot)</font></div><div><font color="#000000" face="arial, helvetica, sans-serif">frame(wks)</font></div><div><font color="#000000" face="arial, helvetica, sans-serif"><br></font></div><div><font color="#000000" face="arial, helvetica, sans-serif"> end do </font></div><div><font color="#000000" face="arial, helvetica, sans-serif">end</font></div></div><div><font color="#000000" face="arial, helvetica, sans-serif"><br></font></div><div><font color="#000000" face="arial, helvetica, sans-serif">----</font></div><div><font color="#000000" face="arial, helvetica, sans-serif"><br></font></div><div><font color="#000000" face="arial, helvetica, sans-serif">Any help would be really appreciated. Thank you in advance.</font></div><div><font color="#000000" face="arial, helvetica, sans-serif"><br></font></div><div><font color="#000000" face="arial, helvetica, sans-serif">Regards, </font></div><span class="HOEnZb"><font color="#888888"><div><font color="#000000" face="arial, helvetica, sans-serif">Lara</font></div></font></span></div>
<br>______________________________<wbr>_________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/<wbr>mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>