[ncl-talk] replace_zerovalue_or_negativevalue_to_NaN
Guido Cioni
guidocioni at gmail.com
Sun Jun 12 04:26:32 MDT 2016
Kunal,
you can easily achieve that with the where function http://www.ncl.ucar.edu/Document/Functions/Built-in/where.shtml <http://www.ncl.ucar.edu/Document/Functions/Built-in/where.shtml>.
Assuming that var is your variable and var_mod the new one, you can do this (var need an attribute _FillValue, which is equivalent to NaN):
var_mod = where(var.le.0, var at _FillValue, var)
There’s a method to do the same in CDO and NCO but it is more complicated. If you just need the variable in NCL I would suggest you to use the where function, while if you need to write another file you can try to load it in NCL with the “w” option. If that doesn’t work then you will have to use CDO and NCO, but that would be a question not relevant to ncl-talk :)
Guido Cioni
http://guidocioni.altervista.org <http://guidocioni.altervista.org/>
> On 12 Jun 2016, at 11:16, Kunal Bali <kunal.bali9 at gmail.com> wrote:
>
> Dear NCL users
>
> I have a file having zero and negative values. I need to replace it with NaN values.
> Could anyone let me know how to do it ?
>
> Regards
> Kunal Bali
>
> _______________________________________________
> 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/20160612/1cd8fbd5/attachment.html
More information about the ncl-talk
mailing list