<div dir="ltr">You can use <a href="http://grmask.gs">grmask.gs</a> script. I used it to mask my country. You have to create a poligon from your country. Here i send you the script, i hope it work.<br><br><br>GrADS script to mask out unwanted areas from the plot (Neatly !).<br>*<br>* Rupa Kumar Kolli, January 11, 1998.<br>* Please report bugs/suggestions to <a href="mailto:kolli@tropmet.ernet.in">kolli@tropmet.ernet.in</a>.<br>*-------------------------------------------------------------------------------<br>* Reads polygon definitions in world coordinates from a text file<br>* and draws filled polygons in black colour.<br>*<br>* Note:<br>*<br>* - Should be called ONLY after displaying a plot in GrADS window.<br>* use 'set mpdraw off' for the plot; map is drawn in this script.<br>*<br>* - This script erases grid lines within the polygons; so if you<br>* want full gridlines, give xlint and ylint as arguments for<br>* this function. Further, use 'set grid off' before calling this.<br>*<br>* - Edit the line 'myfile=' below to change your data file containing<br>* polygon definitions; see data file 'indmask.txt' for format.<br>* Also, edit the line 'set mpdset rupres' to specify the GrADS<br>* map data set on which the polygon definitions are based.<br>*<br>* - For better results, extend your polygons to outside the frame<br>* of interest; clipping to frame is done in the script.<br>*<br>* - If xlint/ylint are not defined, no grid lines are drawn in the<br>* erased areas. If xstart/ystart are not defined, it is assumed that<br>* the tick marks start at the axis minima.<br>*<br>* Syntax (all gridline arguments optional):<br>*<br>* grmask maskfile <mapfile> <xlint> <ylint> <xstart> <ystart><br>*-------------------------------------------------------------------------------<br>function grmask(args)<br>*<br>* This is the input file containing Polyfill Definitions in world coords<br>*<br>myfile=subwrd(args,1)<br>if(myfile='');say 'FATAL ERROR: Please specify maskfile !';return;endif<br>mapfile=subwrd(args,2)<br>if(mapfile='');mapfile='rupres';endif<br>*<br>* This is the map data set on which the above Polyfill Definitions are based<br>* You can create your own GrADS map data sets from ASCII data<br>* Contact me for a FORTRAN program that does this.<br>*<br>'set mpdset 'mapfile<br>*<br>*<br>xlint=subwrd(args,3)<br>ylint=subwrd(args,4)<br>xstart=subwrd(args,5)<br>ystart=subwrd(args,6)<br>*<br>* Get the physical dimensions of the plot frame<br>*<br>'query gxinfo'<br>rec=sublin(result,3)<br>xlo=subwrd(rec,4)<br>xhi=subwrd(rec,6)<br>rec=sublin(result,4)<br>ylo=subwrd(rec,4)<br>yhi=subwrd(rec,6)<br>*<br>* Set fill color to 0 (black) and clip to the current plot frame<br>*<br>'set line 0'<br>'set clip 'xlo' 'xhi' 'ylo' 'yhi<br>*<br>* Get number of Polyfill definition sets from file<br>*<br>ret=read(myfile)<br>if(sublin(ret,1) != 0)<br> ret=read('/usr/local/grads/dat/'%myfile)<br> if(sublin(ret,1) != 0)<br> say 'Error opening Polyfill Define File !'<br> say 'The file causing error is: '%myfile<br> say 'Masking Aborted.'<br> return<br> endif<br> myfile='/usr/local/grads/dat/'%myfile<br>endif<br>nsets=sublin(ret,2)<br>*<br>* Loop over the Polyfill definition sets<br>*<br>isets=1<br>while(isets<=nsets)<br>*<br>* Get number of lines for this set<br>*<br> ret=read(myfile)<br> rec=sublin(ret,2)<br> num=subwrd(rec,2)<br>*<br>* Read each line and concatenate all lines into one string<br>*<br> i=1<br> s=''<br> while(i<=num)<br> ret=read(myfile)<br> rec=sublin(ret,2)<br> s=s%rec<br> i=i+1<br> endwhile<br>*<br>* Convert all pairs of coordinates in the concatenated string from<br>* world coordinates to XY coordinates and concatenate the<br>* XY coordinates into a new string<br>*<br> iw=1<br> m=''<br> wx=subwrd(s,iw)<br> while(wx !='')<br> wy=subwrd(s,iw+1)<br> 'q w2xy 'wx' 'wy<br> x=subwrd(result,3)<br> y=subwrd(result,6)<br> m=m%' '%x%' '%y<br> iw=iw+2<br> wx=subwrd(s,iw)<br> endwhile<br>*<br>* draw a filled polygon<br>*<br> 'draw polyf'm<br> isets=isets+1<br>endwhile<br>*<br>* End loop on sets<br>* Draw the map and frame<br>*<br>'set mpdraw on'<br>'set mpt * -1'<br>'set mpt 0 1 1 4'<br>'set mpt 1 1 1 4'<br>'draw map'<br>'set line 1 1 3'<br>'draw rec 'xlo' 'ylo' 'xhi' 'yhi<br>*<br>* Get world coordinate limits of plot frame to draw grid lines<br>*<br>if(xlint = ''); return; endif<br>'query dims'<br>rec=sublin(result,2)<br>wxlo=subwrd(rec,6)<br>wxhi=subwrd(rec,8)<br>rec=sublin(result,3)<br>wylo=subwrd(rec,6)<br>wyhi=subwrd(rec,8)<br>*<br>* Set line style to dotted line (5)<br>*<br>'set line 1 5 1'<br>*<br>* Draw vertical grid lines from first argument<br>*<br>if(xstart = '' | wxlo=xstart)<br> wgx=wxlo+xlint<br>else<br> wgx=xstart<br>endif<br>while (wgx < wxhi)<br> 'q w2xy 'wgx' 'wylo<br> gx=subwrd(result,3)<br> 'draw line 'gx' 'ylo' 'gx' 'yhi<br> wgx=wgx+xlint<br>endwhile<br>*<br>* Draw horizontal grid lines from second argument<br>*<br>if (ylint != '')<br> if(ystart = '' | wylo=xstart)<br> wgy=wylo+ylint<br> else<br> wgy=ystart<br> endif<br> while (wgy < wyhi)<br> 'q w2xy 'wxlo' 'wgy<br> gy=subwrd(result,6)<br> 'draw line 'xlo' 'gy' 'xhi' 'gy<br> wgy=wgy+ylint<br> endwhile<br>endif<br>*<br>* That's it, return to caller<br>*<br></div><div class="gmail_extra"><br><div class="gmail_quote">2015-01-20 2:31 GMT-03:00 Mandal Raju <span dir="ltr"><<a href="mailto:raju.cat@tropmet.res.in" target="_blank">raju.cat@tropmet.res.in</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
Hi,<br>
<br>
I have a plot of temperature anomaly over the region: lat 0 to 40N<br>
lon 60E to 100E<br>
<br>
But I want to show the values only over Indian sub-continent. So, can anybody help me how to maskout those outside region from the actual plot?<br>
<br>
<br>
<br>
Thanks & Regards....<br>
<br>
Raju Mandal<br>
India<br>
Office: 020 2590 4513<br>
<br>
<br>
_______________________________________________<br>
gradsusr mailing list<br>
<a href="mailto:gradsusr@gradsusr.org">gradsusr@gradsusr.org</a><br>
<a href="http://gradsusr.org/mailman/listinfo/gradsusr" target="_blank">http://gradsusr.org/mailman/listinfo/gradsusr</a><br>
</blockquote></div><br></div>