[Thread Prev][Thread Next][Index]

Re: [ferret_users] Bug in sampleXY....?



Hi Paul,
Thank you for the report. You're right. There is code in SAMPLEXY that's intended to handle this situation but it isn't quite right.  Of course you can work around it by adding or subtracting 360 from the longitudes as needed:
yes? use coads_climatology
yes? let x1pts = {160,180,-20}
yes? let ypts = {0,0,0}

yes? cancel mode lon
yes? let x2pts = if x1pts lt `sst,return=xstart` then x1pts+360 else x1pts
yes? let xpts  = if x1pts gt `sst,return=xend` then x2pts-360 else x2pts

yes? set mode lon

yes? let dat = samplexy(sst,xpts,ypts)
yes? list dat
Ansley

On 6/20/2012 12:31 PM, Paul Young wrote:
Hi all,

I've had a couple of issues with sampleXY that I thought I should report. (Sorry if this has been noted, but I can't seem to access the email archives on the website)

1. Longitudes cannot be negative it seems (i.e. negative degrees_east). E.g., with coads_climatology:

yes? let dat = samplexy(sst,{160,180,-20},{0,0,0})				!3rd longitude is 20W
yes? list dat
            VARIABLE : SAMPLEXY(SST,{160,180,-20},{0,0,0})
            FILENAME : coads_climatology.cdf
            FILEPATH : /usr/local/ferret/data/
            SUBSET   : 3 by 12 points (X-TIME)
                     1      2      3    
                     1      2      3
16-JAN      /  1:  29.09  28.36   ....
15-FEB      /  2:  29.09  28.38   ....
17-MAR      /  3:  29.01  28.00   ....
16-APR      /  4:  29.14  27.99   ....
16-MAY      /  5:  29.19  28.41   ....
16-JUN      /  6:  29.36  28.23   ....
16-JUL      /  7:  29.00  28.52   ....
16-AUG      /  8:  29.06  28.51   ....
15-SEP      /  9:  29.24  28.26   ....
16-OCT      / 10:  29.04  28.33   ....
15-NOV      / 11:  29.07  28.76   ....
16-DEC      / 12:  29.04  28.27   ....


yes? let dat = samplexy(sst,{160,180,340},{0,0,0})					!Convert 3rd longitude to positive value
yes? list dat
            VARIABLE : SAMPLEXY(SST,{160,180,340},{0,0,0})
            FILENAME : coads_climatology.cdf
            FILEPATH : /usr/local/ferret/data/
            SUBSET   : 3 by 12 points (X-TIME)
                     1      2      3    
                     1      2      3
16-JAN      /  1:  29.09  28.36  26.90
15-FEB      /  2:  29.09  28.38  27.42
17-MAR      /  3:  29.01  28.00  27.87
16-APR      /  4:  29.14  27.99  28.14
16-MAY      /  5:  29.19  28.41  27.63
16-JUN      /  6:  29.36  28.23  26.18
16-JUL      /  7:  29.00  28.52  24.82
16-AUG      /  8:  29.06  28.51  24.76
15-SEP      /  9:  29.24  28.26  24.94
16-OCT      / 10:  29.04  28.33  25.88
15-NOV      / 11:  29.07  28.76  26.29
16-DEC      / 12:  29.04  28.27  26.22


2. It also seems that the longitude axis of the data needs to be defined as positive values. I had a file where the longitude dimension was "degrees_east", but the values ranged from -180 to 180. The sampleXY function only worked after I regridded the data to positive values (i.e. -20 -> 340 etc), but it plotted fine. 

Cheers,

Paul



[Thread Prev][Thread Next][Index]
Contact Us
Dept of Commerce / NOAA / OAR / PMEL / Ferret

Privacy Policy | Disclaimer | Accessibility Statement