<div dir="ltr"><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">Thanks so much Dennis. It works perfectly now. Your advice is also well taken.<br><br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">Regards,<br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">Kwesi<br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jan 4, 2017 at 5:23 PM, Dennis Shea <span dir="ltr">&lt;<a href="mailto:shea@ucar.edu" target="_blank">shea@ucar.edu</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">[a] You are constantly over writing the variable &#39;prClm&#39;<br><br>[b] you constantly repeat code such as:<span class=""><br>      months = (/&quot;January&quot;, &quot;February&quot;, &quot;March&quot;, &quot;April&quot; \<br>            ,&quot;May&quot;, &quot;June&quot;, &quot;July&quot;, &quot;Auguat&quot;         \<br>            ,&quot;September&quot;, &quot;October&quot;, &quot;November&quot;      \<br>            ,&quot;December&quot; /) <br></span>    Why are you doing this redundant code?<br><br>[c] <br><br>---<br>[1] <br>Rather than:<span class=""><br><br>   fili    = &quot;CCCma91-05.nc3&quot;<br>   f       = addfile (diri+fili , &quot;r&quot;)                         <br><br>   pr     = f-&gt;pr*86400     ; (time,lat,lon)<br>   time    = f-&gt;time<br>   lat     = f-&gt;lat<br>   lon     = f-&gt;lon<br><br>   ntim = dimsizes(time)<br>   pr!0 = &quot;time&quot;<br>   pr!1 = &quot;lat&quot;<br>   pr!2 = &quot;lon&quot;<br>   pr&amp;time = time<br>   pr&amp;lat = lat<br>   pr&amp;lon = lon<br><br></span>Use<br>; NCL imports all the meta data. <br><span class="">   fili    = &quot;CCCma91-05.nc3&quot;<br>   f       = addfile (diri+fili , &quot;r&quot;)                         <br></span>   pr      = f-&gt;pr       ; (time,lat,lon)<br>   printVarSummary(pr)<br>   printMinMax(pr,0)<br><br>   pr     = pr*86400    ; change units after importing the varible<br>   pr@unit= &quot;mm/day&quot;<br>   printVarSummary(pr)<br>   printMinMax(pr,0)<br><br>   prClm_0  = clmMonTLL( pr) <br>   printVarSummary(prClm_0)<br>   printMinMax(prClm_0,0)<br><br>Do the same for the other files except name them: pr_clm_1 and prClm_2<br><br><br>[2] Looking at your printVarSummary, it is clear that that the data are on a rectilinear grid. <br>The &#39;lat&#39; and &#39;lon&#39; are coordinate variables.<br><br>Coordinates:<br>            month: [0..11]<br>            lat: [-46.25..42.75]   &lt;==== rectilinear<br>            lon: [-25.25..60.75]   &lt;====     &quot;<br><br>Hence, you do *NOT* need. Delete these lines<span class=""><br><br>  res@sfXArray          = lon   ; Only necessary if x doesn&#39;t<br>  res@sfYArray          = lat   ; contain 1D coordinate arrays<br><br></span>[3]<br>nmo = 0   ; January<br>plot(0) = gsn_csm_contour_map_ce(wks,<wbr>prClm_0(nmo,:,:), res)  ; create plot<br>plot(1) = gsn_csm_contour_map_ce(wks,<wbr>prClm_1(nmo,:,:), res)  ; create plot<br>plot(2) = gsn_csm_contour_map_ce(wks,<wbr>prClm_2(nmo,:,:), res)  ; create plot<br><br>[4]<br>Change:<br>gsn_panel(wks,plot,(/3,1/),<wbr>resP)<br>To:<br>gsn_panel(wks,(/prClm_0,prClm_<wbr>1,prClm_2/),(/3,1/),resP)<br>or<br>gsn_panel(wks,(/prClm_0,prClm_<wbr>1,prClm_2/),(/1,3/),resP)<br><br>[5]<br>In the future please do not send scripts which contain many code lines which are commented out. Please send &#39;clean&#39; scripts only.<br><br>Good Luck<br><br></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="h5">On Tue, Jan 3, 2017 at 9:11 AM, Kwesi Quagraine <span dir="ltr">&lt;<a href="mailto:starskykwesi@gmail.com" target="_blank">starskykwesi@gmail.com</a>&gt;</span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div dir="ltr"><div class="gmail_default" style="font-family:trebuchet ms,sans-serif;font-size:large">Hello NCl Users, I am new to ncl and I have a problem. I am trying to make a  plot similar to the one attached with a common color bar and the file contains precipitation data from 1991-2005. Here&#39;s what I have done so far. <br><br>load &quot;$NCARG_ROOT/lib/ncarg/nclscri<wbr>pts/csm/gsn_code.ncl&quot;  <br>load &quot;$NCARG_ROOT/lib/ncarg/nclscri<wbr>pts/csm/gsn_csm.ncl&quot;  <br>load &quot;$NCARG_ROOT/lib/ncarg/nclscri<wbr>pts/csm/contributed.ncl&quot; <br>load &quot;$NCARG_ROOT/lib/ncarg/nclscri<wbr>pts/csm/shea_util.ncl&quot; <br><br>wksType = &quot;pdf&quot;<br>   wksName = &quot;climo123&quot;                    <wbr>      ; &quot;: &quot;+yrStrt+&quot;_&quot;+yrLast<br>  <br>   diri    = &quot;/media/kwesi/Maxtor/paper/&quot;  <wbr>       ; input directory   <br><br><br>;*****************************<wbr>******************************<br>; Read first file; Create climatology for desired period<br>;*****************************<wbr>******************************<br><br>   fili    = &quot;CCCma91-05.nc3&quot;<br>   f       = addfile (diri+fili , &quot;r&quot;)                          <br><br>   pr     = f-&gt;pr*86400     ; (time,lat,lon)<br>   time    = f-&gt;time<br>   lat     = f-&gt;lat<br>   lon     = f-&gt;lon <br><br>   ntim = dimsizes(time)<br>   pr!0 = &quot;time&quot;<br>   pr!1 = &quot;lat&quot;<br>   pr!2 = &quot;lon&quot;<br>   pr&amp;time = time<br>   pr&amp;lat = lat<br>   pr&amp;lon = lon<br>              <br>   months = (/&quot;January&quot;, &quot;February&quot;, &quot;March&quot;, &quot;April&quot; \<br>            ,&quot;May&quot;, &quot;June&quot;, &quot;July&quot;, &quot;Auguat&quot;         \<br>            ,&quot;September&quot;, &quot;October&quot;, &quot;November&quot;      \<br>            ,&quot;December&quot; /)                       <br>   prClm  = clmMonTLL( pr)                  ; Climatology<br>                              <wbr>                <br>   delete(time)<br>   delete(pr)<br><br>   printVarSummary( prClm )<br>   printMinMax( prClm, True )<br><br>;*****************************<wbr>******************************<br>; Read second file ; Create climatology for desired period<br>; <br>;*****************************<wbr>******************************<br><br>   fili    = &quot;Cnrm91-05.nc3&quot;<br>   f       = addfile (diri+fili , &quot;r&quot;)                          <br>   pr      = f-&gt;pr*86400     ; (time,lat,lon)<br>   time    = f-&gt;time<br>   lat     = f-&gt;lat<br>   lon     = f-&gt;lon <br><br>   ntim = dimsizes(time)<br>   pr!0 = &quot;time&quot;<br>   pr!1 = &quot;lat&quot;<br>   pr!2 = &quot;lon&quot;<br>   pr&amp;time = time<br>   pr&amp;lat = lat<br>   pr&amp;lon = lon <br>   months = (/&quot;January&quot;, &quot;February&quot;, &quot;March&quot;, &quot;April&quot; \<br>            ,&quot;May&quot;, &quot;June&quot;, &quot;July&quot;, &quot;Auguat&quot;         \<br>            ,&quot;September&quot;, &quot;October&quot;, &quot;November&quot;      \<br>            ,&quot;December&quot; /)                         <br><br>   prClm  = clmMonTLL( pr)                  ; Climatology<br>                              <wbr>                <br>   delete(time)<br>   delete(pr)<br><br>   printVarSummary( prClm )<br>   printMinMax( prClm, True )<br><br>;*****************************<wbr>******************************<br>; Read third file; Create climatology for desired period<br>;*****************************<wbr>******************************<br><br>   fili    = &quot;Ichec91-05.nc3&quot;<br>   f       = addfile (diri+fili , &quot;r&quot;)                          <br><br>   pr      = f-&gt;pr*86400     ; (time,lat,lon)<br>   time    = f-&gt;time<br>   lat     = f-&gt;lat<br>   lon     = f-&gt;lon <br><br>   ntim = dimsizes(time)<br>   pr!0 = &quot;time&quot;<br>   pr!1 = &quot;lat&quot;<br>   pr!2 = &quot;lon&quot;<br>   pr&amp;time = time<br>   pr&amp;lat = lat<br>   pr&amp;lon = lon                        <br><br>   months = (/&quot;January&quot;, &quot;February&quot;, &quot;March&quot;, &quot;April&quot; \<br>            ,&quot;May&quot;, &quot;June&quot;, &quot;July&quot;, &quot;Auguat&quot;         \<br>            ,&quot;September&quot;, &quot;October&quot;, &quot;November&quot;      \<br>            ,&quot;December&quot; /)<br>   prClm  = clmMonTLL( pr)                  ; Climatology<br>                              <wbr>                <br>   ;delete(time)<br>   delete(pr)<br><br>   printVarSummary( prClm )<br>   printMinMax( prClm, True )<br><br>;*****************************<wbr>********************<br>; create colors<br>;*****************************<wbr>********************<br> <br><br>  colors = (/&quot;white&quot;,&quot;black&quot;             \      ; back/fore ground<br>            ,&quot;azure1&quot;,&quot;beige&quot;,&quot;lavender&quot; \<br>            ,&quot;PaleGreen&quot;,&quot;SeaGreen3&quot;,&quot;Ligh<wbr>tYellow&quot; \<br>            ,&quot;Yellow&quot;,&quot;HotPink&quot;,&quot;Red&quot;/)   <wbr>      ; choose colors for color map<br>            wks = gsn_open_wks(wksType, wksName)<br>  gsn_define_colormap(wks, colors)              ; generate new color map<br><br>;*****************************<wbr>*******************<br>; create panel plots<br>;*****************************<wbr>********************<br>  plot   = new (3 , graphic)                    ; create graphical array<br><br>  res                      = True               ; plot options desired<br><br>  res@cnFillOn             = True               ; turn on color fill<br>  res@cnInfoLabelOn        = False              ; turn off contour info label<br>  res@cnLinesOn            = False              ; turn off contour lines<br>  res@cnLineLabelsOn       = False              ; turn off line labels<br>  res@cnLevelSelectionMode = &quot;ExplicitLevels&quot;   ; set explicit contour levels<br>  res@cnLevels             = (/ 2.0, 2.5 \ ; set unequal contour levels<br>                              , 3.0, 3.5, 4.0, 4.5, 5.0 \<br>                              ,5.5, 6.0, 6.5, 7.0, 7.5,10.0 /)<br><br>                             <br><br>  res@mpFillOn             = False              ; turn off gray continents<br>  ;res@mpCenterLonF         = 180                ; Centers the plot at 180 <br> <br>  res@lbLabelBarOn         = False              ; No single label bar<br><br>  res@gsnDraw              = False<br>  res@gsnFrame             = False<br><br>  resP                     = True               ; panel options<br>  resP@txString            = &quot;GPCC Precipitation: Climatology&quot;   ; common title<br>  resP@gsnMaximize         = True               ; maximize image<br>  resP@gsnPanelLabelBar    = True               ; Add common label bar <br><br>;---Set to False if plotting regional data or setting sfXArray/sfYArray<br>  res@gsnAddCyclic      =False<br><br>  res@sfXArray          = lon   ; Only necessary if x doesn&#39;t <br>  res@sfYArray          = lat   ; contain 1D coordinate arrays<br>;<br>; Zoom in on map if desired. There are other ways to zoom in on<br>; map if you have a different projection, like lambert conformal.<br>;<br>  res@mpMinLatF         = -60<br>  res@mpMaxLatF         = 0<br>  res@mpMinLonF         = -20<br>  res@mpMaxLonF         = 60<br>  ;res@mpCenterLonF      = (res@mpMinLonF + res@mpMaxLonF) / 2.<br><br>  ;i = -1                            <wbr>            ; Climatologies<br>  ;do nmo=0,180                     <wbr>            ; loop over the months<br>     ;i = i+1<br>     ;res@gsnCenterString   = months(nmo)+&quot;:&quot;+time(0)/100 +&quot;-&quot;+ time(ntim-1)/100<br>     ;plot(i) = gsn_csm_contour_map_ce(wks,prC<wbr>lm(nmo,:,:), res)  ; create plot<br>  ;end do<br>plot = gsn_csm_contour_map_ce(wks,prC<wbr>lm(0,:,:), res)  ; create plot<br>  gsn_panel(wks,plot,(/3,1/),res<wbr>P)<br><br></div><div class="gmail_default" style="font-family:trebuchet ms,sans-serif;font-size:large">-------After running the script I get<br clear="all"></div>Variable: prClm<br>Type: float<br>Total Size: 1486416 bytes<br>            371604 values<br>Number of Dimensions: 3<br>Dimensions and sizes:    [month | 12] x [lat | 179] x [lon | 173]<br>Coordinates: <br>            month: [0..11]<br>            lat: [-46.25..42.75]<br>            lon: [-25.25..60.75]<br>Number Of Attributes: 3<br>  _FillValue :    1e+20<br>  time_op_ncl :    Climatology: 15 years<br>  info :    function clmMonLLT: contributed.ncl<br>(0)     <br>(0)    min=0   max=63.1759<br><br>Variable: prClm<br>Type: float<br>Total Size: 1486416 bytes<br>            371604 values<br>Number of Dimensions: 3<br>Dimensions and sizes:    [month | 12] x [lat | 179] x [lon | 173]<br>Coordinates: <br>            month: [0..11]<br>            lat: [-46.25..42.75]<br>            lon: [-25.25..60.75]<br>Number Of Attributes: 3<br>  info :    function clmMonLLT: contributed.ncl<br>  time_op_ncl :    Climatology: 15 years<br>  _FillValue :    1e+20<br>(0)     <br>(0)    min=0   max=69.7658<br><br>Variable: prClm<br>Type: float<br>Total Size: 1486416 bytes<br>            371604 values<br>Number of Dimensions: 3<br>Dimensions and sizes:    [month | 12] x [lat | 179] x [lon | 173]<br>Coordinates: <br>            month: [0..11]<br>            lat: [-46.25..42.75]<br>            lon: [-25.25..60.75]<br>Number Of Attributes: 3<br>  info :    function clmMonLLT: contributed.ncl<br>  time_op_ncl :    Climatology: 15 years<br>  _FillValue :    1e+20<br>(0)     <br>(0)    min=0   max=53.8587<br><div style="font-family:trebuchet ms,sans-serif;font-size:large" class="gmail_default">​ and the file named climo123 as attached.​ Any help will be much appreciated.</div><span class="m_7717663735328254710HOEnZb"><font color="#888888"><br>-- <br><div class="m_7717663735328254710m_-2662625413926132514gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div><div><font color="#0000ff" face="trebuchet ms, sans-serif">Try not to become a man of success but rather a man of value-Albert Einstein</font></div><div><font color="#0000ff" face="trebuchet ms, sans-serif"><br></font></div><div><font color="#0000ff"><font face="trebuchet ms, sans-serif">University of Cape Coast|</font><span style="font-family:&quot;trebuchet ms&quot;,sans-serif;font-size:12.8px">College of Agriculture and Natural Sciences|</span><span style="font-family:&quot;trebuchet ms&quot;,sans-serif;font-size:12.8px">Department of Physics|</span></font></div><div><font color="#0000ff" face="trebuchet ms, sans-serif">Team Leader|Recycle Up! Ghana|Technology Without Borders|</font></div><div><font color="#0000ff"><font face="trebuchet ms, sans-serif">Other emails: </font><span style="font-family:&quot;trebuchet ms&quot;,sans-serif;font-size:12.8px"><a href="mailto:kwesi.quagraine@ucc.edu.gh" target="_blank">kwesi.quagraine@ucc.ed<wbr>u.gh</a>|</span><span style="font-family:&quot;trebuchet ms&quot;,sans-serif;font-size:12.8px"><a href="mailto:kwesi.quagraine@teog.de" target="_blank">kwesi.quagraine@teog.de</a>|</span></font></div><div><span style="font-family:&quot;trebuchet ms&quot;,sans-serif;font-size:12.8px"><font color="#0000ff">Mobile: <a href="tel:+233%2026%20617%203582" value="+233266173582" target="_blank">+233266173582</a></font></span></div></div><div><font color="#0000ff" face="trebuchet ms, sans-serif">Skype: quagraine_cwasi</font></div><div><font color="#0000ff" face="trebuchet ms, sans-serif">Twitter: @Pkdilly</font></div><div><br><img src="cid:ii_1596513231e8f873" alt="Inline image 1" width="387" height="334"></div></div></div></div></div></div></div></div>
</font></span></div>
<br></div></div>______________________________<wbr>_________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu" target="_blank">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/mailma<wbr>n/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>
</blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div><div><font face="trebuchet ms, sans-serif" color="#0000ff">Try not to become a man of success but rather a man of value-Albert Einstein</font></div><div><font face="trebuchet ms, sans-serif" color="#0000ff"><br></font></div><div><font color="#0000ff"><font face="trebuchet ms, sans-serif">University of Cape Coast|</font><span style="font-family:&#39;trebuchet ms&#39;,sans-serif;font-size:12.8000001907349px">College of Agriculture and Natural Sciences|</span><span style="font-family:&#39;trebuchet ms&#39;,sans-serif;font-size:12.8000001907349px">Department of Physics|</span></font></div><div><font face="trebuchet ms, sans-serif" color="#0000ff">Team Leader|Recycle Up! Ghana|Technology Without Borders|</font></div><div><font color="#0000ff"><font face="trebuchet ms, sans-serif">Other emails: </font><span style="font-family:&#39;trebuchet ms&#39;,sans-serif;font-size:12.8px"><a href="mailto:kwesi.quagraine@ucc.edu.gh" target="_blank">kwesi.quagraine@ucc.edu.gh</a>|</span><span style="font-family:&#39;trebuchet ms&#39;,sans-serif;font-size:12.8px"><a href="mailto:kwesi.quagraine@teog.de" target="_blank">kwesi.quagraine@teog.de</a>|</span></font></div><div><span style="font-family:&#39;trebuchet ms&#39;,sans-serif;font-size:12.8px"><font color="#0000ff">Mobile: +233266173582</font></span></div></div><div><font face="trebuchet ms, sans-serif" color="#0000ff">Skype: quagraine_cwasi</font></div><div><font face="trebuchet ms, sans-serif" color="#0000ff">Twitter: @Pkdilly</font></div><div><br></div></div></div></div></div></div></div></div>
</div>