Skip to main content
  • Home
  • Documentation
  • FAQ
  • Downloads
  • Support
  • Current Release Notes
  • Ferret Users Guide
    • Users Guide Index
    • Commands Reference
    • 1. Introduction
    • 2. Data Set Basics
    • 3. Variables & Expressions
    • 4. Grids & Regions
    • 5. Animations & Gif Images
    • 6. Customizing Plots
    • 7. Handling String Data Symbols
    • 8. Working with Special Data Sets
    • 9. Computing Environment
    • 10. Converting to NetCDF
    • 11. Writing External Functions
    • Glossary
    • Appendix A: Functions
    • Appendix B: PPLUS Guide
    • Appendix C: Ferret-Specific PPLUS Enhancements
  • Previous Release Notes
  • Tutorials and Demos
    • Ferret Tour
    • DSG files: Discrete Sampling Geometries Demo
    • Ferret sorting demo
    • Fast Fourier Transforms demo
    • Empirical Orthogonal Functions demo
    • Ferret objective analysis demo
    • Ferret Palette Demo
    • Map projections
    • Ferret polygon vector demo
    • Ferret Graticules demo
    • Ferret Polytube Demo
    • Ferret Polymark Demo
    • Ferret Constant-Array demo
    • Ferret land_detail demo
    • COADS Tour
    • Levitus Tour
    • Use OPeNDAP
    • Ferret binary read demo
  • PyFerret
    • PyFerret Downloads and Install ../../faq/ferret-faqs.html
    • What is PyFerret?
    • Why use PyFerret?
    • PyFerret for the Ferret user
    • PyFerret command syntax: quick-start notes
    • PyFerret for the Python user
    • Graphics in PyFerret ?
    • New Ferret functionality
    • PyFerret Python functions and constants
    • PyFerret Python objects and methods
    • Ferret external functions in Python
    • Ferret Fortran external functions
    • PyFerret metadata-and-data dictionaries
  • OPeNDAP
    • OPeNDAP usage in Ferret
    • Use OPeNDAP Demo
    • Test OPeNDAP

SCAT2GRID_BIN functions

SCAT2GRID_BIN_XY(XPTS,YPTS,VAR,XAXPTS,YAXPTS)
Returns scattered data, put into a grid by binning, for a regularly-spaced XY grid.

SCAT2GRID_BIN_XYT(XPTS,YPTS,TPTS,VAR,XAXPTS,YAXPTS,TAXPTS)
Returns scattered data, put into a grid by binning, for a regularly-spaced XY grid.

SCAT2GRID_BIN_XYZ(XPTS,YPTS,ZPTS,VAR,XAXPTS,YAXPTS,ZAXPTS)
    Put scattered data into XYZ grid by binning

SCAT2GRID_BIN_XYZT(XPTS,YPTS,ZPTS,TPTS,VAR,XAXPTS,YAXPTS,ZAXPTS,TAXPTS)
    Put scattered data into XYZT grid by binning

These functions return average value of all valid scattered data values that lie within each grid cell in XY, XYT, XYZ, or XYZT. See the SCAT2GRID_NBIN_XY and SCAT2GRID_NBIN_XYT functions which return the count of data that contributes to each grid cell.  (Comparable NBIN functions for XYZ and XYZT gridding are not implemented at this time.  Use SHOW FUNCTIONS to explore what functions may be available, e.g. yes? show func/brief scat2grid_nbin*).

NOTE: Unlike SCAT2GRIDGAUSS and SCAT2GRIDLAPLACE Functions, the arguments that represent the scattered X, Y, Z, and/or T locations must be 1-dimensional lists of values.

At the end of this page there is some discussion about using these functions with Discrete Sampling Geometries datasets.

 

SCAT2GRID_BIN_XY(XPTS,YPTS,F,XAXPTS,YAXPTS)

 

Arguments:

XPTS

x-coordinates of scattered input triples, listed along an abstract axis in any direction.

 

YPTS

y-coordinates of scattered input triples, listed along an abstract axis in any direction.

 

VAR

VAR  List of function values at scattered locations, listed along an abstract axis in any direction.

 

XAXPTS

coordinates of X-axis of output grid. Must be regularly spaced.

 

YAXPTS

coordinates of Y-axis of output grid. Must be regularly spaced.

Result Axes: X Inherited from XAXPTS  
 

