Re: Problem using GeotiffWriter

It'd help if I actually attached the file!  Take 2...

Matt Foster wrote:

I'm a serious Java newbie, so be gentle if I've done something stupid here...

I wrote the attached short program, which is based off of a post to this list last year, to read a single element from a netCDF file, and write a GeoTIFF file, however, I get the following error message when I try to compile it with javac... cannot resolve symbol
symbol : method writeGrid (java.lang.String,java.lang.String,int,int,boolean)
location: class ucar.nc2.geotiff.GeotiffWriter
writer.writeGrid("/home/mwfoster/MaxT_test.cdf", "MaxT_SFC", 0, 0, false);

The "caret" symbol is actually under the dot between writer and writeGrid, in case a variable-width font messed that up.

Can someone help me out here?


"Those who would sacrifice essential liberties for a little
temporary safety deserve neither liberty nor safety."
-- Benjamin Franklin

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 = "maxT_test.tiff";
      GeotiffWriter writer = new GeotiffWriter(fileOut);
      writer.writeGrid("/home/mwfoster/MaxT_test.cdf", "MaxT_SFC", 0, 0, false);