<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'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's going to fill as much of the square as possible (if you set the vp* resources, which you did), but it won'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'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'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"><<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 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"><<a href="mailto:haley@ucar.edu" target="_blank">haley@ucar.edu</a>></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'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>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"><div class="gmail_default"><font face="courier new, monospace"> wks_type = "png"</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:'courier new',monospace">"wx_map_" + "zoom" + zoom + "_" + "DOM" + \</span></div>
<div class="gmail_default"><span style="font-family:'courier new',monospace"> sprinti("%0.1i",idom+1) + "_" + \</span></div><div class="gmail_default"><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"><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">
<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"><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:'courier new',monospace">frame(wks) ; advance the frame </span></div>
<div class="gmail_default"><span style="font-family:'courier new',monospace"> delete(wks) ; Close the PNG image</span></div><div class="gmail_default"><span style="font-family:'courier new',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:'courier new',monospace"> png_filename = wks_filename + ".png"</span></div>
<div class="gmail_default"><span style="font-family:'courier new',monospace"> cmd = "convert -trim " + png_filename + " " + png_filename</span></div><div class="gmail_default"><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"><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"><<a href="mailto:hachelaf@sca.uqam.ca" target="_blank">hachelaf@sca.uqam.ca</a>></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'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><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>