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

Lyndz olagueralyndonmark429 at gmail.com
Sun Feb 14 22:48:06 MST 2021


Hi Sir Dave,

Works like a charm!

Many thanks.

Lyndz


On Mon, Feb 15, 2021 at 1:04 AM Dave Allured - NOAA Affiliate <
dave.allured at noaa.gov> wrote:

> Here is another method that is more straightforward than counting.  It is
> rather obvious, sorry.  I wish I had thought of this sooner.  Just use the
> min and max values of each domain grid.
>
>     subset = vp(:, {2:25}, {100:130})
>     xmin = dim_min_n (subset, (/ 1,2 /) )
>     xmax = dim_max_n (subset, (/ 1,2 /) )
>
>     has_zero = ((xmin * xmax) .le. 0)
>
> The result is a 1-D array, true or false for each time step.  This is much
> easier to resolve than the counting method.  This also handles missing
> values gracefully.
>
>
> On Sun, Feb 14, 2021 at 9:28 AM Dave Allured - NOAA Affiliate <
> dave.allured at noaa.gov> wrote:
>
>> My mistake, sorry.  I meant to say the function *dim_num_n*, not
>> *dim_sum_n*.
>>
>>
>> On Sun, Feb 14, 2021 at 8:30 AM Lyndz <olagueralyndonmark429 at gmail.com>
>> wrote:
>>
>>> Hi Sir Dave,NCL-experts,
>>>
>>> Thank you for your suggestion. I tried this but encountered a mismatch
>>> error:
>>>
>>> fatal:Argument type mismatch on argument (0) of (dim_sum_n) can not
>>> coerce
>>>
>>>
>>> The printVarSummary() of *subset()* is as follows:
>>>
>>>
>>> Variable: subset
>>>
>>> Type: float
>>>
>>> Total Size: 16120 bytes
>>>
>>>             4030 values
>>>
>>> Number of Dimensions: 3
>>>
>>> Dimensions and sizes: [time | 31] x [lat | 10] x [lon | 13]
>>>
>>> Coordinates:
>>>
>>>             time: [1929912..1930632]
>>>
>>>             lat: [2.5..25]
>>>
>>>             lon: [100..130]
>>>
>>>
>>> I uploaded the files hre (chi_mar_2020.nc):
>>> https://www.dropbox.com/sh/t88oab9txej73u1/AAAkDCcsTC3_eHg8uBc0vhtda?dl=0
>>>
>>> Any idea how to solve this?
>>>
>>> Sincerely,
>>>
>>> Lyndz
>>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20210215/0cf77ce9/attachment.html>


More information about the ncl-talk mailing list