[Thread Prev][Thread Next][Index]

Re: How to mask the data



Hi Yogesh,
            Masking a variable with respect to particular value/values 
of another variable is a straight forwad case if both variables are on the
same grid. In your case "nchan" and "CO2_sat" are on the same grid..so 
just use an IF condition to mask values corresponding to nchan other than
18. Now to get the masked variable to a proper grid, time in your case,
is bit tricky..since there will be lot of undefined points for the masked
variable. Then the idea is to remove those missing values and put the
masked variable onto a new proper time axis. Please go thorugh the example 
below. If you need any more clarification let me know.

Hope this helps

With Regards

Jaison 

!--------------mask.jnl--------------------
\ cancel mode verify

! let us create some dummy data defined over a time axis

     let vdata = TSEQUENCE({2,3,18,4,5,2,16,6,9,7,11,8,18,9,10,15,18})
     define axis/t="01-JAN-2001:00":"17-JAN-2001:00":1/unit=days/\
        T0="31-DEC-2000:00"   tax

     let nchan     = vdata[GT=tax@ASN]  ! take as your variable "nchan"
     let CO2_sat   = sin(nchan)         ! take as your variable "CO2_sat"

! now we need to get the CO2_sat when nchan is 18. Since you want to
!   make plots (ie. timeseries), it will be better to get the "L" indices
!   where the nchan is 18 and then sample CO2_sat along this indices. Also
!   get the "time" data corresponding to this indices to define a time 
axis
!   "without" missing values

     let l_only_18 =  IF nchan EQ 18 THEN L[GT=CO2_sat]
     list l_only_18, nchan

     ! now remove the missing values by "COMPRESSING" it
     ! and taking only the good values

     let l_only_18_com = COMPRESSL(l_only_18)
     list l_only_18_com
     let l_only_18_good = l_only_18_com[L=1:`l_only_18_com[l=@NGD]`]
     list l_only_18_good

     ! now sample along these indices, both var and t[gt=var]

     let CO2_sat_only_18 = SAMPLEL(CO2_sat,l_only_18_good)
     let t_data_18       = SAMPLEL(t[gt=CO2_sat],l_only_18_good)

     list CO2_sat_only_18, t_data_18  

     ! now define a time axis with the sampled values with same units and
     ! T0 as for the time axis of the variable CO2_sat

     define symbol t_zero  = `CO2_sat,r=T0`
     define symbol t_units = `CO2_sat,r=tunits`

     DEFINE axis/t/units=($t_units)/T0="($t_zero)"/from_data tax18=t_data_18

     let CO2_sat_18 = CO2_sat_only_18[GT=tax18@ASN]  ! assign the new time axis

     list CO2_sat_18       ! our final variable
     list CO2_sat, nchan   ! for cross checking with starting data

     ! now the variable is on proper time axis and defined only for nchan=18
     !  case ..do plotting..or anything you want to do...

!-----end of mask.jnl----------------------

On Mon, 6 Dec 2004, Yogesh K. Tiwari wrote:

> Hello Ferret Users,
> 
> I have point data which looks in ferret as :-
> 
> 
> title         I        J      K        L
> 
> CO2_sat      --       --      --    1:1860206
> 
> nchan        --       --      --    1:1860206
> 
> lat          --       --      --    1:1860206
> 
> lon          --       --      --    1:1860206
> 
> time         --       --      --    1:1860206
> 
> 
> Here the values of the variable 'nchan'(number of channel) is varying 
> between 2 to 18.
> 
> Now my problem is :-
> 
> I want to plot the co2_sat with other variables when nchan=18 only
> and rest values I want to mask.
> 
> Is it possible to do this inside the ferret ?
> 
> Many thanks in advance for the help.
> 
> Regards,
> Yogesh
> 
> 
> 
> 

-- 
___________________________________________________

    Jaison Kurian                           
    Centre for Atmospheric and Oceanic Sciences
    Indian Institute of Science
    B A N G A L O R E   560 012
    Ph: +91-80-3942505
        +91-80-3600450
    Fax:+91-80-3600865
___________________________________________________



[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP

Contact Us | Privacy Policy | Disclaimer | Accessibility Statement