<div dir="ltr"><div class="gmail_default" style="font-size:small">Rabah,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">You can&#39;t fill a square area with a non-square map, and preserve the aspect ratio at the same time. In your last email, you stated that you needed to preserve the aspect ratio.</div>

<div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Since NCL wants to draw to a square, it&#39;s going to fill as much of the square as possible (if you set the vp* resources, which you did), but it won&#39;t skew the aspect ratio.</div>
<div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">If you give a pixel size of 2000 x 2000 (width x height) and your image is twice as long as it is high, then what happens is your image will be 2000 x 1000, with approximately 500 pixels of white space above and below the image. There are ways to force the image to have all the white space at the bottom or the top, if that&#39;s what you need.</div>
<div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Can you be more specific about what you are hoping to get, that&#39;s not inline with what you are getting out of NCL?</div>
<div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">--Mary</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Jul 30, 2014 at 11:04 PM, Rabah Hachelaf <span dir="ltr">&lt;<a href="mailto:hachelaf@sca.uqam.ca" target="_blank">hachelaf@sca.uqam.ca</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">Hi Mary,<div><br></div><div>Thanks for this working suggestion, but when trimming the image the pixel size change, i must keep the same pixel size in each image side because those images will feed a viewing software like.</div>

<div><br></div><div>Is there another trick to fill the plot area and keep same pixel size.</div><div><br></div><div>Thanks again</div><div><br></div><div>Rabah</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">

2014-07-30 10:39 GMT-04:00 Mary Haley <span dir="ltr">&lt;<a href="mailto:haley@ucar.edu" target="_blank">haley@ucar.edu</a>&gt;</span>:<div><div class="h5"><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div dir="ltr"><div class="gmail_default" style="font-size:small">Hi Rabah,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">One of NCL&#39;s quirks is that it always wants to draw things to a square, so even when you have a non-square plot, like with a lat/lon projection that may be wider than it is high, there is still an invisible square area that NCL is plotting to. You will see this especially when you are plotting graphics to an X11 window or a PNG image.</div>


<div class="gmail_default" style="font-size:small"><br>There&#39;s not much you can do about the X11 window being square, but you can trim the PNG image.</div><div class="gmail_default" style="font-size:small"><br></div>

<div class="gmail_default" style="font-size:small">
The way I trim the PNG image is to use a tool called &quot;convert&quot; which is part of the free ImageMagick package.   &quot;convert&quot; is a handy tool that allows you to convert from one format to another (like PS to PNG, GIF to JPEG, and PNG to PNG), while at the same time trimming additional white space, resizing the image, cropping an image, etc.</div>


<div class="gmail_default" style="font-size:small"><br>Once you have &quot;convert&quot; you can use it directly in your NCL script via a system call, to trim the white space.</div><div class="gmail_default" style="font-size:small">


<br></div><div class="gmail_default" style="font-size:small">So, for example, with the script you included, I would do something like this when calling &quot;gsn_open_wks&quot;:<br></div><div class="gmail_default" style="font-size:small">


<br></div><div class="gmail_default"><div class="gmail_default"><font face="courier new, monospace">  wks_type          = &quot;png&quot;</font></div><div class="gmail_default"><font face="courier new, monospace">  wks_type@wkWidth  = pixel</font></div>


<div class="gmail_default"><font face="courier new, monospace">  wks_type@wkHeight = pixel</font></div><div class="gmail_default"><font face="courier new, monospace">  wks_type@wkBackgroundOpacityF = 0.0</font></div>
<div class="gmail_default"><font face="courier new, monospace">  wks_filename = </font><span style="font-family:&#39;courier new&#39;,monospace">&quot;wx_map_&quot; + &quot;zoom&quot; + zoom + &quot;_&quot; + &quot;DOM&quot; + \</span></div>


<div class="gmail_default"><span style="font-family:&#39;courier new&#39;,monospace">                  sprinti(&quot;%0.1i&quot;,idom+1) +  &quot;_&quot; + \</span></div><div class="gmail_default"><span style="font-family:&#39;courier new&#39;,monospace">                  lev_</span><span style="font-family:&#39;courier new&#39;,monospace">str(ilev) + &quot;_&quot; + sprinti(&quot;%0.2i&quot;, i)</span></div>


<div class="gmail_default"><font face="courier new, monospace">  wks = gsn_open_wks(wks_type,wks_filename</font><span style="font-family:&#39;courier new&#39;,monospace">)</span></div><div class="gmail_default">
<br></div></div><div class="gmail_default" style="font-size:small">Then, after you call &quot;draw&quot; and &quot;frame&quot; on the workstation, you need to &quot;delete&quot; the workstation, which merely ensures that the PNG image is properly closed. This allows you to then call &quot;convert&quot; to trim the image:</div>


<div class="gmail_default"><div class="gmail_default"><br></div><div class="gmail_default"><font face="courier new, monospace">  draw(wks)      ;; Now draw map with text strings and               </font><span style="font-family:&#39;courier new&#39;,monospace">frame(wks)     ; advance the frame   </span></div>


<div class="gmail_default"><span style="font-family:&#39;courier new&#39;,monospace">  delete(wks)    ; Close the PNG image</span></div><div class="gmail_default"><span style="font-family:&#39;courier new&#39;,monospace"><br>


</span></div><div class="gmail_default"><font face="courier new, monospace">;---Trim the PNG image</font></div><div class="gmail_default"><span style="font-family:&#39;courier new&#39;,monospace">  png_filename = wks_filename + &quot;.png&quot;</span></div>


<div class="gmail_default"><span style="font-family:&#39;courier new&#39;,monospace">  cmd = &quot;convert -trim &quot; + png_filename + &quot; &quot; + png_filename</span></div><div class="gmail_default"><span style="font-family:&#39;courier new&#39;,monospace">  system(cmd)                                                                     </span></div>


<div class="gmail_default" style="font-size:small">You can get the ImageMagick suite of tools from:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default"><a href="http://www.imagemagick.org" target="_blank">http://www.imagemagick.org</a><br>


</div><div class="gmail_default"><br>--Mary</div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote"><div><div>On Tue, Jul 29, 2014 at 7:59 AM, Rabah Hachelaf <span dir="ltr">&lt;<a href="mailto:hachelaf@sca.uqam.ca" target="_blank">hachelaf@sca.uqam.ca</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><div dir="ltr">Hi all, <div><br></div><div>I am using the script attached to plot sub-domains from GFS data.</div>

<div>
When i plot the whole domain or a 1/4 domain area the plot fit correctly with the entire plot area.</div>
<div>But when i want plot 1/16 the plotted map does&#39;t fit and there is a white bands appear some time on top and bottom and some times on right and left.(like attached images).</div><div><br></div><div>I tried mpShapeMode  = &quot;FreeAspect&quot;, this make my maps fit with the entire plot area but this <span style="color:rgb(0,0,0);font-family:verdana,sans-serif;font-size:13.600000381469727px;line-height:16px">not preserve the map projection aspect ratio</span></div>



<div><br></div><div>Thank you for any suggestions.  </div><span><font color="#888888"><div><div><br></div>-- <br><div dir="ltr"><div>------------------------------</div>Cordialement,<br>Best regards,<br>Rabah Hachelaf <br>


 <br><br></div>
</div></font></span></div>
<br></div></div>_______________________________________________<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>
</blockquote></div></div></div><div><div class="h5"><br><br clear="all"><div><br></div>-- <br><div dir="ltr"><div>------------------------------</div>Cordialement,<br>Best regards,<br>Rabah Hachelaf <br></div>
</div></div></div>
</blockquote></div><br></div>