[ncl-talk] missing values in multidimensional array

Dennis Shea shea at ucar.edu
Wed May 17 12:17:04 MDT 2017


To me, the question is ambiguous. Are you looking for the subscripts and
time/locations where _FillValue occur?

https://www.ncl.ucar.edu/Document/Functions/Built-in/ind.shtml
https://www.ncl.ucar.edu/Document/Functions/Built-in/ind_resolve.shtml
https://www.ncl.ucar.edu/Document/Functions/Built-in/ndtooned.shtml

x(time,lat,lon)

if (*any* <https://www.ncl.ucar.edu/Document/Functions/Built-in/num.shtml>(*ismissing*(x)))
then
      nmsg = num(ismissing(x))
      print("nmsg="+nmsg)

      x1D = *ndtooned*
<https://www.ncl.ucar.edu/Document/Functions/Built-in/ndtooned.shtml>(x)
      i1D = *ind*
<https://www.ncl.ucar.edu/Document/Functions/Built-in/ind.shtml>(*ismissing*(x1D))
      i   = *ind_resolve*(i1D, *dimsizes*
<https://www.ncl.ucar.edu/Document/Functions/Built-in/dimsizes.shtml>(x)
)
      printVarSummary(i)

 *     print* <https://www.ncl.ucar.edu/Document/Functions/Built-in/print.shtml>(x&time(i(:,0))
+"  "+ x&lat(i(:,1)) +"  "+x&lon(i(:,2)) )
      *delete* <https://www.ncl.ucar.edu/Document/Functions/Built-in/delete.shtml>([/
x1D, i1D/]))     ; no longer needed
else

      print("There are no _FillValue"))

end if

--
Other possibly useful functions:

https://www.ncl.ucar.edu/Document/Functions/Built-in/where.shtml
https://www.ncl.ucar.edu/Document/Functions/Built-in/ndtooned.shtml
---

There is a very useful NCL tutorial at:

https://www.ncl.ucar.edu/Document/Manuals/NCL_User_Guide/

Good luck

On Wed, May 17, 2017 at 11:50 AM, Marston Johnston <shejo284 at gmail.com>
wrote:

> Hi Nisha,
>
>
>
> It depends on what you mean by missing values. For example ncl “mask” can
> set a range or specific values to _FillValue and then NCl will ignore these
> values.
>
> E.g:
>
>
>
> a3d_FillValue = default_fillvalue("float")
>
> a3d = mask(a3d,a3d.eq.missing_value,False) or a3d =
> mask(a3d,a3d.lt.value,False)
>
> printVarInfo(a3d,”a3d”) should give you the max and min excluding
> _FillValues.
>
>
>
> This will mask out the 3d array for the range or value you dictate.
>
> You can also use NCL where to do what you want.
>
>
>
> Hope this helps,
>
> /M
>
>
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> Marston S. Johnston, PhD
>
> Department of Earth Sciences
>
> University of Gothenburg, Sweden
>
> Email: marston.johnston at gu.se
>
> SkypeID: marston.johnston
>
> Phone: +46-31-7864901 <+46%2031%20786%2049%2001>
>
> Only the fruitful thing is true!
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
>
>
>
>
> *From: *<ncl-talk-bounces at ucar.edu> on behalf of Manisha Ganeshan <
> manisha.ganeshan86 at gmail.com>
> *Date: *Wednesday, 17 May 2017 at 19:32
> *To: *NCL-talk <ncl-talk at ucar.edu>
> *Subject: *[ncl-talk] missing values in multidimensional array
>
>
>
> Hello NCLers,
>
>
>
> Is there a function to find the missing values across a single dimension
> in a 3D array? I mean without going through a double do loop.
>
>
> Regards,
>
> Nisha
>
>
>
> --
>
> Dr. Manisha Ganeshan
>
> Universities Space Research Association
>
> Maryland, U.S.A.
>
> _______________________________________________ ncl-talk mailing list
> ncl-talk at ucar.edu List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
> _______________________________________________
> 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/20170517/0c71cc9b/attachment.html 


More information about the ncl-talk mailing list