# [ncl-talk] gc_inout for non-spherical polygons?

Dave Allured - NOAA Affiliate dave.allured at noaa.gov
Mon Nov 9 22:00:11 MST 2015

```Nisha,

Please keep replies on the user list, it helps other people.

With the simple cartesian definition of a rectangle, you can probably use
ordinary coordinate subscripting or array syntax to work with your data
domain.  It depends on what kind of computation you will be applying.
gc_inout is applied specially, often to create a grid mask.  I do not know
what you originally had in mind.

Please look up coordinate subscripting in the user manual.

--Dave

On Mon, Nov 9, 2015 at 8:36 PM, Manisha Ganeshan <
manisha.ganeshan86 at gmail.com> wrote:

> Thanks, Dave!
> I have the second definition in mind. My domain is between 15 to 55 N and
> 110 to 160W, with a 2x2 degree grid box in lat lon cartesian coordinates.
> If gc_inout would not work in this case, I guess I could just use do loops.
>
> -Nisha
>
> On Mon, Nov 9, 2015 at 6:14 PM, Dave Allured - NOAA Affiliate <
> dave.allured at noaa.gov> wrote:
>
>> Nisha,
>>
>> There is more than one way to define a square or rectangle on the surface
>> of the earth.  They are mathematically and geographically different.
>>
>> 1.  You can define a rectangle by its four corner points, with the edges
>> defined as great circle lines between the four corners.  This defines a
>> spherical polygon.  gc_inout is the correct way to handle a polygon defined
>> this way.
>>
>> 2.  You can define a rectangle by its four corner points, connected by
>> straight lines in cartesian coordinate space (i.e. lat/lon space).  A
>> simple example would be the area between 30 to 35 degrees north, and 80 to
>> 100 west.  gc_inout would NOT give correct results for this definition.
>>
>> There may be other ways as well.  A "rectangle" could be defined as a
>> region enclosed by four straight lines, drawn over the surface of the earth
>> in any map projection, of which there are many.
>>
>> Which definition do you have in mind?
>>
>> --Dave
>>
>>
>> On Mon, Nov 9, 2015 at 2:57 PM, Manisha Ganeshan <
>> manisha.ganeshan86 at gmail.com> wrote:
>>
>>> Hi,
>>>
>>> I'm wondering if a function like gc_inout can work for other polygons,
>>> specifically square/rectangle?
>>>
>>> Regards,
>>> Nisha
>>>
>>> --
>>> Dr. Manisha Ganeshan
>>> Universities Space Research Association
>>> Maryland, U.S.A.
>>>
>>
>
>
> --
> Dr. Manisha Ganeshan
> Universities Space Research Association
> Maryland, U.S.A.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20151109/095dc678/attachment.html
```