PROGRAM NNEX02
C
C Simple example of natural neighbor linear regridding.
C
PARAMETER(ISLIM = 6, NUMXOUT = 21, NUMYOUT = 21)
C
C Dimension for the work space for the NCAR Graphics call to
C SRFACE to plot the interpolated grid.
C
PARAMETER(IDIM=2*NUMXOUT*NUMYOUT)
C
C Input data arrays.
C
REAL X(ISLIM), Y(ISLIM), Z(ISLIM)
C
C Output grid arrays.
C
REAL XI(NUMXOUT), YI(NUMYOUT), ZI(NUMXOUT,NUMYOUT)
C
C Define the input data arrays.
C
DATA X/0.00, 1.00, 0.00, 1.00, 0.40, 0.75 /
DATA Y/0.00, 0.00, 1.00, 1.00, 0.20, 0.65 /
DATA Z/0.00, 0.00, 0.00, 0.00, 1.25, 0.80 /
C
DIMENSION IWORK(IDIM)
C
C Define the output grid.
C
XMIN = 0.
XMAX = 1.
XINC = (XMAX-XMIN)/(NUMXOUT-1.)
DO 20 I=1,NUMXOUT
XI(I) = XMIN+REAL(I-1) * XINC
20 CONTINUE
C
YMAX = 1.
YMIN = 0.
YINC = (YMAX-YMIN)/(NUMYOUT-1.)
DO 30 J=1,NUMYOUT
YI(J) = YMIN+REAL(J-1) * YINC
30 CONTINUE
C
C Set the flag for using estimated gradients.
C
CALL NNSETI('IGR',1)
C
C Do the regridding.
C
CALL NATGRIDS(ISLIM,X,Y,Z,NUMXOUT,NUMYOUT,XI,YI,ZI,IER)
IF (IER .NE. 0) THEN
WRITE (6,510) IER
510 FORMAT('Error return from NATGRIDS = ',I3)
ENDIF
C
C Draw a plot of the interpolated surface.
C
CALL DRWSRF(NUMXOUT,NUMYOUT,XI,YI,ZI,15.,-25.,90.,IWORK)
C
STOP
END
home |
contents |
defs |
params |
procedures |
exmpls |
index