[ncl-talk] where function
Dennis Shea
shea at ucar.edu
Thu Jun 7 11:30:45 MDT 2018
In many [?all?] languages, you can not directly test for *NaN* [if
(x.eq.Nan)] You must use a function.
NCL is similar in the way it treats _FillValue. You can not use: if (x.eq.x@
_FillValue)
NCL **requires** the user to use the *ismissing* function to test for
_FillValue
*https://www.ncl.ucar.edu/Document/Functions/Built-in/ismissing.shtml
<https://www.ncl.ucar.edu/Document/Functions/Built-in/ismissing.shtml>*
q = *where*(*ismissing*(x) .and. *.not.ismissing*(y), a, b)
HTH
On Thu, Jun 7, 2018 at 11:14 AM, Laura Fowler <laura at ucar.edu> wrote:
> Hello:
>
> I am trying to make a composite of 2 cloud layers using the where
> function but that does not seem to work. I am attaching the plots
> test.layers_3.pdf and test.layers_7.pdf which are monthly mean values
> of the liquid water paths for the lower cloud layer and the upper
> cloud layer. Both data include missing values (green), but the liquid
> water path for the upper cloud layer contains a lot more missing data
> than the lower cloud layer.
>
> I would like to make a composite of the two layers. So first, I used
> the where function as below:
>
> lw = where(lw_aqua_3.ne.lw_aqua_3 at _FillValue .and.
> lw_aqua_7.ne.lw_aqua_7 at _FillValue, \
> lw_aqua_3+lw_aqua_7,lw_aqua_3 at _FillValue)
>
> where lw_aqua_3 and lw_aqua_7 are the liquid water paths for the lower
> and upper cloud layers, respectively. The plot
> test1.add_layers.pdf show the "total" liquid water path.
>
>
> What I can't seem to be able to do is to fill the missing value of lw
> with lw_aqua_3 where lw_aqua_7 is actually missing and vice versa. So
> I did:
>
> ;lw2 = where(lw_aqua_3.ne.lw_aqua_3 at _FillValue .and.
> lw_aqua_7.eq.lw_aqua_7 at _FillValue, \
> lw_aqua_3,lw)
>
> but that does not work as the plot of lw2 (test1.add_layers.pdf) is
> the same as the plot for lw (since lw is missing where lw_aqua_3 is
> not missing). I also tried to use ismissing but that does not work
> since lw and lw2 are a two dimensional array.
>
>
> Is there a simpler way to compute that kind of composite?
>
> Thanks,
> Laura
>
>
>
>
>
>
>
> --
> !-----------------------------------------------------------
> --------------------------------------------------
> Laura D. Fowler
> Mesoscale and Microscale Meteorology Division (MMM)
> National Center for Atmospheric Research
> P.O. Box 3000, Boulder CO 80307-3000
>
> e-mail: laura at ucar.edu
> phone: 303-497-1628
>
> !-----------------------------------------------------------
> --------------------------------------------------
>
> _______________________________________________
> 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/20180607/a7e9b9b5/attachment.html>
More information about the ncl-talk
mailing list