[gradsusr] How do I get a map to fill the entire output PNG?

Rupak Rajbhandari rupak.rajbhandari at gmail.com
Fri Jun 6 05:23:26 EDT 2014


HI,

There was similar query earlier and Jennifer has already addressed the
issue. You may search the archive and find out. At that time I thought it
would be useful so I copied the text (tested the instructions) and saved
it. The instruction file is attached.

-rupak



On Fri, Jun 6, 2014 at 4:43 AM, James T. Potemra <jimp at hawaii.edu> wrote:

>  Hi Christopher,
>
> You can use the command "set parea" to print right to the edge.  Let me
> know if you need an example.
>
> Jim
>
>
> On 6/5/14 12:15 PM, Lynnes, Christopher S. (GSFC-6102) wrote:
>
> I'm trying to draw a map without decorations to a PNG file, and filling an
> entire area (so I can hand it off to a WMS server).  For a global 360x180
> file, I am scripting:
> 'sdfopen
> timeAvg.AIRX3STD_006_Temperature_A.20120101-20120101.180W_90S_180E_90N.925hPa.nc
> '
> 'set mproj off'
> 'set gxout shaded'
> 'set frame off'
> 'set grid off'
> 'set mpdraw off'
> 'set xlab off'
> 'set ylab off'
> 'set grads off'
> 'd airx3std_006_te'
> 'printim out.png x360 y180'
> 'quit'
>
>  But it still leaves margins around the edges, even if I use the
> -geometry arg on the command line (-geometry 360x180+0+0).
>
>   --
> Dr. Christopher Lynnes     NASA/GSFC, Code 610.2    phone: 301-614-5185
> "Making the simple complicated is commonplace; making the complicated
> simple, awesomely simple, that's creativity." -- C. Mingus
>
>
>
>
> _______________________________________________
> gradsusr mailing listgradsusr at gradsusr.orghttp://gradsusr.org/mailman/listinfo/gradsusr
>
>
>
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20140606/0f7cc129/attachment-0001.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/png
Size: 6631 bytes
Desc: not available
Url : http://gradsusr.org/pipermail/gradsusr/attachments/20140606/0f7cc129/attachment-0001.png 
-------------- next part --------------
Here is what I would do: 

1. set parea to the full page: 'set parea 0 11 0 8.5'

2. Constrain the domain so that the desired area is shown. This can be done by limiting the lat/lon dimension environment, by using 'set mpvals', or both. GrADS will fill the plot area as best it can while still maintaining the proper aspect ratio -- don't worry about whether the plot stretches to the very edges of the page, just get the display inside the frame to be the way you want it. 

3. call 'q gxinfo' and parse the output to get the size of the frame. E.g. 

ga-> q gxinfo               
Last Graphic = Contour
Page Size = 11 by 8.5
X Limits = 0.5 to 10.5
Y Limits = 1.25 to 7.25
Xaxis = Lon  Yaxis = Lat
Mproj = 2

Note the The display is 10 inches in X (10.5 minus 0.5) and 6 inches in Y (7.25-1.25). This means your plot has an aspect ratio of 1.6667. 

4. Quit grads, then restart with "grads -a 1.6667" instead of using -l or -p. 

5. check the 'q gxinfo' output again: 

ga-> q gxinfo          
Last Graphic = Contour
Page Size = 11 by 6.59987
X Limits = 1.25011 to 9.74989
Y Limits = 0.75 to 5.84987
Xaxis = Lon  Yaxis = Lat
Mproj = 2

6. Note the different page size. Use these numbers to change your parea command:
'q gxinfo'
psz=sublin(result,2)
xsz=subwrd(psz,4)
ysz=subwrd(psz,6)
'set parea 0 'xsz' 0 'ysz-0.0001
Rounding issues force me to reduce the y size by a tiny bit in order to avoid the message: 'parea values beyond page limits.' 

7. Now redo your display and you'll see that your plot fills the entire window. Here is a sample:




More information about the gradsusr mailing list