NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.

To learn about what's going on, see About the Archive Site.

Trouble with GeotiffWriter

List,

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.

Matt

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.io.*;
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/MaxT_Test10a.nc", "TMAX_0_0_SFC", 
0, 0, false, llr);
      writer.close();
   }
}
  • 2005 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdf-java archives: