Hi all, I think Jaison has the right idea for why Sindu was getting unexpected results.  The samplexy function assumes that arguments 2 and 3 are simple 1-Dimensional lists of values, independent of time.  yes? show func/details samplexy SAMPLEXY(DAT_TO_SAMPLE,XPTS,YPTS)     Returns data sampled at a set of (X,Y) points, using linear interpolation         Axes of result:           X: ABSTRACT (result will occupy indices 1...N)           Y: NORMAL (no axis)           Z: inherited from argument(s)           T: inherited from argument(s)     DAT_TO_SAMPLE: variable (x,y,z,t) to sample         Influence on output axes:           X: no influence (indicate argument limits with "[]")           Y: no influence (indicate argument limits with "[]")           Z: passed to result grid           T: passed to result grid     XPTS: X values of sample points         Influence on output axes:           X: no influence (indicate argument limits with "[]")           Y: no influence (indicate argument limits with "[]")           Z: no influence (indicate argument limits with "[]")           T: no influence (indicate argument limits with "[]")     YPTS: Y values of sample points         Influence on output axes:           X: no influence (indicate argument limits with "[]")           Y: no influence (indicate argument limits with "[]")           Z: no influence (indicate argument limits with "[]")           T: no influence (indicate argument limits with "[]") And Jaison's solution with a REPEAT loop looks like a good one; you could alternatively write a netcdf file, defining the variables on the time axis of the variable long, and appending in time within the repeat loop. Ansley jaison@xxxxxxxxxxxxxx wrote: ```Hi, The reason for the difference between two sampling is the nature in which SAMPLEXY works. - SAMPLEXY sample values from the source data, for all given pairs of xpt and ypt, for each time and depth points of the given time-depth region. When the xpts and ypts are 1-D vectors, there is no way to control SAMPLEXY such that, it samples at first xpt,ypt pair from first time-point of source data, and at second xpt,ypt pair from second time-point etc. A simple solution is to do the sampling within a REPEAT loop for every day, and write the results immediately to a text file, and read it back. An example using a monthly data (monthly_navy_winds) is shown below, which has been reported to work well for Sindu's question. See User Manual Ch3 Sec2.3.34. SAMPLEXY for more details. It should be noted that the ideal form of xpts and ypts is variables defined on X or Y axes, instead of Z or T. Thanks and Regards, Jaison !---------example starts here----------------------------------------------- \ cancel mode verify use monthly_navy_winds let long = 80 + SIN(t[gt=uwnd]) let latd = 15 + SIN(t[gt=uwnd]) ! get starting and ending L-values for two periods, based on wind data ! (there is no need to give the hh:mm:ss for daily data, unless the ! hr value is 12). define symbol ts1 = 15-APR-1988 ; let ls1 = `t[gt=uwnd,t=(\$ts1)],r=lstart` define symbol te1 = 15-JUN-1988 ; let le1 = `t[gt=uwnd,t=(\$te1)],r=lstart` define symbol ts2 = 15-MAY-1988 ; let ls2 = `t[gt=uwnd,t=(\$ts2)],r=lstart` define symbol te2 = 15-JUN-1988 ; let le2 = `t[gt=uwnd,t=(\$te2)],r=lstart` let lsz1 = le1 - ls1 + 1 let lsz2 = le2 - ls2 + 1 ! Use the L-values to constrain sampling along XY, and write results to ! intermediate text files. Use the date-string without hh:mm:ss, as ! the wind data can be daily mean in practice ! ! Add a list or save command to save the wind speed and/or lon, lat variables ! to a text file set list/precision=7 sp rm -f wind_per1.txt say sp echo " Date Lon Lat Wind (m/s)" > wind_per1.txt sp echo " -------------------------------------------" >> wind_per1.txt REPEAT/RANGE=`ls1`:`le1`:1/NAME=tt (;\ define symbol ll = `tt` ;\ let date = SUBSTRING("`t[gt=uwnd,d=1,l=(\$ll)],r=tstart`",1,11) ;\ let xpt = long[t="`date`"] ;\ let ypt = latd[t="`date`"] ;\ let wspd = SAMPLEXY(uwnd[d=1,t="`date`"],`xpt`,`ypt`) ;\ say " Period 1 : L-point = `(\$ll)-ls1+1`/`lsz1` : Lon = `xpt,p=6` Lat = `ypt,p=6` Wind = `wspd,p=6`" ;\ sp echo " `date` `xpt,p=7` `ypt,p=7` `wspd,p=7`" >> wind_per1.txt ;\ ) sp rm -f wind_per2.txt say sp echo " Date Lon Lat Wind (m/s)" > wind_per2.txt sp echo " -------------------------------------------" >> wind_per2.txt REPEAT/RANGE=`ls2`:`le2`:1/NAME=tt (;\ define symbol ll = `tt` ;\ let date = SUBSTRING("`t[gt=uwnd,d=1,l=(\$ll)],r=tstart`",1,11) ;\ let xpt = long[t="`date`"] ;\ let ypt = latd[t="`date`"] ;\ let wspd = SAMPLEXY(uwnd[d=1,t="`date`"],`xpt`,`ypt`) ;\ say " Period 2 : L-point = `(\$ll)-ls2+1`/`lsz2` : Lon = `xpt,p=6` Lat = `ypt,p=6` Wind = `wspd,p=6`" ;\ sp echo " `date` `xpt,p=7` `ypt,p=7` `wspd,p=7`" >> wind_per2.txt ;\ ) say ! how to read these ascii files? here is the best way to do that (for daily ! data) ! (time axis calendar should match with that of wind and lon/lat) ! ! define axis/t="(\$ts1)":(\$te1)":1/units=days/T0=31-DEC-1989 tper1 ! define grid/t=tper1 gfile ! FILE/grid=gfile/skip=2/format=delimited/delimiter="\b"/\ ! type="text,num,num,num"/var="-,-,-,wind" wind_per1.txt ! list wind !---------example ends here------------------------------------------------- ``` ```Thank you Jaison, Please see the script I used to pick out winds from QSCAT 2006. I've copied it from the original; it doesnt give any errors while running in ferret. The version I use is Ferret 6.00 The time axis for Latitude & Longitude is 21-JUL-2005 to 10-AUG-2007, out which I select my region of interest, 2006. Wind has values from Jan-Dec 2006. Latitude, Longitude & wind are daily data. ----- let xpts_jandec = long[d=1,t="01-jan-2006:00:00":"31-dec-2006:00:00"] let ypts_jandec = latd[d=1,t="01-jan-2006:00:00":"31-dec-2006:00:00"] let winds_jandec = SAMPLEXY(ws,xpts_jandec,ypts_jandec) let xpts_mayoct = long[d=1,t="01-may-2006:00:00":"31-oct-2006:00:00"] let ypts_mayoct = latd[d=1,t="01-may-2006:00:00":"31-oct-2006:00:00"] let winds_mayoct = SAMPLEXY(ws,xpts_mayoct,ypts_mayoct) ---- 2. The variables winds_jandec & winds_jandec, have the following grids: yes? sh da name title I J K L WINDS_JANDEC SAMPLEXY(WS,XPTS_JANDEC,YPTS_JA 1:365 ... ... 1:365 (T=31-DEC-2005 12:00:31-DEC-2006 12:00) WINDS_MAYOCT SAMPLEXY(WS,XPTS_MAYOCT,YPTS_MA 1:184 ... ... 1:365 (T=31-DEC-2005 12:00:31-DEC-2006 12:00) 3. The difference in winds_mayoct & winds_jandec (when i=1 is chosen) is shown below. yes? li/t="01-may-2006:00:00":"08-may-2006:00:00" winds_jandec[i=1],winds_mayoct[i=1] Column 1: WINDS_JANDEC is SAMPLEXY(WS,XPTS_JANDEC,YPTS_JANDEC) Column 2: WINDS_MAYOCT is SAMPLEXY(WS,XPTS_MAYOCT,YPTS_MAYOCT) WINDS_JANDEC WINDS_MAYOCT 01-MAY-2006 00 / 121: 2.159 4.868 02-MAY-2006 00 / 122: 2.909 4.673 03-MAY-2006 00 / 123: 3.565 4.913 04-MAY-2006 00 / 124: 4.141 5.081 05-MAY-2006 00 / 125: 4.918 5.536 06-MAY-2006 00 / 126: 5.265 5.638 07-MAY-2006 00 / 127: 5.223 5.834 08-MAY-2006 00 / 128: 6.139 6.394 Additionally, the longitude & latitude values for the corresponding days are: 01-MAY-2006 00 / 285: 88.79 15.40 02-MAY-2006 00 / 286: 88.74 15.42 03-MAY-2006 00 / 287: 88.71 15.45 04-MAY-2006 00 / 288: 88.67 15.47 05-MAY-2006 00 / 289: 88.64 15.50 06-MAY-2006 00 / 290: 88.60 15.53 07-MAY-2006 00 / 291: 88.56 15.55 08-MAY-2006 00 / 292: 88.52 15.57 Both xpts_jandec & xpts_mayoct (ypts_jandec & ypts_mayoct) list the same values. Hope the problem is better conveyed this time. thanks Sindu On Fri, 4 Jul 2008, jaison@xxxxxxxxxxxxxx wrote: ``` ```Hi Sindu, Setting region/selecting xpts and ypts along time for SAMPLEXY input should work just fine, unless and otherwise there is something wrong with your time axis (or it can be a bug with SAMPLEXY...but hold on...). However, I will be really surprised if the given script has worked without any error. Because : 1. Ferret (or any similar tools) will not allow minus sign (-) in variable name, since it is a "special operator/symbol". Ferret refers such names as "illegal" (please see user manual, Ch3 Sec1.2. File variables, for example), as shown below yes? let xpts_jan-dec = 100 **ERROR: command syntax: illegal name: XPTS_JAN-DEC yes? 2. The time region syntax is wrong (double quotes are not closed). So, please do the following : - make sure the time axes of lon, lat and wind variables are ok, and matches well (number of points, dates etc.) - define variables without minus sign (xpts_dec2jan, ypts_dec2jan.....) - demonstrate the error with listing few values - send a mail back with all details, demonstrating the error. If you are providing lines from your script, please make sure that you are making an exact copying. With these details, we can have a better idea about the problem....and a better solution! Thanks and Regards, Jaison ``` ```Dear Ferreters, I'm facing a problem with the function SAMPLEXY as I use it to pick out values from a gridded dataset (eg wind speed). I have xpts and ypts from Jan-Dec and I select the lat,lon points in 2 ways: 1) Jan-Dec and 2) May-Oct. The wind values I obtain when I select xpts & ypts from Jan-Dec are different from when they are selected only for May-Oct. Please see my script below. 1. Why isnt the wind during May-Oct in both cases identical? & 2. Why does the May-Oct selection give me wind data from Jan-Dec? Am I missing something important while selecting the lat and lon points in time and using it in combination with SAMPLEXY ? Thanks Sindu ------ script----------------------------------------------- let xpts_jan-dec = longitude[t="01-jan-2006:00:00":"31-dec-2006:00:00] let ypts_jan-dec = latitude[t="01-jan-2006:00:00":"31-dec-2006:00:00] let winds_jan-dec = SAMPLEXY(wind,xpts_jan-dec,ypts_jan-dec) let xpts_may-oct = longitude[t="01-may-2006:00:00":"31-oct-2006:00:00] let ypts_may-oct = latitude[t="01-may-2006:00:00":"31-oct-2006:00:00] let winds_may-oct = SAMPLEXY(wind,xpts_may-oct,ypts_may-oct) ------ script----------------------------------------------- Sindu Raj Parampil Ph.D Student Centre for Atmospheric and Oceanic Sciences Indian Institute of Science Bangalore-12 INDIA ========================================================================= "You don't understand anything until you learn it more than one way." Marvin Minsky, 'The Society of Mind' ========================================================================= ``` ``` ``` ```-- Sindu Raj Parampil Ph.D Student Centre for Atmospheric and Oceanic Sciences Indian Institute of Science Bangalore-12 INDIA ========================================================================= "You don't understand anything until you learn it more than one way." Marvin Minsky, 'The Society of Mind' ========================================================================= -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ``` ``` ```