Calling SCAT2GRID functions for DSG data
Question:
I want to use some of the SCAT2GRID functions with my Discrete Sampling Geometries data (DSG data). But the variables don't have the same dimensions!
Discussion:
This FAQ uses a SCAT2GRID_BIN function but the method will work for any of the SCAT2GRID functions, see
yes? show function SCAT2GRID*
Discrete Sampling Geometries (DSG) data:
Observational data from DSG datasets contain collections of data and coordinate locatinos. The lists of coordinate information that can feed into the functions for gridding into a multi-dimensional grid. However, with the exception of trajectory data the coordinates do not all have the same dimensionality. Timeseries data for instance has a station location for each station, and multiple observations in time. Profile data has one location and time per stations, and multiple heights/depths in each profile. For the SCAT2GRID functions we need all of the first arguments, the scattered locations and observations, to be of the same size. We need to expand the station data to repeat the station location for each time in that station's time series.
The function EXPND_BY_LEN does just this.
yes? show function expnd_by_len EXPND_BY_LEN(var,len,nx) Returns a variable expanded by the lengths given in arg 2 var: 1D variable to expand len: lengths to expand each element of argument 1 nx: length of result (sum of lengths in arg 2)
So, for the example dataset dsg_timeseries_example.nc we'd do this:
- Use expnd_by_len to expand longitude and latitude to repeat at each time in the station's timeseries.
- Define a grid. This data is sparse, so the define quite a coarse grid. Check the time attributes ("show attributes time" for the time variable in the dataset) and use the same time units and time origin in defining a time axis with delta-time of 10 days, in seconds.
- Define the gridded variable using a call to SCAT2GRID_BIN_XYT.
yes? use dsg_timeseries_example yes? let lat_expnd = expnd_by_len (latitude, rowsize, `rowsize[m=@sum]`) yes? let lon_expnd = expnd_by_len (longitude, rowsize, `rowsize[m=@sum]`) ! Define a grid to put the data into yes? show attributes time yes? define axis/x=0:340:20/units=degrees_east xaxis yes? define axis/y=-20:20:5/units=degrees_north yaxis yes? define axis/t="15-JAN-2017 12:00":"21-APR-2017 12:00":`10*24*3600`\ /units=seconds/t0=1-jan-1970 taxis ! Define the regridding, inheriting the units and title from t_25. yes? let/like=t_25 gridded_t25 = scat2grid_bin_xyt(lon_expnd, lat_expnd, time, t_25, x[gx=xaxis], y[gy=yaxis], t[gt=taxis]) yes? list/y=0 gridded_t25 VARIABLE : Sea Surface Temperature (degree_C) FILENAME : dsg_timeseries_example.nc FILEPATH : /home/users/tmap/ferret/linux/fer_dsets/data/ SUBSET : 18 by 11 points (LONGITUDE-TIME) LATITUDE : 0 ... listing every 2th point 0E 40E 80E 120E 160E 160W 120W 80W 40W 1 3 5 7 9 11 13 15 17 15-JAN-2017 12 / 1: 28.16 .... 28.27 .... 30.34 26.46 25.55 .... .... 25-JAN-2017 12 / 2: 28.59 .... 28.59 .... 30.39 26.66 25.02 .... .... 04-FEB-2017 12 / 3: 28.76 .... 28.85 .... 30.21 26.58 25.21 .... .... 14-FEB-2017 12 / 4: 28.41 .... 29.05 .... 30.17 26.77 26.22 .... .... 24-FEB-2017 12 / 5: 28.81 .... 29.07 .... 30.14 26.88 26.62 .... .... 06-MAR-2017 12 / 6: 28.77 .... 29.37 .... 29.34 27.29 26.60 .... .... 16-MAR-2017 12 / 7: 29.41 .... 29.88 .... 29.16 27.42 27.19 .... .... 26-MAR-2017 12 / 8: 29.37 .... 29.83 .... 29.40 27.34 27.89 .... .... 05-APR-2017 12 / 9: 29.40 .... 29.69 .... 29.34 27.44 27.96 .... .... 15-APR-2017 12 / 10: 29.17 .... 29.60 .... 29.43 27.95 27.86 .... .... 25-APR-2017 12 / 11: 28.81 .... 29.91 .... 29.48 28.01 28.39 .... ....
try these commands:
yes? list/x=-150 gridded_t25 yes? shade gridded_t25[t=@ave]