[gradsusr] [BULK] Re: Masking Domain in Grads

Yaqiang Wang yaqiang.wang at gmail.com
Tue Mar 8 02:58:22 EST 2011


Its quite easy to generate a maskout file with the "Ooutput Map Data"
function in MeteoInfo from a polygon shape file.

On Tue, Mar 8, 2011 at 11:04 AM, Arlindo da Silva <dasilva at alum.mit.edu> wrote:
>
>
> On Mon, Mar 7, 2011 at 9:28 PM, Zablone Owiti <zablonowiti at yahoo.com> wrote:
>>
>> Hi Yaqiang,
>> Thanks for the response, but the masking (Blanking) we meant here cannot
>> be handled by the function you  suggested.
>> The objective is to have the contours or shading  restricted within a
>> country or state boundary and NOT to mask out certain values, land or ocean
>> areas.
>> The question is how to generate a blanking file in grads for a given
>> boundary (polygon).
>>
>
> Hmm. I've never done this but here how would go about it. Select a
> rectangular domain and draw contours as usual. Next, get a shapefile with
> polygons describing your states. Next, draw filled polygons (say, color
> white) for each state that you want to mask out --- that is, exclude your
> state of interest. This is not a very elegant solution, but might do the
> trick. Read the shapefile documentation carefully. YMMV.
>    Arlindo
>
>
>
>
>>
>> ________________________________
>> From: Yaqiang Wang <yaqiang.wang at gmail.com>
>> To: Zablone Owiti <zablonowiti at yahoo.com>; GrADS Users Forum
>> <gradsusr at gradsusr.org>
>> Sent: Monday, 7 March 2011 9:55 PM
>> Subject: Re: [gradsusr] [BULK] Re: Masking Domain in Grads
>>
>> maskout function could be used to solve your problem.
>> http://www.iges.org/grads/gadoc/gradfuncmaskout.html
>>
>> On Mon, Mar 7, 2011 at 9:21 PM, Zablone Owiti <zablonowiti at yahoo.com>
>> wrote:
>> > Hi Sujata,
>> >
>> > I have not been able to mask-out or blank a particular boundary (country
>> > or
>> > state) so that the contour or  shading does not spill out of the
>> > boundary
>> > country boundary.
>> > I had earlier  posted this query to Grads Users forum but did  not get a
>> > response.  I hope this time there will be a response from the Grads
>> > Gurus.
>> >
>> > ===================================================
>> > ZABLONE OWITI
>> >
>> > From: Sujata Pattanayak <sujata05 at gmail.com>
>> > To: Zablone Owiti <zablonowiti at yahoo.com>
>> > Cc:
>> > Sent: Monday, 7 March 2011 8:22 PM
>> > Subject: Re: [gradsusr] [BULK] Re: opening text file data
>> >
>> > Hi Zablone,
>> >     I am attaching my model domain. I want to plot certain model
>> > variables
>> > in a particular state (i.e ORISSA) as mentioned in the plot. Can I plot
>> > on a
>> > particular state (like Orissa) and mask the other area.
>> >
>> > regards,
>> > Sujata
>> >
>> > On Mon, Mar 7, 2011 at 5:14 PM, Sujata Pattanayak <sujata05 at gmail.com>
>> > wrote:
>> >
>> > Hi Zablone,
>> >     Thank you very much for your kind help.
>> >
>> > Regards,
>> > Sujata
>> >
>> > On Mon, Mar 7, 2011 at 4:32 PM, Zablone Owiti <zablonowiti at yahoo.com>
>> > wrote:
>> >
>> > Hi Sujata,
>> > You can use the shapefiles (admin98) in Grads to generate State
>> > boundaries
>> > after you display something.
>> > The command is:
>> >> draw shp admin98
>> >  This command is available with Grads V. 2.0.a8 or later. You can get
>> > more
>> > details here: http://opengrads.org/doc/udxt/shape/shape.html
>> >
>> > Hope this will help you
>> >
>> >
>> > ===================================================
>> > ZABLONE OWITI
>> > GRADUATE STUDENT
>> > Nanjing University of Information, Science and Technology
>> > College of Atmospheric Science
>> > Add: 219 Ning Liu Rd, Nanjing, Jiangsu, 21004, P.R. China
>> > Tel: +86-25-58731402
>> > Fax: +86-25-58731456
>> > Mob. 15077895632
>> > Website: www.nuist.edu.cn
>> > ====================================================
>> > "The real art of conversation is not only to say the right thing at the
>> > right time, but also to leave unsaid the wrong thing at the tempting
>> > moment."
>> >
>> >
>> > From: Sujata Pattanayak <sujata05 at gmail.com>
>> > To: Zablone Owiti <zablonowiti at yahoo.com>; GrADS Users Forum
>> > <gradsusr at gradsusr.org>
>> > Sent: Monday, 7 March 2011 1:13 PM
>> > Subject: Re: [gradsusr] [BULK] Re: opening text file data
>> >
>> > Hi Zablone,
>> >     How do you get the state boundaries with GrADS? When I am plotting
>> > through grads, it just display the country boundary.
>> > Can you please help me in this regard??
>> >
>> > Regards,
>> > Sujata
>> >
>> > On Wed, Feb 9, 2011 at 10:39 AM, Zablone Owiti <zablonowiti at yahoo.com>
>> > wrote:
>> >
>> > Dear Ramaphane,
>> > As Muhammad has indicated, the script runs. BUT your Objective is to
>> > plot
>> > the station Locations on the map, with station names. If that is the
>> > case, you need to open  a file (eg. open model.ctl) to set the
>> > environment
>> > (so that you don't get the error massage of No scaling environment) and
>> > display a variable. The trick I normally use so that I get a blank map
>> > is to
>> > set cmin a value higher than the maximum value of the variable (there
>> > could
>> > be a better way of doing this, I hope somebody will point it out). For
>> > example I set cmin 10 before diplaying pr variable in model.ctl.
>> > You also need to zoom in your domain using set lat and set lon.
>> > See attached map(city.png) I have done with the script.
>> >  Hope this will help.
>> >
>> > ===================================================
>> > ZABLONE OWITI
>> > GRADUATE STUDENT
>> > Nanjing University of Information, Science and Technology
>> > College of International Education
>> > Add: 219 Ning Liu Rd, Nanjing, Jiangsu, 21004, P.R. China
>> > Tel: +86-25-58731402
>> > Fax: +86-25-58731456
>> > Mob. 15077895632
>> > Website: www.nuist.edu.cn
>> > ====================================================
>> > "The real art of conversation is not only to say the right thing at the
>> > right time, but also to leave unsaid the wrong thing at the tempting
>> > moment."
>> >
>> >
>> > From: Muhammad Rahiz <muhammad.rahiz at ouce.ox.ac.uk>
>> > To: GrADS Users Forum <gradsusr at gradsusr.org>
>> > Cc:
>> > Sent: Tuesday, 8 February 2011 11:23 PM
>> > Subject: Re: [gradsusr] [BULK] Re: opening text file data
>> >
>> > I am able to run the script. See results below
>> >
>> > lat is -18.38 lon is 21.85 and the city is Shakawe
>> > start is 1
>> > lat is -17.82 lon is 25.15 and the city is Kasane
>> > start is 2
>> > lat is -19.98 lon is 23.42 and the city is Maun
>> > start is 3
>> > lat is -18.55 lon is 25.63 and the city is Pandamatenga
>> > start is 4
>> > lat is -20.52 lon is 26.10 and the city is Sua_Pan
>> > start is 5
>> > lat is -21.42 lon is 25.62 and the city is Letlhakane
>> > start is 6
>> > lat is -21.17 lon is 27.52 and the city is Francistown
>> > start is 7
>> > lat is -21.97 lon is 27.83 and the city is Selibe_Phikwe
>> > start is 8
>> > lat is -23.12 lon is 26.83 and the city is Mahalapye
>> > start is 9
>> > lat is -24.67 lon is 25.92 and the city is SSKA
>> > start is 10
>> > lat is -24.58 lon is 24.80 and the city is Jwaneng
>> > start is 11
>> > lat is -25.47 lon is 25.43 and the city is Good_Hope
>> > start is 12
>> > lat is -26.22 lon is 22.40 and the city is Tsabong
>> > start is 13
>> > lat is -24.02 lon is 21.88 and the city is Tshane
>> > start is 14
>> > lat is -25.27 lon is 23.25 and the city is Werda
>> > start is 15
>> > lat is -21.68 lon is 21.63 and the city is Gantsi
>> > start is 16
>> > lat is -22.38 lon is 26.72 and the city is Serowe
>> > start is 17
>> > lat is -24.38 lon is 25.50 and the city is Molepolole
>> > start is 18
>> > lat is -25.75 lon is 28.20 and the city is Pretoria
>> > start is 19
>> > lat is -33.92 lon is 18.45 and the city is Cape_Town
>> > start is 20
>> > lat is -22.57 lon is 17.10 and the city is Windhoek
>> > start is 21
>> > lat is -17.83 lon is 31.05 and the city is Harare
>> > start is 22
>> > lat is -29.32 lon is 27.48 and the city is Maseru
>> > start is 23
>> > lat is -26.33 lon is 31.13 and the city is Manzini
>> > start is 24
>> > lat is -25.97 lon is 32.58 and the city is Maputo
>> > start is 25
>> > last city is 24
>> > No scaling environment
>> >
>> > This means x is environment and y is
>> > DRAW error: Syntax is DRAW MARK marktype x y size
>> > Non-numeric args to numeric operation
>> >   Error occurred on line 53
>> >   In file city_plot.gs
>> >
>> >
>> > --
>> > Muhammad Rahiz
>> > Researcher & DPhil Candidate (Climate Systems & Policy)
>> > School of Geography & the Environment
>> > University of Oxford
>> >
>> > On Tue, 8 Feb 2011, Galebonwe Ramaphane wrote:
>> >
>> >> Muhammad,
>> >>
>> >> I'm also running GrADS on linux. I have gone over the code several
>> >> times.
>> >> It's one of those annoying problems. I'll attach the sample script and
>> >> the
>> >> text file for your inspection.
>> >>
>> >> Galebonwe Ramaphane
>> >> Department of Meteorological Services
>> >> P.O. BOX 10100
>> >> Gaborone
>> >> Botswana
>> >> Tel: +267 3612200
>> >>  Mobile: +267 74435261
>> >>
>> >>
>> >> -----Original Message-----
>> >> From: gradsusr-bounces at gradsusr.org
>> >> [mailto:gradsusr-bounces at gradsusr.org]
>> >> On Behalf Of Muhammad Rahiz
>> >> Sent: Tuesday, February 08, 2011 10:36 AM
>> >> To: GrADS Users Forum
>> >> Subject: [BULK] Re: [gradsusr] opening text file data
>> >> Importance: Low
>> >>
>> >> Galebonwe,
>> >>
>> >> I'm using GrADS on linux and as far as I know, if your text file is in
>> >> the
>> >> same directory as your script, you don't have to put in the full path.
>> >> I'm not sure if it's different on Windows although I doubt so. I
>> >> presume
>> >> you've checked your code?
>> >>
>> >> Muhammad Rahiz
>> >> Researcher & DPhil Candidate (Climate Systems & Policy) School of
>> >> Geography & the Environment University of Oxford
>> >>
>> >> On Tue, 8 Feb 2011, Galebonwe Ramaphane wrote:
>> >>
>> >>> I have a similar but minor problem. My calling script does not see the
>> >>> text file. I tried putting the text file in the same directory as the
>> >>> calling script. I still failed to read the text file. Do I include the
>> >>> full
>> >>> path of the text file?
>> >>>
>> >>> Galebonwe Ramaphane
>> >>> Department of Meteorological Services
>> >>> P.O. BOX 10100
>> >>> Gaborone
>> >>> Botswana
>> >>> Tel: +267 3612200
>> >>>  Mobile: +267 74435261
>> >>>
>> >>> -----Original Message-----
>> >>> From: gradsusr-bounces at gradsusr.org
>> >>> [mailto:gradsusr-bounces at gradsusr.org] On Behalf Of Muhammad Rahiz
>> >>> Sent: Monday, February 07, 2011 6:32 PM
>> >>> To: GrADS Users Forum
>> >>> Subject: Re: [gradsusr] opening text file data
>> >>>
>> >>> James, you can try the following.
>> >>>
>> >>> *****
>> >>>
>> >>> 'sdfopen ifile.nc'
>> >>>
>> >>> * ttot = number of lines in text file
>> >>> ttot = 755
>> >>> tx = 1
>> >>> while(tx<=ttot)
>> >>> fname ='7hA01.out.txt'
>> >>>  rec = read(fname)
>> >>>  IO = sublin(rec,1)
>> >>>  if(IO = 1)
>> >>>    say fname' > File open error'
>> >>>    'quit'
>> >>>  endif
>> >>>  if(IO = 0)
>> >>>    t1 = subwrd(rec,2)
>> >>>    t2 = subwrd(rec,3)
>> >>>  endif
>> >>> say ''t1' 't2''
>> >>>
>> >>> tx = tx +1
>> >>> endwhile
>> >>>
>> >>> *****
>> >>>
>> >>> --
>> >>> Muhammad Rahiz
>> >>> Researcher & DPhil Candidate (Climate Systems & Policy) School of
>> >>> Geography & the Environment University of Oxford
>> >>>
>> >>> On Mon, 7 Feb 2011, James Ciarlo` wrote:
>> >>>
>> >>>> Hi,
>> >>>> I have several text files such as the one I attached and I need to
>> >>>> open them which GrADS but I cannot understand how to do so. Can
>> >>>> someone help me please?
>> >>>>
>> >>>> James
>> >>>>
>> >>>>
>> >>> _______________________________________________
>> >>> 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
>> >>>
>> >>
>> >
>> >
>> >
>> > _______________________________________________
>> > 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
>> >
>> >
>>
>>
>>
>> --
>> *************************************************
>> Dr. Ya-Qiang Wang
>> Centre for Atmosphere Watch and Services (CAWAS), CMA
>> Chinese Academy of Meteorological Sciences (CAMS)
>> 46, Zhong-Guan-Cun South Avenue
>> Beijing, 100081
>> China
>>
>> yaqiang.wang at gmail.com
>> **************************************************
>>
>>
>>
>>
>> _______________________________________________
>> gradsusr mailing list
>> gradsusr at gradsusr.org
>> http://gradsusr.org/mailman/listinfo/gradsusr
>>
>
>
>
> --
> Arlindo da Silva
> dasilva at alum.mit.edu
>
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr
>
>



-- 
*************************************************
Dr. Ya-Qiang Wang
Centre for Atmosphere Watch and Services (CAWAS), CMA
Chinese Academy of Meteorological Sciences (CAMS)
46, Zhong-Guan-Cun South Avenue
Beijing, 100081
China

yaqiang.wang at gmail.com
**************************************************
-------------- next part --------------
A non-text attachment was scrubbed...
Name: maskout1.jpg
Type: image/jpeg
Size: 126655 bytes
Desc: not available
Url : http://gradsusr.org/pipermail/gradsusr/attachments/20110308/33f68135/attachment-0012.jpg 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: maskout2.jpg
Type: image/jpeg
Size: 33749 bytes
Desc: not available
Url : http://gradsusr.org/pipermail/gradsusr/attachments/20110308/33f68135/attachment-0013.jpg 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: maskout3.jpg
Type: image/jpeg
Size: 18708 bytes
Desc: not available
Url : http://gradsusr.org/pipermail/gradsusr/attachments/20110308/33f68135/attachment-0014.jpg 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: maskout4.jpg
Type: image/jpeg
Size: 121548 bytes
Desc: not available
Url : http://gradsusr.org/pipermail/gradsusr/attachments/20110308/33f68135/attachment-0015.jpg 


More information about the gradsusr mailing list