# Re: [ferret_users] Spatial Trend

Check the arguments to the scat2gridgauss_xy function. The first two are reversed. They should be

SCAT2GRIDGAUSS_XY (LON, LAT, SWHCOR, X[GX=XLON], Y[GY=YLAT], ...

On Wed, Feb 5, 2014 at 8:17 PM, Selvam G. wrote:
Dear Prof,

I did'n understand to the exact, I used the following command to Interpolate, It gives the result Interpolated but I did'n see any difference and Interpolated maps based on this value. I attaching you the code which I used... Please give Instructions..

yes? DEFINE AXIS/X=15E:120:10/UNIT=DEGREES xlon
yes? DEFINE AXIS/Y=-60:30N:10/UNIT=DEGREES ylat
Replacing definition of axis YLAT
yes? DEFINE AXIS/Y=-60:30N:10/UNIT=DEGREES YLAT
yes? let swhcorgrid = scat2gridgauss_xy (lat, lon, swhcor, x[gx=xlon], y[gy=YLAT], 4,2,4,2)
yes? stat swhcorgrid

SCAT2GRIDGAUSS_XY (LAT, LON, SWHCOR, X[GX=XLON], Y[GY=YLAT], 4,2,4,2)
LONGITUDE: 10E to 130E
LATITUDE: 65S to 35N
Z:  N/A
T:  N/A
E:  N/A
F:  N/A
DATA SET: ./wm_20110101.nc

Total # of data points: 120 (12*10*1*1*1*1)
# flagged as bad  data: 40
Minimum value: 0.62119
Maximum value: 5.3594
Mean    value: 2.6417 (unweighted average)
Standard deviation: 1.1658
yes? SET MODE INTERPOLATE
yes? LIST/L=1/X=15E:120E/Y=-60S:30N SWHCOR
VARIABLE : sea_surface_wave_significant_height_corrected (m)
FILENAME : wm_20110101.nc
SUBSET   : 106 points (X)
15    /  15:  3.140
16    /  16:  1.540
17    /  17:  3.380
18    /  18:  1.740
19    /  19:  3.160
20    /  20:  1.520
21    /  21:  3.590
22    /  22:  1.600
23    /  23:  3.150
24    /  24:  1.560
25    /  25:  3.460
26    /  26:  1.370
27    /  27:  3.400
28    /  28:  1.360
29    /  29:  3.210
30    /  30:  1.640
31    /  31:  3.420
32    /  32:  1.560
33    /  33:  3.420
34    /  34:  1.450
35    /  35:  1.420
36    /  36:  3.440
37    /  37:  1.520
38    /  38:  3.540
39    /  39:  1.480
40    /  40:  3.240
41    /  41:  1.490
42    /  42:  3.560
43    /  43:  1.540
44    /  44:  3.530
45    /  45:  1.740
46    /  46:  3.170
47    /  47:  1.450
48    /  48:  3.960
49    /  49:  1.460
50    /  50:  3.360
51    /  51:  1.580
52    /  52:  3.900
53    /  53:  1.510
54    /  54:  3.360
55    /  55:  1.420
56    /  56:  3.300
57    /  57:  1.590
58    /  58:  1.650
59    /  59:  3.290
60    /  60:  1.710
61    /  61:  3.410
62    /  62:  1.560
63    /  63:  3.680
64    /  64:  1.500
65    /  65:  3.110
66    /  66:  1.630
67    /  67:  3.500
68    /  68:  1.720
69    /  69:  3.670
70    /  70:  1.740
71    /  71:  3.560
72    /  72:  1.620
73    /  73:  3.220
74    /  74:  1.610
75    /  75:  3.600
76    /  76:  1.500
77    /  77:  3.260
78    /  78:  1.600
79    /  79:  3.320
80    /  80:  1.600
81    /  81:  1.500
82    /  82:  3.660
83    /  83:  1.900
84    /  84:  3.290
85    /  85:  1.990
86    /  86:  3.080
87    /  87:  3.830
88    /  88:  1.890
89    /  89:  3.730
90    /  90:  1.690
91    /  91:  4.110
92    /  92:  1.550
93    /  93:  3.650
94    /  94:  1.670
95    /  95:  3.330
96    /  96:  1.620
97    /  97:  4.050
98    /  98:  1.470
99    /  99:  4.110
100   / 100:  1.470
101   / 101:  4.320
102   / 102:  1.580
103   / 103:  1.670
104   / 104:  3.860
105   / 105:  1.730
106   / 106:  3.760
107   / 107:  1.600
108   / 108:  3.770
109   / 109:  1.340
110   / 110:  3.940
111   / 111:  1.660
112   / 112:  3.860
113   / 113:  1.550
114   / 114:  3.770
115   / 115:  1.740
116   / 116:  3.260
117   / 117:  1.490
118   / 118:  4.190
119   / 119:  1.500
120   / 120:  4.160
yes? LIST/L=1/Y=-60S:30N SWHCOR[X=15E:120E@ITP]
VARIABLE : sea_surface_wave_significant_height_corrected (m)
FILENAME : wm_20110101.nc
X        : 15 to 120 (interpolated)
3.140
yes?
yes?
yes?
yes?

From: "Ansley Manke" <ansley.b.manke@xxxxxxxx>
To: "Selvam G." <gselvam@xxxxxxx>
Sent: Wednesday, February 5, 2014 11:48:03 PM

Subject: Re: [ferret_users] Spatial Trend

Hello,
I will answer two questions you sent to me outside of the list.  First, some general comments about interpolation in Ferret.

MODE INTERPOLATE controls whether Ferret interpolates results when getting data out of a grid.  So, for instance, say you have a data on an axis which is every 10 degrees, such as

define axis/x=0:360:10/units=degrees_east

and you ask Ferret to list data at x=28E.  With MODE INTERPOLATE turned on, Ferret would do a linear interpolation between the data values at x=20 and x=30 and return that interpolated result.  If MODE INTERPOLATE is off, it would return the data at the nearest location, x=30.

Interpolating to a grid can mean a couple of different things.  For your data, which is ungridded data with locations lon, lat and data at lon,lat; we use one of the scat2grid functions, as you show here. If the data is gridded, then interpolating to another grid is referred to in the documentation as "regridding".  Finally if you had gridded data, and wanted data at a set of X,Y locations, that would be "sampling".

Now, about scat2gridgauss_xy. The script you sent earlier needs one change.  You had this:
yes? use wm_20110101.nc
yes? DEFINE AXIS/X=15E:120:10/UNIT=DEGREES xlon
yes? DEFINE AXIS/Y=-60S:30N:10/UNIT=DEGREES ylat
yes? DEFINE GRID/X=xlon/Y=ylat gsnoopy2d
The Y axis definition should not have -60S, but either 60S or -60, without the S.
yes? use wm_20110101.nc
yes? DEFINE AXIS/X=15E:120:10/UNIT=DEGREES xlon
yes? DEFINE AXIS/Y=60S:30N:10/UNIT=DEGREES ylat

yes? let swhcorgrid = scat2gridgauss_xy (lat, lon, swhcor, x[gx=xlon], y[gy=ylat], 4,2,4,2)
yes? stat swhcorgrid

SCAT2GRIDGAUSS_XY (LAT, LON, SWHCOR, X[GX=XLON], Y[GY=YLAT], 4,2,4,2)
LONGITUDE: 10E to 130E
LATITUDE: 65S to 35N
Z:  N/A
T:  N/A
E:  N/A
F:  N/A
DATA SET: ./wm_20110101.nc

Total # of data points: 120 (12*10*1*1*1*1)
# flagged as bad  data: 40
Minimum value: 0.62119
Maximum value: 5.3594
Mean    value: 2.6417 (unweighted average)
Standard deviation: 1.1658

On 2/4/2014 10:55 PM, Selvam G. wrote:
Dear Prof,

I tried another command with scat2gridgauss_xy , In this Interpolation data points are drawn. please guide me for Interpolating data points within this region, LON=15:120 and LAT=-60:30.

yes? let swhcorgrid = scat2gridgauss_xy (lat, lon, swhcor, x[gx=xlon], y[gy=ylat], 4,2,4,2)
yes? stats swhcorgrid

SCAT2GRIDGAUSS_XY (LAT, LON, SWHCOR, X[GX=XLON], Y[GY=YLAT], 4,2,4,2)
LONGITUDE: 10E to 130E
LATITUDE: 25N to 65N
Z:  N/A
T:  N/A
E:  N/A
F:  N/A
DATA SET: ./wm_20110101.nc

Total # of data points: 48 (12*4*1*1*1*1)
# flagged as bad  data: 17
Minimum value: 0.5978
Maximum value: 4.3431
Mean    value: 1.6993 (unweighted average)
Standard deviation: 1.3002
yes? let xlon = XSEQUENCE(lon)
yes? let ylat = YSEQUENCE(lat)
yes? let yswhcor = YSEQUENCE(swhcor)
yes? let salinite = SCAT2GRIDGAUSS_XY(xlon,ylat,yswhcor,x[gx=xlon],y[gy=ylat],2,2,2,2)
yes?

regards,
Selvam G.

From: "Ansley Manke" <ansley.b.manke@xxxxxxxx>
To: "Selvam G." <gselvam@xxxxxxx>
Cc: "ferret users" <ferret_users@xxxxxxxx>
Sent: Tuesday, February 4, 2014 11:18:17 PM
Subject: Re: [ferret_users] Spatial Trend

Hello,
Your data is organized as lists of longitude, latitude, time and measurements. You used a good method, plot/vs/ribbon, to visualize the density and range of the data.
yes? go basemap x=15:120 y=-60:30
yes? plot/vs/over/nolab/ribbon/thick/size=0.08/symbol=17/key/LEV= v LON,LAT,SWHCOR
To interpolate it to a grid, use one of the SCAT2GRID functions
yes? show function scat2grid*xy
Perhaps the scat2gridgauss_xy function. A note on the syntax: in your axis definition, the latitude axis should be one of these:
DEFINE AXIS/Y=60S:30N:10/UNIT=DEGREES ylat
DEFINE AXIS/Y=-60:30:10/UNIT=DEGREES ylat
Not -60S.

-Ansley

On 2/3/2014 7:49 PM, Selvam G. wrote:
```Dear Prof,

I would like to know the ferret command for linear Interpolation. I am dealing with Ifremer altimeter wave data for Indian Ocean.I plotted the map but when the Interpolation command is given the .des file is not shown as it is Interpolated. I am attaching one of my wave data for your consideration. I request your guidance for this Interpolation.

Thanks & regards
Selvam G.

----- Original Message -----
From: "Russ Fiedler" <russell.fiedler@xxxxxxxx>
To: "ferret users" <ferret_users@xxxxxxxx>
Sent: Tuesday, February 4, 2014 3:16:38 AM
Subject: Re: [ferret_users] Spatial Trend

The time units for the trend should correspond to the time axis for your
data. If it's days then you will have to multiply by 365 or 365.25 to
get the trend in terms of years.

Russ

On 03/02/14 23:45, iwlod@xxxxxxxxxxxxxxxxxxx wrote:
```
```I dont think it is that simple - units on slope are way to small

can someone else confirm?
thanks

```
```Simply shade slope.

Sent from my iPhone

```
```On Jan 31, 2014, at 4:17 AM, iwlod@xxxxxxxxxxxxxxxxxxx wrote:

Collective Ferret Wisdom :-)

How do I go from a linear regression line plot (with go regresst) to a
SPATIAL (lat x lon) trend map of say, temperature  for the past 20
years?

Thank you

```