csa2s calculates an approximating cubic spline for two-dimensional input data. If you want to weight the input data values, calculate derivatives, or handle data sparse areas specially, then you will need to use csa2xs.
Note: This function is only available in version 4.1.1 of NCL. If your site is licensed for version 4.1, then you can get version 4.1.1 for free. To get version 4.1.1 of NCAR Graphics software, please contact your site representative. If you don't know who your site representative is, then send email to ncarginf@ucar.edu or call (303) 497-1201.
function csa2s( xi[*] : float, yi[*] : float, zi[*] : float, knots[2] : integer xo[*] : float yo[*] : float )
csa2s is in the csagrid package - a software package that implements a cubic spline approximation algorithm to fit a function to input data. The input for the approximation is a set of randomly-spaced data. These data may be one-dimensional, two-dimensional, or three-dimensional.
The general documentation for csagrid contains several complete examples for entries in the csagrid package.
begin ; ; Create the input arrays. ; xmin = -1. xmax = 1. ymin = -1. ymax = 1. nx = 29 ny = 25 ndata = 1000 xi = new(ndata,float) yi = new(ndata,float) zi = new(ndata,float) ; ; Generate input data using the function f(x,y) = y**2 - 0.5*y*x**2 ; do i=0,ndata-1 xi(i) = xmin + (xmax-xmin)*rand()/32767. yi(i) = ymin + (ymax-ymin)*rand()/32767. zi(i) = yi(i)*yi(i) - 0.5*xi(i)*xi(i)*yi(i) end do ; ; Set up the output grid. ; xo = fspan(xmin,xmax,nx) yo = fspan(ymin,ymax,ny) knots = (/4,4/) ; ; Calculate the approximated function values. ; yo = csa2s(xi,yi,zi,knots,xo,yo) end
NG4.1 Home, Index, Examples, Glossary, Feedback, Ref Contents, Ref WhereAmI?