[ncl-talk] Getting dates when a specific contour line is within a region

Dave Allured - NOAA Affiliate dave.allured at noaa.gov
Sun Feb 14 07:42:06 MST 2021


The question is whether the zero contour line is within a certain grid
domain.  This can be approximated by checking whether the domain contains a
mixture of grid points both above and below zero.  If there is a mix, then
there is a zero contour line somewhere in the domain.

One way to do this is to count the number of grid points greater than zero,
and also the number of grid points less than zero.  See documentation for
the *dim_sum_n* function.

    subset = vp(:, {2:25}, {100:130})
    above = dim_sum_n ( (subset.gt.0), (/ 1,2 /) )
    below = dim_sum_n ( (subset.lt.0), (/ 1,2 /) )

This gives you two count arrays above(time) and below(time).  At each time
step, if there is no zero crossing, then one of the two counts should be
zero, and the other count should be the total number of grid points in the
domain.  Anything else means that there is at least one zero crossing
within the domain.

This method also works for irregularly shaped regions defined by a polyline
loop, or a shapefile.


On Sun, Feb 14, 2021 at 2:17 AM Lyndz via ncl-talk <
ncl-talk at mailman.ucar.edu> wrote:

> Dear NCL-experts,
>
> I am calculating the velocity potential using the attached script:
> The U and V components of winds both have the following dimensions:
>
> Dimensions and sizes: [time | 31] x [lat | 73] x [lon | 144]
>
>
> I uploaded the files here:
>
> https://www.dropbox.com/sh/t88oab9txej73u1/AAAkDCcsTC3_eHg8uBc0vhtda?dl=0
>
>
>
> (a) Is it possible to get all of the dates whenever the *0 *contour line
> is within the domain (100-130E,2-25N) of the plot using NCL? See attached
> plot for the March 15 2020 case.
>
>
> If possible, I would like to ask how to do this in NCL.
>
>
> I'll appreciate any help on this.
>
>
>
> Sincerely,
>
>
> Lyndz
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20210214/8aa708ea/attachment.html>


More information about the ncl-talk mailing list