[ncl-talk] Errors using get_isolines and area_poly_sphere together

Rick Brownrigg brownrig at ucar.edu
Mon Apr 29 10:44:16 MDT 2019


Thanks to Rashed for replying here. However, I'm not sure
get_unique_values() will do the job, as it expects a 1D array, and what
Philippe needs is something to weed out duplicates in both lon *and* lat.
In looking around, I don't see an NCL function that will do this -- it
might likely involve writing a loop to do this yourself. I don't know if
one can simply replace any found duplicates with _FillValue and get correct
behavior, or if one must actually remove the duplicates from the array.



On Mon, Apr 29, 2019 at 6:58 AM Rashed Mahmood <rashidcomsis at gmail.com>
wrote:

> Hi Philippe,
> I think, it makes sense to expect two same lat or lon for a circle since
> at two different longitudes there could be possibility of getting two
> latitudes and vice versa. To get unique values, you can use the following
> function:
> For example:
>
>  y:= get_unique_values(y)
>
>
> https://www.ncl.ucar.edu/Document/Functions/Built-in/get_unique_values.shtml
>
> Cheers,
> Rashed
>
>
>
>
>
>
>
>
>
>
> On Fri, Apr 26, 2019 at 2:51 PM Philippe Papin <pppapin at gmail.com> wrote:
>
>> Hi All,
>>
>> I've been running into an issue from the combined usage of the
>> "get_isolines" and "area_poly_sphere" functions. First, I'm using
>> get_isolines to isolate a contour that completes loop around some location
>> on the globe. Then I want to find the area within that contour.
>>
>> What I've noticed is that occasionally (not always) the get_isolines
>> function will find a contour with multiple identical lat,lon pairs for the
>> given contour. This is problematic for the area_poly_sphere code which
>> requires unique vertex points as far as I can tell.
>>
>> Is there anyway to avoid get_isolines from providing identical lat,lon
>> points for a unique contour? If not, is there a function I could use to
>> remove non-unique lat,lon pairs?
>>
>> Here is a print out snippet of the relevant get_isolines output of what
>> I'm trying to avoid (see index values 212,213).
>>
>> Variable: x
>>
>> Type: float
>>
>> Total Size: 2452 bytes
>>
>>             613 values
>>
>> Number of Dimensions: 1
>>
>> Dimensions and sizes: [points | 613]
>>
>> Coordinates:
>>
>> Number Of Attributes: 5
>>
>>   n_points : ( 4, 613, 29, 7, 21, 41, 38, 45, 29 )
>>
>>   start_point : ( 0, 4, 617, 646, 653, 674, 715, 753, 798 )
>>
>>   segment_count : 9
>>
>>   level : 2
>>
>>   _FillValue : 9.96921e+36
>>
>>
>> (211) 17.06323
>>
>> (212) 16
>>
>> (213) 16
>>
>> (214) 14.94309
>>
>> (215) 13.88631
>>
>> Variable: y
>>
>> Type: float
>>
>> Total Size: 2452 bytes
>>
>>             613 values
>>
>> Number of Dimensions: 1
>>
>> Dimensions and sizes: [points | 613]
>>
>> Coordinates:
>>
>> Number Of Attributes: 5
>>
>>   n_points : ( 4, 613, 29, 7, 21, 41, 38, 45, 29 )
>>
>>   start_point : ( 0, 4, 617, 646, 653, 674, 715, 753, 798 )
>>
>>   segment_count : 9
>>
>>   level : 2
>>
>>   _FillValue : 9.96921e+36
>>
>>
>> (211) 69.65783
>>
>> (212) 69.83716
>>
>> (213) 69.83716
>>
>> (214) 70.0269
>>
>> (215) 70.21735
>>
>> It seems like the code is outputting an unnecessary extra lat,lon pair at
>> 69.83716 N, 16E. Why does this happen, and how can I avoid this for
>> accurate spherical area calculations?
>>
>> Thanks,
>> Philippe
>> --
>>
>> -------------------------------------
>> Philippe P. Papin, Ph.D.
>> NRC Research Associate
>> Global Modeling Division
>> Naval Research Laboratory - Monterey, CA
>> http://www.atmos.albany.edu/student/ppapin/
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190429/1c14f662/attachment.html>


More information about the ncl-talk mailing list