<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Kunal,<div class="">you can easily achieve that with the <b class=""><font face="Courier" class="">where</font></b> function <a href="http://www.ncl.ucar.edu/Document/Functions/Built-in/where.shtml" class="">http://www.ncl.ucar.edu/Document/Functions/Built-in/where.shtml</a>.</div><div class="">Assuming that <font face="Courier" class="">var</font> is your variable and <font face="Courier" class="">var_mod</font> the new one, you can do this (<font face="Courier" class="">var</font> need an attribute <font face="Courier" class="">_FillValue</font>, which is equivalent to <font face="Courier" class="">NaN</font>):</div><div class=""><br class=""></div><div class=""><pre style="margin-top: 0px; margin-bottom: 0px; padding: 0px; font-size: 13.3333px; line-height: 16px; font-family: courier; border-style: solid; border-width: 0px 0px 15px; border-color: transparent; font-variant-ligatures: normal; font-variant-position: normal; font-variant-numeric: normal; font-variant-alternates: normal; font-variant-east-asian: normal; widows: 1; background-color: rgb(255, 255, 255);" class=""> var_mod = <strong style="margin: 0px; padding: 0px;" class="">where</strong>(var.le.0, <span style="font-size: 13.3333px;" class="">var@_FillValue, var)</span></pre></div><div class=""><div class="">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 :) </div><div class=""><br class=""></div><div class=""><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">Guido Cioni</div><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><a href="http://guidocioni.altervista.org" class="">http://guidocioni.altervista.org</a> </div>
</div>
<br class=""><div><blockquote type="cite" class=""><div class="">On 12 Jun 2016, at 11:16, Kunal Bali <<a href="mailto:kunal.bali9@gmail.com" class="">kunal.bali9@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class=""><div class="">Dear NCL users<br class=""><br class=""></div>I have a file having zero and negative values. I need to replace it with NaN values.<br class=""></div>Could anyone let me know how to do it ?<br class=""><div class=""><div class=""><br class=""></div><div class="">Regards<br clear="all" class=""></div><div class=""><div class=""><div class=""><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr" class=""><div class=""><div dir="ltr" class=""><div class="">Kunal Bali<br class=""></div><br class=""></div></div></div></div></div>
</div></div></div></div>
_______________________________________________<br class="">ncl-talk mailing list<br class=""><a href="mailto:ncl-talk@ucar.edu" class="">ncl-talk@ucar.edu</a><br class="">List instructions, subscriber options, unsubscribe:<br class="">http://mailman.ucar.edu/mailman/listinfo/ncl-talk<br class=""></div></blockquote></div><br class=""></div></body></html>