ucar.unidata.data.point
Class Barnes

java.lang.Object
  extended by ucar.unidata.data.point.Barnes

public class Barnes
extends Object

Title: Barnes Objective Analysis (BOA) Scheme

Description: The BOA is implemented as the static method "point2grid" and is for converting irregularly spaced data defined by (longitude, latitude, value) to a regular, but not neccessarily evenly spaced, grid whose coordinates are also defined by longitude and latitude. Other methods useful to the BOA are also included in this package, such as scinex (an interpolation/extrapolation scheme).

References:

Barnes, S.L., 1994a: Applications of the Barnes objective analysis scheme Part I: Effects of undersampling, wave position, and station randomness. J. Atmos. Oceanic Technol. 11, 1433-1448.

Barnes, S.L., 1994b: Applications of the Barnes objective analysis scheme Part II: Improving derivative estimates. J. Atmos. Oceanic Technol. 11, 1449-1458.

Barnes, S.L., 1994c: Applications of the Barnes objective analysis scheme Part III: Tuning for minimum error. J. Atmos. Oceanic Technol. 11, 1459-1479.

Version:
1.0 Copyright: Copyright (c) 2001 James Kelly and Australian Bureau of Meteorology
Author:
James Kelly

Nested Class Summary
static class Barnes.AnalysisParameters
          Inner class for use of getRecommendedParameters, to allow it to return multiple values such as: gridX, gridY, scaleLengthGU, randomDataSpacing, faGridX, faGridY
 
Constructor Summary
Barnes()
          _more_
 
Method Summary
static double[] deg2km(float fLon1, float fLat1, float fLon2, float fLat2)
          Calculate the number of kms between 2 locations specified by longitude and latutide: (fLon1, fLat1) and (fLon2, fLat2) The return value is provided as a 2 element array, giving km in the x direction and km in the y direction between the 2 points: daKm[0] = dKmx daKm[1] = dKmy
static float[] getRecommendedGridX(float fLonMin, float fLonMax, float gridX)
          _more_
static float[] getRecommendedGridY(float fLatMin, float fLatMax, float gridY)
          _more_
static Barnes.AnalysisParameters getRecommendedParameters(float fLonMin, float fLatMin, float fLonMax, float fLatMax, float[][] faa3DData)
          One of the hardest things about objective analysis is choosing the correct parameters for the analysis, and this routine provides sensible recommendations on these parameters.
static void main(String[] args)
          _more_
static double[][] point2grid(float[] lon, float[] lat, float[][] data3D, float scaleLength, float gain, int iNumPasses)
          Description: point2grid is for converting irregularly spaced data defined by (longitude, latitude, value) to a regular, but not neccessarily evenly spaced, grid whose coordinates are also defined by longitude and latitude inputs lon : the longitudes on the grid where interpolated values are desired (in degrees) lat : the latitudes on the grid where interpolated values are desired (in degrees) data3D : 3D array of data values where data3D[0][*] = longitudes of data values data3D[1][*] = latitudes of data values data3D[2][*] = data values scaleLength : the Gaussian scale length (in grid units) should be approximately equal to the average data spacing a suggested default: 10.0f (no scientific reason here) gain: factor by which scaleLength is reduced for the second pass.
static double[][] point2grid(float fLonMin, float fLatMin, float fLonMax, float fLatMax, float[][] data3D)
          Simplest possible version of point2grid where the number of passes is fixed at 3 (most common case, as recommended by Barnes)
static double[][] point2grid(float fLonMin, float fLatMin, float fLonMax, float fLatMax, float[][] data3D, int iNumPasses)
          Simplified version of point2grid which calculates or assigns as many of the analysis parameters as possible All the user needs to provide is the data to be analysed, and the domain over which the analysis is to be carried out INPUT: faa3DData: An array (3,ndata) where ndata is the number of data points, and can be any number larger than N.
static double[] pointDifferences(float[] lon, float[] lat, float[][] data3D, double[][] daaGrid)
          calculate the differences between the input irregular data and the analysed grid at each data point (ie "How bad is the analysis?").
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Barnes

public Barnes()
_more_

Method Detail

point2grid

public static double[][] point2grid(float[] lon,
                                    float[] lat,
                                    float[][] data3D,
                                    float scaleLength,
                                    float gain,
                                    int iNumPasses)
Description: point2grid is for converting irregularly spaced data defined by (longitude, latitude, value) to a regular, but not neccessarily evenly spaced, grid whose coordinates are also defined by longitude and latitude inputs lon : the longitudes on the grid where interpolated values are desired (in degrees) lat : the latitudes on the grid where interpolated values are desired (in degrees) data3D : 3D array of data values where data3D[0][*] = longitudes of data values data3D[1][*] = latitudes of data values data3D[2][*] = data values scaleLength : the Gaussian scale length (in grid units) should be approximately equal to the average data spacing a suggested default: 10.0f (no scientific reason here) gain: factor by which scaleLength is reduced for the second pass. Should be in the range 0.2 to 1.0. Data are fitted more closely with a gain of 0.2 (at the expense of less overall accuracy over the entire grid); larger values smooth more. Suggested default: 1.0f iNumPasses: number of passes of the BOA to do. 4 passes recommended for analysing fields where derivative estimates are important (Ref: Barnes 1994b) 3 passes recommended for all other fields (with gain set to 1.0) (Ref: Barnes 1994c "Two pass Barnes Objective Analysis schemes now in use probably should be replaced by appropriately tuned 3pass or 4pass schemes") 2 passes only recommended for "quick look" type analyses

Parameters:
lon - _more_
lat - _more_
data3D - _more_
scaleLength - _more_
gain - _more_
iNumPasses - _more_
Returns:
_more_

point2grid

