ucar.nc2.geotiff
Class GeotiffWriter

java.lang.Object
  extended by ucar.nc2.geotiff.GeotiffWriter

public class GeotiffWriter
extends Object

Write GeoTIFF files.

Author:
caron, yuan

Constructor Summary
GeotiffWriter(String fileOut)
          Geotiff writer.
 
Method Summary
 void close()
          _more_
 Array getClippedImageFrominterpolation(Array arr, int x1, int x2, int y1, int y2)
          _more_
 double[] getSwathLatLonInformation(Array lat, Array lon)
          get lat lon information from the swath
 Array getTargetImagerFromSwath(Array lat, Array lon, Array data, double[] swathInfo)
          get the grid dataset
 Array getYXDataInBox(Array data, int x1, int x2, int y1, int y2)
          _more_
 Array interpolation(Array arr)
          interpolate the swath data to regular grid
static void main(String[] args)
          test
 void writeGrid(GridDataset dataset, GridDatatype grid, Array data, boolean greyScale)
          Write Grid data to the geotiff file.
 void writeGrid(GridDatatype grid, Array data, boolean greyScale, double xStart, double yStart, double xInc, double yInc, int imageNumber)
          Write Grid data to the geotiff file.
 void writeGrid(String fileName, String gridName, int time, int level, boolean greyScale, LatLonRect pt)
          Write Grid data to the geotiff file.
 void writeSwathGrid(String fileName, String gridName, int time, int level, boolean greyScale, LatLonRect llr)
          Write Swath Grid data to the geotiff file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GeotiffWriter

public GeotiffWriter(String fileOut)
Geotiff writer.

Parameters:
fileOut - name of output file.
Method Detail

writeGrid

public void writeGrid(GridDataset dataset,
                      GridDatatype grid,
                      Array data,
                      boolean greyScale)
               throws IOException
Write Grid data to the geotiff file.

Parameters:
dataset - grid in contained in this dataset
grid - data is in this grid
data - 2D array in YX order
greyScale - if true, write greyScale image, else dataSample.
Throws:
IOException - on i/o error

writeGrid

public void writeGrid(String fileName,
                      String gridName,
                      int time,
                      int level,
                      boolean greyScale,
                      LatLonRect pt)
               throws IOException
Write Grid data to the geotiff file.

Parameters:
fileName - _more_
gridName - _more_
time - _more_
level - _more_
greyScale - _more_
pt - _more_
Throws:
IOException - _more_

writeSwathGrid

public void writeSwathGrid(String fileName,
                           String gridName,
                           int time,
                           int level,
                           boolean greyScale,
                           LatLonRect llr)
                    throws IOException
Write Swath Grid data to the geotiff file.

Parameters:
fileName - _more_
gridName - _more_
time - _more_
level - _more_
greyScale - _more_
llr - _more_
Throws:
IOException - _more_

getYXDataInBox

public Array getYXDataInBox(Array data,
                            int x1,
                            int x2,
                            int y1,
                            int y2)
                     throws IOException
_more_

Parameters:
data - _more_
x1 - _more_
x2 - _more_
y1 - _more_
y2 - _more_
Returns:
_more_
Throws:
IOException - _more_

getClippedImageFrominterpolation

public Array getClippedImageFrominterpolation(Array arr,
                                              int x1,
                                              int x2,
                                              int y1,
                                              int y2)
_more_

Parameters:
arr - _more_
x1 - _more_
x2 - _more_
y1 - _more_
y2 - _more_
Returns:
_more_

getTargetImagerFromSwath

public Array getTargetImagerFromSwath(Array lat,
                                      Array lon,
                                      Array data,
                                      double[] swathInfo)
get the grid dataset

Parameters:
lat - _more_
lon - _more_
data - _more_
swathInfo - _more_
Returns:
_more_

interpolation

public Array interpolation(Array arr)
interpolate the swath data to regular grid

Parameters:
arr - _more_
Returns:
_more_

getSwathLatLonInformation

public double[] getSwathLatLonInformation(Array lat,
                                          Array lon)
get lat lon information from the swath

Parameters:
lat - _more_
lon - _more_
Returns:
_more_

writeGrid

public void writeGrid(GridDatatype grid,
                      Array data,
                      boolean greyScale,
                      double xStart,
                      double yStart,
                      double xInc,
                      double yInc,
                      int imageNumber)
               throws IOException
Write Grid data to the geotiff file. Grid currently must:
  1. have a 1D X and Y coordinate axes.
  2. be lat/lon or Lambert Conformal Projection
  3. be equally spaced

Parameters:
grid - original grid
data - 2D array in YX order
greyScale - if true, write greyScale image, else dataSample.
xStart -
yStart -
xInc -
yInc -
imageNumber -
Throws:
IOException - on i/o error
IllegalArgumentException - if above assumptions not valid

close

public void close()
           throws IOException
_more_

Throws:
IOException - _more_

main

public static void main(String[] args)
                 throws IOException
test

Parameters:
args - _more_
Throws:
IOException - _more_


Copyright © 1999-2011 UCAR/Unidata. All Rights Reserved.