Re: How does the mask function work?

From: gibies george <gibies_at_nyahnyahspammersnyahnyah>
Date: Sun Mar 13 2011 - 22:01:24 MDT

On 14 March 2011 02:01, John Kerfoot <johnkerfoot@gmail.com> wrote:

> I've got a large AVHRR sea-surface temperature dataset for which I'm
> trying to mask out some bad values; however I'm seeing some strange
> (and contradictory) behavior when using the mask function and I'm
> looking for some clarification.
>
> Before getting to the AVHRR dataset, I tried the following to make
> sure that I understood how mask worked:
>
> ; Array to mask
> x = ispan(0,8,1);
> print(x);
>
> ; Mask values
> f = (/1, 1, 1, 2, 2, 2, 3, 3, 3/);
> print(f)
>
> : Mask all corresponding values in x where f is less than 3
> z = mask(x, (f.lt.3), True);
>

 Here the function have Masked all corresponding values in x *except where f
is less than 3*
*
*

> print(z);
>
> I expected the first 6 values of x to be set to the fill value, but
> the opposite happened:
>
> Variable: x
> Type: integer
> Total Size: 36 bytes
> 9 values
> Number of Dimensions: 1
> Dimensions and sizes: [9]
> Coordinates:
> (0) 0
> (1) 1
> (2) 2
> (3) 3
> (4) 4
> (5) 5
> (6) 6
> (7) 7
> (8) 8
>
>
> Variable: f
> Type: integer
> Total Size: 36 bytes
> 9 values
> Number of Dimensions: 1
> Dimensions and sizes: [9]
> Coordinates:
> (0) 1
> (1) 1
> (2) 1
> (3) 2
> (4) 2
> (5) 2
> (6) 3
> (7) 3
> (8) 3
>
>
 Here the function have Masked all corresponding values in x *except where f
is less than 3*
*
*

>
> Variable: z
> Type: integer
> Total Size: 36 bytes
> 9 values
> Number of Dimensions: 1
> Dimensions and sizes: [9]
> Coordinates:
> Number Of Attributes: 1
> _FillValue : -999
> (0) 0
> (1) 1
> (2) 2
> (3) 3
> (4) 4
> (5) 5
> (6) -999
> (7) -999
> (8) -999
>
>
>
> So I'm clearly not understanding how to use this function. Can
> someone explain this result? How can I get all values of x to be
> masked where f is less than 3?
>
> Once I understand this, I'll have a follow up question using the AVHRR
> datset.
>
> thanks in advance,
> John
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>

-- 
*Gibies George,   CSIR-RF,*
*Seasonal Scale Prediction Group,
Climate and Global Modelling Division,
Indian Institute of Tropical Meteorology,
Dr. Homi Bhabha Road,
NCL (P. O.), Pashan,
Pune 411008, India.*
*http://sites.google.com/site/gibiesge/*
Please Think about the environment. Save paper; Save Trees; and don't print
this e-mail unless it is necessary.

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Sun Mar 13 22:01:31 2011

This archive was generated by hypermail 2.1.8 : Wed Mar 16 2011 - 09:22:37 MDT