[ncl-talk] how to replace missing value
Kevin Hallock
hallock at ucar.edu
Wed Apr 18 12:01:03 MDT 2018
Hi Ning,
NCL’s where() <https://www.ncl.ucar.edu/Document/Functions/Built-in/where.shtml> and ismissing() <https://www.ncl.ucar.edu/Document/Functions/Built-in/ismissing.shtml> functions should be helpful for this task.
Here’s an example of how you could replace missing values in Y with values from the corresponding index in X:
y = where(.not.ismissing(y), y, x)
This could also be written as:
y = where(ismissing(y), x, y)
I hope this helps,
Kevin
> On Apr 18, 2018, at 7:38 AM, ma.n2007 <ma.n2007 at aliyun.com> wrote:
>
> Hi Sir,
> Imagin that I have two data X and Y, both are with (tim, lat, lon).
> If some grids of Y has missing values, while X does not. How can I replace the missing values in Y with the X grid value? This could fill the Y.
> Could you please help me?
>
> Thanks
> Ning
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu <mailto:ncl-talk at ucar.edu>
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk <http://mailman.ucar.edu/mailman/listinfo/ncl-talk>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180418/704ca73e/attachment.html>
More information about the ncl-talk
mailing list