[gradsusr] Clip Command

Jennifer M Adams jadams21 at gmu.edu
Tue May 30 17:07:23 EDT 2017


Here are some commands and an image that illustrate how ‘set clip’ works with ‘draw’:
ga-> c
ga-> set line 2
ga-> set clip 4 5 1 2
ga-> draw recf 0 0 11 8.5
ga-> gxprint tmp.png

[cid:E160AABD-E5BA-47CF-B5BA-5580545458D4]

—Jennifer




On May 30, 2017, at 4:30 PM, Stephen McMillan <smcmillan at planalytics.com<mailto:smcmillan at planalytics.com>> wrote:

Mike, Jennifer,

Thanks for the illustration Mike--I understood what you did--but it does not accomplish what I'm after.  However, it does give me some ideas for trying something else that may be suitable for automation.

Jennifer, you said user-provided 'set clip' commands...do work as expected with 'draw'.  As I mentioned earlier, I have not yet seen an example of its use (not in Doc Index either).  Could you please provide a simple sample that illustrates how to use it with 'draw'?  I think the example that Mike provided was an alternate to using 'clips'.  Perhaps I simply misunderstood its intended use.

Stephen Mc

On Tue, May 30, 2017 at 3:54 PM, Jennifer M Adams <jadams21 at gmu.edu<mailto:jadams21 at gmu.edu>> wrote:
I looked at the source code, and it’s true that the user-provided ‘set clip’ commands are always overridden with ‘display’, but as Mike F. pointed out, they do work as expected with ‘draw'. I will put this is my list of bugs, but in the meanwhile Mike’s suggestion to draw a few more rectangles on top of your graphic is a good workaround. —Jennifer

On May 30, 2017, at 1:54 PM, Mike Fiorino - NOAA Federal <michael.fiorino at noaa.gov> wrote:

> hi Steve,
>
> now I understand... you'll have to do the clipping by hand using:
>
> 'draw recf xlo xhi ylo yhi'
>
> which fills in a rectangle set by xlo .. to the current 'line' color
>
> here's an example of clipping to a block from x=2.0 to 6.0 and y = 3.0 to 6.0
>
> first display something:
>
> 'd psl*0.01'
>
> then get the dimensions of the plotting area
>
> '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
>
> then:
>
> 'draw recf 0.5 10.5 1.25 3.0'  # xlo for plot is 0.5 and xhi is 10.5
> 'draw recf 6.0 3.00 10.5 7.25' # ylo for plot is 1.25 and xhi is 7.25 -- this is the default parea
> 'draw recf 0.5 3.00 2.00 7.25'
> 'draw recf 2.0 6.00 6.00 7.25'
>
> # -- draw a box
> 'set line 1 0
> 'draw rec 2.0 3.0 6.0 6.0'
>
> here's the plot (ecmwf sea level pressure for 2017052800 analysis -- note the tropical cyclone in the Bay of Bengal (02B)):
>
> <bbknhkmnngojjgok.png>
>
> hope this helps...
>
> best /R Mike
>
> On 5/25/17 3:32 PM, Stephen McMillan wrote:
>> Mike,
>>
>> Thanks for the response, but I don't think you understood what I'm trying to accomplish.
>>
>> Imagine you've displayed a variable, using the default plot area, and it displays across most of North America.  Now, let's say you want to display the same variable, but only including part of the  western US, indicated by the dashed rectangle in attached image.  What I want to do is display the zoomed-in area but fill the screen to the default plot area, not just that part of the screen.
>>
>> If I use 'set parea...' as you suggest, e.g., 'set parea 2.07 3.44 5.35 6.11' I then get the third image shown.  It displays the entirety of the original plot, not the zoomed-in area.
>>
>> I've tried using 'set clip...' with a draw command, but no luck.  Could you send a simple code example to illustrate?  I have yet to see how it's used--the Doc Index doesn't help in that regard.
>>
>> Steve Mc
>>
>> <image.png>
>>
>> <image.png>
>>
>> <image.png>
>>
>> On Wed, May 24, 2017 at 5:52 PM, Mike Fiorino - NOAA Federal <michael.fiorino at noaa.gov> wrote:
>> hi Steve,
>>
>> I only use 'set clip' for 'draw' commands and it does work, but apparently not for 'display' (took a quick look at the source code and it wasn't obvious why it wouldn't for 'display' except that 'set clip' works at the very low level plot commands)
>>
>> have you tried the 'parea' command?  this sets the plot area, e.g.,
>>
>> 'set parea 1 6 3 7'
>> 'd air'
>>
>> note that the labels are outside the parea...
>>
>> best /R Mike
>>
>>
>> On 5/24/17 7:36 PM, Stephen McMillan wrote:
>>> Is the 'set clip' command disabled in GrADS?  I can't get it to work per the Documentation Index instructions.  A search of the User Forum yields no help, but one entry does suggest that it may indeed be disabled without modifying the code.
>>>
>>> For example (file open with variable "air"):
>>>
>>> 'set clip 1 6 3 7'
>>> 'd air'
>>>
>>> Result is a map displayed to the default plot area, not to the "clip" area.  I would normally use 'set mpvals' but cannot get that to work the way I want it, either.
>>>
>>>  I am using v2,1,a2,iga,1 on a Windows 10 PC.  I also cannot get it to work using v2.0.2.oga.2 on a Linux.
>>>
>>> I don't need suggestions on how to crop images outside GrADS.  I know how to do that.
>>>
>>> Stephen McMillan
>>>
>>>
>>>
>>>
>>> ______________________________
>>> _________________
>>> gradsusr mailing list
>>>
>>> gradsusr at gradsusr.org
>>> http://gradsusr.org/mailman/listinfo/gradsusr
>>
>>
>
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr

--
Jennifer Miletta Adams
Center for Ocean-Land-Atmosphere Studies (COLA)
George Mason University




_______________________________________________
gradsusr mailing list
gradsusr at gradsusr.org
http://gradsusr.org/mailman/listinfo/gradsusr

_______________________________________________
gradsusr mailing list
gradsusr at gradsusr.org
http://gradsusr.org/mailman/listinfo/gradsusr

--
Jennifer Miletta Adams
Center for Ocean-Land-Atmosphere Studies (COLA)
George Mason University



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20170530/a5f7bbde/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tmp.png
Type: image/png
Size: 1718 bytes
Desc: tmp.png
Url : http://gradsusr.org/pipermail/gradsusr/attachments/20170530/a5f7bbde/attachment.png 


More information about the gradsusr mailing list