Trouble with GeotiffWriter


I finally got some netCDF output that is truly CF-compliant, and I managed to get past the part of GeotiffWriter that establishes the coordinate system. Now, it is raising an exception in 'getYXDataInBox'. The failing point is the 'try/catch' block, where it is reading dataVolume. I tried a number of different ways to create the LatLonRect, but none made any difference.

I'm attaching my Java code. If anyone is interested, I can send the netCDF off-list. The netCDF is only 250k...not sure if that is too much for the list or not.

I'm using netcdf-Java 2.2.10.


P.S. I'm not much of an OO programmer, so try not to laugh too much at my code! ;-)

"Well, I screwed it up real good, didn't I?"
-- Richard M. Nixon

import ucar.ma2.*;
import ucar.nc2.*;
import ucar.nc2.dataset.*;
import ucar.nc2.geotiff.*;
import ucar.nc2.dataset.grid.*;
import ucar.unidata.geoloc.*;
import ucar.unidata.geoloc.projection.*;

import java.util.*;

class NetcdfToGeotif {
   public static void main(String args[]) throws IOException {
      String fileOut = "/home/mwfoster/netCDF/maxT_test.tiff";
      GeotiffWriter writer = new GeotiffWriter(fileOut);
      double lat1 = 31.96402;
      double lon1 = -101.8431;
      double lat2 = 38.57185;
      double lon2 = -94.09264;
      LatLonPointImpl llp1 = new LatLonPointImpl(lat1, lon1);
      LatLonPointImpl llp2 = new LatLonPointImpl(lat2, lon2);
      LatLonRect llr = new LatLonRect(llp1, llp2);
      writer.writeGrid("/home/mwfoster/netCDF/", "TMAX_0_0_SFC", 
0, 0, false, llr);