[Thread Prev][Thread Next][Index]

Re: shift or extend data



Hi Emilie,

My first thought was to use the @sbx transformation, as for example
	let spread = 9*v[l=@sbx:9]
where v is a function that is non-zero only at noon.  It works fine
EXCEPT near the ends where @sbx puts missing values.

A better idea may be to use @fnr to spread the noon values to a range
of hours. The first step is to isolate the noon values and force all
others to be MISSING. Then apply @fnr (the nearest neighbor transform)
with 0 assigned to missing points

Mick

Example:
! Define a test series of noon values
def axis/t="6-jan-2004:04:00":"19-jan-2004:22:00":2 \
        /t0="1-jan-2004:00:00"/units=hours tax
def grid/t=tax grd
let v=int(10*randu(t[g=grd])) ! random integers at all times
! define hour of day (assuming t0 begins at 00:00)
let hour=mod(t[g=grd],24)
! pick off the noon values and make all other values missing
let noon=if(mod(hour,24) eq 12)then v
! define the spread region about noon
let spread=if(hour ge 4 and hour le 20)then noon[l=@fnr] else 0
! check the result
list v,noon,spread

!-------------------------------------------------------------------
On Wed, 6 Oct 2004, Emilie Vanvyve wrote:
> Let's have a variable 'var' with 12 values corresponding to each 2
> hours of a day. They are 0 always, except at noon where it equals 4.
>
> I would like to extend my non-zero value to all other time steps,
> except some:
> 0h:	0
> 2h:	0
> 4h:	4
> 6h:	4
> 8h:	4
> 10h:	4
> 12h:	4
> 14h:	4
> 16h:	4
> 18h:	4
> 20h:	4
> 22h:	0



[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP

Contact Us | Privacy Policy | Disclaimer | Accessibility Statement