SCAT2GRID_BIN_XYZT works correctly, but only on the first call in the script. On the second call this is the error message:
Bailing out of external function "scat2grid_bin_xyzt":
Input scattered XPTS, ZPTS have different # of points 41 1681
**ERROR: error in external function
Here is an example, contributed along with some example data by Ned. I have subsetted the dataset for a smaller file. We bin input data to the x, y, z and t axes. The gridded data are sparse with mostly missing values in the x=longitude, y=latitude, z=pressure and t=time directions. So we are binning it into large bins.
!***************************************
! test_grid_bottle_data.jnl
! This example shows that scat2grid_bin_xyzt works the first time it is called in ferret or pyferret, but fails when it is called again.
use bottle_data_subset.nc
show data
define axis/x=180W:134W:1 x_ax
define axis/y=55n:62n:1 y_ax
define axis/z=0:100:20 z_ax
define axis/t="1-jan-2016":"31-jan-2017":1/t0="1-jan-1900"/units=day t_ax
let xpts = longitude
let ypts = latitude
let zpts = pressure
let x_bin = x[gx=x_ax]
let y_bin = y[gy=y_ax]
let z_bin = z[gz=z_ax]
let t_bin = t[gt=t_ax]
let/like=temperature temp_bin = scat2grid_bin_xyzt (xpts, ypts, zpts, time, temperature, x_bin, y_bin, z_bin, t_bin )
stat temp_bin
set window 1
shade temp_bin[z=@ave,t=@ave]
pause
let/like=salinity sal_bin = scat2grid_bin_xyzt (xpts, ypts, zpts, time, salinity, x_bin, y_bin, z_bin, t_bin )
stat sal_bin
set window 2
shade sal_bin[z=@ave,t=@ave]
Reported by Ned Cokelet.
SCAT2GRID_BIN_XYZT works correctly, but only on the first call in the script. On the second call this is the error message:
Here is an example, contributed along with some example data by Ned. I have subsetted the dataset for a smaller file. We bin input data to the x, y, z and t axes. The gridded data are sparse with mostly missing values in the x=longitude, y=latitude, z=pressure and t=time directions. So we are binning it into large bins.
bottle_subset.nc.gz
Editing to replace the example file.
bottle_subset.nc.gz