# Re: setting regions for drawing polygons

```Hi Glenn,
Yes, I understand what you're saying.  Unfortunately, even an abstract
axis has to be in one of the four dimensions, so there are issues if you
have 4-dimensional data.

For the lat and lon, your grid has an abstract axis, and you're right
that if you set a region x=0:160, ferret will just take the first 360 points.
The polygon command uses the VALUES of the variables, not their grid
coordinates which is what's restricted by the SET REGION command.

The basemap.jnl script does not need you to set the region.  It uses

If you do a basemap without using "set region",  you should be able to
call  "go polymark" and see all your lat,lon points.    It should just plot
what is within the area of the basemap.

yes? can region
yes? go basemap x=180:360 y=-40:40
yes? go polymark poly/over lon, lat, sigma

Glenn Carver wrote:

> Ansley,
>
> Thanks for your email. In fact I haven't quite solved my problem yet. I understand your comment about the Z axis. It would be nice if polymark used an 'abstract' axis because with some 4D data (xyzt) data I have I need to specify a region in all axes.
>
> >
> > By the way, before you answered your own question, I thought you were
> > talking about restricting the range of lat and lon
>
> Yes, I was. And I'm still having problems. Basically what I think is happening is that if I try to specify a region for longitude (e.g. set reg/x=0:360), it's intefering with my lon coordinate array. I have lon[i=1:2562] and by setting the x=0:360, it seems that polymark only takes the first 360 points from lon. I can see this by cancelling the region for x and then all the points are plotted. I can set a region for latitude (y) fine, because my data does not use a latitude axis. The i axis is not really longitude but a count of the no. of data points I have.
>
> what I want to do is plot a basemap for a specified region x=180:360,y=-40:40 and only plot the station points within that region (which is why I don't need the masking because my basemap needs to cover the same region).
>
> Somehow I need to set a region to plot a basemap but then tell ferret to use all the station points and only plot the points that lie in the lat/lon region I've set. I was thinking I need an abstract axis that I can put my longitude points on so that ferret doesn't subset it but I've not figured out how to do that yet!
>
> Hope that makes sense!
>
> Regards,
>               GLenn
>
> > -- just while we're on the
> > topic, they could be restricted by setting a mask for sigma:
> >
> >    LET/BAD=999 sigma_restricted = IF(lon GE 200 AND lon LE 250 AND lat GE 0) THEN zpts ELSE 999
> >    GO polymark  POLY  lon, lat, sigma_restricted
> >
> > Ansley
> >
> >
> > Glenn Carver wrote:
> >
> > >
> > > I neglected to mention that sigma is actually sigma[i=1:2562,k=1:40,l=1:400].
> > >
> > > If I set the region for k by set reg/k=1 and then call polymark, it doesn't work.
> > >
> > > Instead if I don't specify a region for k and then do:
> > >   polymark poly/key lon lat sigma[k=1] circle
> > >
> > > it works!  Quite what difference specifying the region this way makes I don't understand.
> > >
> > >  Glenn
> > >
> > > On 2002.02.07 16:28 Glenn Carver wrote:
> > > >
> > > > Is it possible to use a region with the polymark script (or just the polygon command)?
> > > >
> > > > I have a dataset which has three arrays, lon[i=1:2562], lat[i=1:2562] and a value to be plotted at those coords, sigma[i=1:2562]. I want to plot a marker at each (lon,lat) point coloured according to the values in sigma. Polymark.jnl does the job fine for the full lat & long range. But I can't get it or polygon to work if I only want to plot markers over a region.
> > > >
> > > > Unfortunately, although the sequence of points is ordered in some manner I can't simply select a subset of the data. Ideally what I need to do is use set region/x=200:250/y=-30:0 but this doesn't work. I get an error that the number of polygons does not match the data.
> > > >
> > > > Is there a way around this?
> > > >
> > > > Thanks
> > > >            Glenn
> > > >
> > > >
> > > > --
> > > >
> > > > Dr. Glenn Carver, Centre for Atmospheric Science, Univ. of Cambridge,
> > > > Chemistry Dept., Lensfield Road, Cambridge, CB2 1EW, UK.
> > > >
> > > > mailto:Glenn.Carver@atm.ch.cam.ac.uk http://www.atm.ch.cam.ac.uk/~glenn/
> > > > Phone: +44 (1223) 763827      ** please note new numbers **
> > > > Fax:   +44 (1223) 763823
> > > >
> > > >
> > > --
> > >
> > > Dr. Glenn Carver, Centre for Atmospheric Science, Univ. of Cambridge,
> > > Chemistry Dept., Lensfield Road, Cambridge, CB2 1EW, UK.
> > >
> > > mailto:Glenn.Carver@atm.ch.cam.ac.uk http://www.atm.ch.cam.ac.uk/~glenn/
> > > Phone: +44 (1223) 763827      ** please note new numbers **
> > > Fax:   +44 (1223) 763823
> >
> > --
> > Ansley Manke  Pacific Marine Environmental Laboratory  Seattle WA  (206)526-6246
> >
> >
> >
> --
>
> Dr. Glenn Carver, Centre for Atmospheric Science, Univ. of Cambridge,
> Chemistry Dept., Lensfield Road, Cambridge, CB2 1EW, UK.
>
> mailto:Glenn.Carver@atm.ch.cam.ac.uk http://www.atm.ch.cam.ac.uk/~glenn/
> Phone: +44 (1223) 763827      ** please note new numbers **
> Fax:   +44 (1223) 763823

--
Ansley Manke  Pacific Marine Environmental Laboratory  Seattle WA  (206)526-6246

```