How does the mask function work?

From: John Kerfoot <johnkerfoot_at_nyahnyahspammersnyahnyah>
Date: Sun Mar 13 2011 - 14:31:29 MDT

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);
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

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
Received on Sun Mar 13 14:31:36 2011

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