public static double[][] point2grid(float fLonMin,
                                    float fLatMin,
                                    float fLonMax,
                                    float fLatMax,
                                    float[][] data3D)
Simplest possible version of point2grid where the number of passes is fixed at 3 (most common case, as recommended by Barnes)

Parameters:
fLonMin - _more_
fLatMin - _more_
fLonMax - _more_
fLatMax - _more_
data3D - _more_
Returns:
_more_

point2grid

public static double[][] point2grid(float fLonMin,
                                    float fLatMin,
                                    float fLonMax,
                                    float fLatMax,
                                    float[][] data3D,
                                    int iNumPasses)
Simplified version of point2grid which calculates or assigns as many of the analysis parameters as possible All the user needs to provide is the data to be analysed, and the domain over which the analysis is to be carried out INPUT: faa3DData: An array (3,ndata) where ndata is the number of data points, and can be any number larger than N. each row of data should contain a longitude, a latitude, and a value to be interpolated. fLonMin: Minimum Longitude of analysis area (eg 140.0 = 140.0 E) fLatMin : Minimum Latitude of analysis area (eg -40.0 = 40.0 S) fLonMax: Maximum Longitude of analysis area (eg 150.0 = 150.0 E) fLatMax : Maximum Latitude of analysis area (eg -30.0 = 30.0 S) OUTPUTS: double[][] gridded data

Parameters:
fLonMin - _more_
fLatMin - _more_
fLonMax - _more_
fLatMax - _more_
data3D - _more_
iNumPasses - _more_
Returns:
_more_

pointDifferences

public static double[] pointDifferences(float[] lon,
                                        float[] lat,
                                        float[][] data3D,
                                        double[][] daaGrid)
calculate the differences between the input irregular data and the analysed grid at each data point (ie "How bad is the analysis?"). input: data3D: irregular data daaGrid: analysed grid, returned from the point2grid routine output: daDifferences: an array of all the differences (between the irregular data and the value interpolated from the analysed grid)

Parameters:
lon - _more_
lat - _more_
data3D - _more_
daaGrid - _more_
Returns:
_more_

getRecommendedGridX

public static float[] getRecommendedGridX(float fLonMin,
                                          float fLonMax,
                                          float gridX)
_more_

Parameters:
fLonMin - _more_
fLonMax - _more_
gridX - _more_
Returns:
_more_

getRecommendedGridY

public static float[] getRecommendedGridY(float fLatMin,
                                          float fLatMax,
                                          float gridY)
_more_

Parameters:
fLatMin - _more_
fLatMax - _more_
gridY - _more_
Returns:
_more_

main

public static void main(String[] args)
_more_

Parameters:
args - _more_

getRecommendedParameters

public static Barnes.AnalysisParameters getRecommendedParameters(float fLonMin,
                                                                 float fLatMin,
                                                                 float fLonMax,
                                                                 float fLatMax,
                                                                 float[][] faa3DData)
One of the hardest things about objective analysis is choosing the correct parameters for the analysis, and this routine provides sensible recommendations on these parameters.

The literature (eg Barnes 1994 a,b,c) contains a lot of guidance on how to select these parameters, all of which can be derived directly from the average station spacing.

Strictly speaking the actual spacing between each station and its nearest neighbours should be used (Barnes used the 6 nearest neighbours), but the routine below uses the simpler approach of assuming a random spacing of the stations, and calculates the random data spacing via a simple formula.

INPUT:

faa3DData: An array (3,ndata) where ndata is the number of data points. Each row of data should contain a longitude, a latitude, and a value to be interpolated.

fLonMin: Minimum Longitude of analysis area (eg 140.0 = 140.0 E)

fLatMin : Minimum Latitude of analysis area (eg -40.0 = 40.0 S)

fLonMax: Maximum Longitude of analysis area (eg 150.0 = 150.0 E)

fLatMax : Maximum Latitude of analysis area (eg -30.0 = 30.0 S)

OUTPUTS:

gridX: the length of 1 grid space in the X direction (degrees) (set to 0.3 * random data spacing)

gridY: the length of 1 grid space in the Y direction (degrees) (set to 0.3 * random data spacing)

scaleLengthGU: Recommended Gaussian length scale (in grid units). (set to random data spacing)

randomDataSpacing: Average spacing between station if stations were randomly distributed (km)

faGridX: the array of recommended grid points along the x axis

faGridY: the array of recommended grid points along the y axis

actualStationSpacing (Not implemented): The average distance between each station and its nearest neighbour

NUR (Not implemented): Non Uniformity Ratio Indicates how uniform data distribution is 0 = perfectly regular data grid >= 1.1 indicates a pseudo random distribution author James Kelly j.kelly@bom.gov.au author Robert Dahni rrd@bom.gov.au 30/01/97 Original Code (IDL) round grid spacings to nearest 0.05 degrees 29/3/97 R.Dahni & J.Kelly round grid spacings to nearest 0.01 degrees 15/4/97 R.Dahni & J.Kelly convert to Java 24/1/2001 J.Kelly

Parameters:
fLonMin - _more_
fLatMin - _more_
fLonMax - _more_
fLatMax - _more_
faa3DData - _more_
Returns:
_more_

deg2km

public static double[] deg2km(float fLon1,
                              float fLat1,
                              float fLon2,
                              float fLat2)
Calculate the number of kms between 2 locations specified by longitude and latutide: (fLon1, fLat1) and (fLon2, fLat2) The return value is provided as a 2 element array, giving km in the x direction and km in the y direction between the 2 points: daKm[0] = dKmx daKm[1] = dKmy

Parameters:
fLon1 - _more_
fLat1 - _more_
fLon2 - _more_
fLat2 - _more_
Returns:
_more_