<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'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'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 "convert" which is part of the free ImageMagick package. "convert" 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 class="">Once you have "convert" 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 "gsn_open_wks":<br></div><div class="gmail_default" style="font-size:small">
<br></div><div class="gmail_default" style><div class="gmail_default" style><font face="courier new, monospace"> wks_type = "png"</font></div><div class="gmail_default" style><font face="courier new, monospace"> wks_type@wkWidth = pixel</font></div>
<div class="gmail_default" style><font face="courier new, monospace"> wks_type@wkHeight = pixel</font></div><div class="gmail_default" style><font face="courier new, monospace"> wks_type@wkBackgroundOpacityF = 0.0</font></div>
<div class="gmail_default" style><font face="courier new, monospace"> wks_filename = </font><span style="font-family:'courier new',monospace">"wx_map_" + "zoom" + zoom + "_" + "DOM" + \</span></div>
<div class="gmail_default" style><span style="font-family:'courier new',monospace"> sprinti("%0.1i",idom+1) + "_" + \</span></div><div class="gmail_default" style><span style="font-family:'courier new',monospace"> lev_</span><span style="font-family:'courier new',monospace">str(ilev) + "_" + sprinti("%0.2i", i)</span></div>
<div class="gmail_default" style><font face="courier new, monospace"> wks = gsn_open_wks(wks_type,wks_filename</font><span style="font-family:'courier new',monospace">)</span></div><div class="gmail_default" style>
<br></div></div><div class="gmail_default" style="font-size:small">Then, after you call "draw" and "frame" on the workstation, you need to "delete" the workstation, which merely ensures that the PNG image is properly closed. This allows you to then call "convert" to trim the image:</div>
<div class="gmail_default" style><div class="gmail_default" style><br></div><div class="gmail_default" style><font face="courier new, monospace"> draw(wks) ;; Now draw map with text strings and </font><span style="font-family:'courier new',monospace">frame(wks) ; advance the frame </span></div>
<div class="gmail_default" style><span style="font-family:'courier new',monospace"> delete(wks) ; Close the PNG image</span></div><div class="gmail_default" style><span style="font-family:'courier new',monospace"><br>
</span></div><div class="gmail_default" style><font face="courier new, monospace">;---Trim the PNG image</font></div><div class="gmail_default" style><span style="font-family:'courier new',monospace"> png_filename = wks_filename + ".png"</span></div>
<div class="gmail_default" style><span style="font-family:'courier new',monospace"> cmd = "convert -trim " + png_filename + " " + png_filename</span></div><div class="gmail_default" style><span style="font-family:'courier new',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" style><a href="http://www.imagemagick.org">http://www.imagemagick.org</a><br>
</div><div class="gmail_default" style><br>--Mary</div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Jul 29, 2014 at 7:59 AM, Rabah Hachelaf <span dir="ltr"><<a href="mailto:hachelaf@sca.uqam.ca" target="_blank">hachelaf@sca.uqam.ca</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">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'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 = "FreeAspect", 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 class="HOEnZb"><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>_______________________________________________<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>