<div dir="ltr"><div><div><div>[0]<br></div><div>The error message is that you do not have any "coordinate variables" associated with the variables being plotted.<br><br></div><div>[1]<br>If you are "new to NCL", please look at:<br><br><a href="https://test.www.ncl.ucar.edu/Document/Manuals/">https://test.www.ncl.ucar.edu/Document/Manuals/</a><br>User Guide<br><br>[2] <br></div>When you send questions to ncl-talk, it is always useful to include the output from:<br><br>    <a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/printVarSummary.shtml">https://www.ncl.ucar.edu/Document/Functions/Built-in/printVarSummary.shtml</a><br></div><div>and<br>    <a href="https://www.ncl.ucar.edu/Document/Functions/Contributed/printMinMax.shtml">https://www.ncl.ucar.edu/Document/Functions/Contributed/printMinMax.shtml</a><br></div><div><br></div>    printVarSummary(u)<br></div><div>    printMinMax(u,0)<br></div><div>    print("===")<br></div>    printVarSummary(up)<br><div>    printMinMax(u,0)<br></div><div>    print("===")<br><br>[3]<br></div><div>NCL's spherical harmonic functions, as noted in the documentation, require that the data be ordered South-to-North. Operational centers (ECMWF, NCEP, JRA, ...) order the data North-to-South. It is your responsibility to perform this operation.<br><br></div><div>Good Luck<br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Feb 24, 2018 at 2:33 AM, Vyankatesh Manoj Mundhada <span dir="ltr"><<a href="mailto:vyankatesh@iiserb.ac.in" target="_blank">vyankatesh@iiserb.ac.in</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"><div><div><div>Hello,<br><br></div>I am new to NCL and I am trying to plot annual mean climatology for divergent winds (vectors), 
divergence (contours (shading)) and velocity potential (contours (lines)) in a single plot
 using velocities u and v only. I am using two input .nc files f1 and f2, where f1 contains u and v and f2 contains velocity potential.<br>I am trying to plot divergent velocities over velocity potential using the following script:<span class=""><br><br>begin<br>;*****************************<wbr>********************<br>; open file and read in data: data are on a gaussian grid<br>;*****************************<wbr>********************<br></span>  f1    = addfile ("ERAI_200uvd_1979-2010_new.<wbr>nc", "r")<br>  u    = f1->u<br>  v    = f1->v<br>  f2    = addfile ("ERAI_200sfvp_1979-2010_new.<wbr>nc", "r")<br>  vp    = f2->velopot    <br><span class="">;*****************************<wbr>********************<br>; calculate divergence on a gaussian grid<br>;*****************************<wbr>********************<br>  div = uv2dvG_Wrap(u,v)                                        ; u,v ==> divergence  <br>  div@long_name  = "Divergence"<br>  div@units      = "s-1"<br>;*****************************<wbr>********************<br>; calculate velocity potential<br>;*****************************<wbr>********************<br>  ;chi = ilapsG_Wrap ( div , 0)<br></span>  chi  = new ( dimsizes(vp), double, vp@_FillValue )<br>  chi = (/vp/1e4/)                                                 ; arbitrary scale<br>  copy_VarCoords(vp, chi )    <br>    ;chi@long_name = "velocity potential"<br>  ;chi@units     = "m^2/s" <br><span class="">;*****************************<wbr>********************<br>; calculate divergent wind component <br>; --<br>; note: the calculation uses a procedure, so memory <br>; must be preallocated.<br>;*****************************<wbr>********************    <br></span>  ud    = new ( dimsizes(u), double, u@_FillValue )<br>  vd    = new ( dimsizes(v), double, v@_FillValue )<span class=""><br><br>  dv2uvg(div,ud,vd) ; div  ==> divergent  wind components<br><br>  copy_VarCoords(u, ud ) <br></span>  copy_VarCoords(v, vd ) <br><span class="">  ud@long_name  = "Zonal Divergent Wind"<br>  ud@units      = u@units<br>  vd@long_name  = "Meridional Divergent Wind"<br>  vd@units      = v@units<br>    <br></span>    ;udAve = avg(ud(:,:,:,:))<br>    ;vdAve = avg(vd(:,:,:,:))<br>    ;scale    =(/vdAve/udAve/)<br>    ;ud    =    (/scale*ud/)<br><br>    ud = (/ud/1e3/)<br>    vd = (/vd/1e3/)<br>    div = (/div*1e3/)<br><br>    ;UD = month_to_annual(ud, 1)<br>    ;VD = month_to_annual(vd, 1)<br>    ;DIV = month_to_annual(div, 1)<br>    ;CHI = month_to_annual(chi, 1)<br>    <br>    UDavg    =    dim_avg_n_Wrap(ud, (/0,1/))<br>    VDavg    =    dim_avg_n_Wrap(vd, (/0,1/))<br>    DIVavg    =    dim_avg_n_Wrap(div, (/0,1/))<br>    CHIavg    =    dim_avg_n_Wrap(chi, (/0,1/))<br>    CHIavg    =    abs(CHIavg)<br><br>;*****************************<wbr>********************<br>; plot results<br>;*****************************<wbr>********************    <br>  wks  = gsn_open_wks("png","vp_dv_d") <wbr>            ; send graphics to PNG file<br>  ;cmap = read_colormap_file("GMT_polar"<wbr>)<br>    ;cmap = read_colormap_file("GMT_seis")<br>    cmap = read_colormap_file("cmp_b2r")<span class=""><br>  nc   = dimsizes(cmap(:,0))<br><br>    res                          = True<br>    res@gsnDraw                                 = False<br>    res@gsnFrame                             = False<br>    cnres1                                        = res<br>    cnres2                                        = res<br>    vcres                                            = res<br><br>  cnres1@cnFillOn           = True               ; color on<br>  cnres1@cnLinesOn          = False              ; turn off contour lines<br>    cnres1@cnFillPalette      = cmap(:nc-4,:)  <br>    cnres1@tiMainString       = "Divergent Winds, Divergence and Velocity Potential"<br></span>  cnres1@cnLevelSelectionMode     = "ManualLevels"    ; manually set the contour levels with the following 3 resources<br>  cnres1@cnMinLevelValF              = -5.                                ; set the minimum contour level<br>  cnres1@cnMaxLevelValF              = 5.                                ; set the maximum contour level<br>  cnres1@cnLevelSpacingF             = 0.5                                ; set the interval between contours    <br>    cnres1@lbOrientation           = "vertical"<br>    cnres1@lbBoxSeparatorLinesOn = False<br>    cnres1@lbTitleString             = div@long_name<br>    cnres1@lbTitlePosition        = "Left"<br>    cnres1@lbAutoManage             = False<br>    cnres1@lbTitleFontHeightF    = 0.012<br>    ;cnres1@lbLabelStrings =  (/"-5.0","-2.5","0","2.5","5.<wbr>0"/)<br>    cnres1@mpMinLonF          =   0<br>  cnres1@mpMaxLonF          = 360<br>  cnres1@mpCenterLonF       = 180     ; This is necessary to get the correct map <br>    cnres1@mpMinLatF          = -80<br>  cnres1@mpMaxLatF          = 80<span class=""><br><br>    vcres@vcRefMagnitudeF     = 10.                 ; make vectors larger<br>  vcres@vcRefLengthF        = 0.05              ; ref vector length<br>  vcres@vcGlyphStyle        = "CurlyVector"      ; turn on curly vectors<br>  vcres@vcMinDistanceF      = 0.012              ; thin the vectors<br></span>  vcres@vcRefAnnoOrthogonalPosF  = 0        ; Move ref anno into plot<span class=""><br>    vcres@vcRefAnnoBackgroundColor = "Background"<br>    vcres@vcRefAnnoString2On    = False<br></span>    ;vcres@vcRefAnnoSide            =    "Left" <br><span class=""><br>  ;cnres2@gsnCenterString    = "Chi scaled by 1e8"<br>    cnres2@cnFillOn                        = False<br>    cnres2@cnLinesOn                    = True<br></span>    ;cnres2@mpMinLonF          =   0<br>  ;cnres2@mpMaxLonF          = 360<br>  ;cnres2@mpCenterLonF       = 180     ; This is necessary to get the correct map<br>    cnres2@trGridType                     = "TriangularMesh"<br><br>    plot1 = gsn_csm_vector(wks,UDavg(:,:),<wbr>VDavg(:,:),vcres)<br>    plot2    = gsn_csm_contour_map_overlay(<wbr>wks,DIVavg(:,:),CHIavg(:,:),<wbr>cnres1,cnres2)<br><br>    overlay(plot2,plot1)<br>    <br>    draw(plot2)<br>    frame(wks)<br><br>end<br><br><br></div>I am getting the following warning messages: <br><span class=""><br>(0)    check_for_y_lat_coord: Warning: Data either does not contain a valid latitude coordinate array or doesn't contain one at all.<br>(0)    A valid latitude coordinate array should have a 'units' attribute equal to one of the following values: <br>(0)        'degrees_north' 'degrees-north' 'degree_north' 'degrees north' 'degrees_N' 'Degrees_north' 'degree_N' 'degreeN' 'degreesN' 'deg north'<br>(0)    check_for_lon_coord: Warning: Data either does not contain a valid longitude coordinate array or doesn't contain one at all.<br>(0)    A valid longitude coordinate array should have a 'units' attribute equal to one of the following values: <br>(0)        'degrees_east' 'degrees-east' 'degree_east' 'degrees east' 'degrees_E' 'Degrees_east' 'degree_E' 'degreeE' 'degreesE' 'deg east'<br><br><br></span></div>and the plot which is attached to this mail. I think I am getting proper divergence but velocity potential lines are not getting plotted at all and I feel the direction of winds are also wrong. So please help me to get a proper plot without error. I am expecting humble reply from your side. <br><div><br>Thanking you,<br><br></div><div>Vyankatesh Mundhada<br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Feb 21, 2018 at 5:40 PM, Vyankatesh Manoj Mundhada <span dir="ltr"><<a href="mailto:vyankatesh@iiserb.ac.in" target="_blank">vyankatesh@iiserb.ac.in</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"><div><div>Thank you very much. That was really helpful.<br><br></div>Regards,<br></div>Vyankatesh<br></div><div><div class="h5"><div class="m_7522818611318718632HOEnZb"><div class="m_7522818611318718632h5"><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Feb 21, 2018 at 4:03 PM, Guido Cioni <span dir="ltr"><<a href="mailto:guidocioni@gmail.com" target="_blank">guidocioni@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 style="word-wrap:break-word;line-break:after-white-space">Hi,<div>This error usually pops up when you're doing assignment that delete the original attributes of the variable, including the reference to the coordinate variables. </div><div><br></div><div>I'm just speculating but...could it be this line? </div><span><div><br></div><div><font face="Menlo">    plot1 = gsn_csm_vector_map(wks,0.001*u<wbr>d(0,0,:,:),0.001*vd(0,0,:,:),v<wbr>cres)</font></div><div><br></div></span><div>You are doing <font face="Menlo">0.001*ud(0,0,:,:)</font>, so merely assigning a new variable without copying the attributes.</div><div>You should instead do the scaling first </div><div><br></div><div><font face="Menlo">ud=0.001*ud(:,:,:,:) ; here the attributes are preserved</font></div><div><br></div><div>and then plot <font face="Menlo">ud(0,0,:,:).</font></div><div>Or just a define a new variable based un <font face="Menlo">ud</font> first. </div><div><br></div><div>Let us know whether that works, that's the first thing that comes to my mind. </div><div><br></div><div><br><div><br><blockquote type="cite"><div>On 21. Feb 2018, at 10:20, Vyankatesh Manoj Mundhada <<a href="mailto:vyankatesh@iiserb.ac.in" target="_blank">vyankatesh@iiserb.ac.in</a>> wrote:</div><br class="m_7522818611318718632m_-6586681390938842954m_3346935692996899367Apple-interchange-newline"><div><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">0.001*vd(0,0,:,:)</span></div></blockquote></div><span class="m_7522818611318718632m_-6586681390938842954HOEnZb"><font color="#888888"><br><div>
<div style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br class="m_7522818611318718632m_-6586681390938842954m_3346935692996899367Apple-interchange-newline">Guido Cioni</div><div style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><a href="http://guidocioni.altervista" target="_blank">http://guidocioni.altervista</a>.o<wbr>rg</div>

</div>
<br></font></span></div></div></blockquote></div><br></div>
</div></div></div></div></blockquote></div><br></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>