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_NBIN_XY and SCAT2GRID_NBIN_XYT

SCAT2GRID_NBIN_XY(XPTS,YPTS,VAR,XAXPTS,YAXPTS)
Computes count of scattered data in each bin of a regularly-spaced XY grid.

SCAT2GRID_NBIN_XYT(XPTS,YPTS,TPTS,VAR,XAXPTS,YAXPTS,TAXPTS)
Computes count of scattered data in each bin of a regularly-spaced XYT grid.

These functions return the number of valid scattered data values that lie within each grid cell in XY or in XYT. The result is the count. See the SCAT2GRID_NBIN_XY and SCAT2GRID_NBIN_XYT functions which return the average of data by binning in each grid cell.

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

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

Arguments:

XPTS

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

 

YPTS

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

 

VAR

VAR Function value at scattered locations, listed along an 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_NBIN_XY(lons, lats, var, x[gx=xax], y[gy=yax])

 

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

 

Arguments:

XPTS

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

 

YPTS

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

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

VAR

VAR Function values at scattered locations, listed along an 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

 

Notes:

The SCAT2GRID_NBIN_XY and SCAT2GRID_NBIN_XYT 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 argumentsrather 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 while not truly scattered, 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.