Y

Inherited from YAXPTS

 

Z

NORMAL

 

T

NORMAL

Quick example:

yes? DEFINE AXIS/X=180:221:1 xax
yes? DEFINE AXIS/Y=-30:10:1 yax
yes? ! read some data
yes? SET DATA/EZ/VARIABLES="times,lats,lons,var" myfile.dat 
 
yes? LET my_out = SCAT2GRID_BIN_XY(lons, lats, var, x[gx=xax], y[gy=yax])

 

SCAT2GRID_BIN_XYT(XPTS,YPTS,TPTS,VAR,XAXPTS,YAXPTS,TAXPTS)

 

Arguments:

XPTS

x-coordinates of scattered input triples, listed along an abstract axis in any direction.

 

YPTS

y-coordinates of scattered input triples, listed along an abstract axis in any direction.

  TPTS t-coordinates of scattered input triples, listed along an abstract axis in any direction. These
must be in the same time units as the axis we are gridding to, and with the same time origin.
 

VAR

VAR  List of function values at scattered locations, listed along an abstract axis in any direction.

 

XAXPTS

coordinates of X-axis of output grid. Must be regularly spaced.

 

YAXPTS

coordinates of Y-axis of output grid. Must be regularly spaced.

  TAXPTS

coordinates of T-axis of output grid. Must be regularly spaced.

Result Axes:

X

Inherited from XAXPTS

 

Y

Inherited from YAXPTS

 

Z

NORMAL

 

T

Inherited from TAXPTS

 

SCAT2GRID_BIN_XYZ(XPTS,YPTS,ZPTS,VAR,XAXPTS,YAXPTS,ZAXPTS)

 

Arguments:

XPTS

x-coordinates of scattered input triples, listed along an abstract axis in any direction.

 

YPTS

y-coordinates of scattered input triples, listed along an abstract axis in any direction.

  ZPTS z-coordinates of scattered input triples, listed along an abstract axis in any direction.
 

VAR

VAR  List of function values at scattered locations, listed along an abstract axis in any direction.

 

XAXPTS

coordinates of X-axis of output grid. Must be regularly spaced.

 

YAXPTS

coordinates of Y-axis of output grid. Must be regularly spaced.

  ZAXPTS

coordinates of Z-axis of output grid. Must be regularly spaced.

Result Axes:

X

Inherited from XAXPTS

 

Y

Inherited from YAXPTS

 

Z

Inherited from ZAXPTS

 

T

NORMAL

 

SCAT2GRID_BIN_XYZT(XPTS,YPTS,ZPTS,TPTS,VAR,XAXPTS,YAXPTS,ZAXPTS,TAXPTS)

 

Arguments:

XPTS

x-coordinates of scattered input triples, listed along an abstract axis in any direction.

 

YPTS

y-coordinates of scattered input triples, listed along an abstract axis in any direction.

  ZPTS z-coordinates of scattered input triples, listed along an abstract axis in any direction.
  TPTS t-coordinates of scattered input triples, listed along an abstract axis in any direction. These
must be in the same time units as the axis we are gridding to, and with the same time origin.
 

VAR

VAR  List of function values at scattered locations, listed along an abstract axis in any direction.

 

XAXPTS

coordinates of X-axis of output grid. Must be regularly spaced.

 

YAXPTS

coordinates of Y-axis of output grid. Must be regularly spaced.

  ZAXPTS coordinates of Z-axis of output grid. Must be regularly spaced.
  TAXPTS

coordinates of T-axis of output grid. Must be regularly spaced.

Result Axes:

X

Inherited from XAXPTS

 

Y

Inherited from YAXPTS

 

Z

Inherited from ZAXPTS

  T Inherited from ZAXPTS

 

Note:

The SCAT2GRID_BIN* functions are "grid-changing"functions; the output grid is different from the input arguments.Therefore it is best to use explicit limits on any of the arguments rather than a SET REGION command. (See this note on the context of variables passed to functions.)

 

Discrete Sampling Geometries (DSG) data:

Observational data from DSG datasets contain collections of data which has lists of coordinate information that can feed into these 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 station location and time, and multiple heights/depths in each profile. For the SCAT2GRID functions we need all of the first arguments, the "scattered" locations and observation, 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 FAQ, Calling SCAT2GRID functions for DSG data explains how to work with these datasets.