Hi Mr. Yuan Ho,
I'm Flavio Casadei Della Chiesa, I'm working with Lorenzo Bigagli on
the Galeon WCS-G project.
I'm writing you because I've got some problem with GeotiffWriter class.
I'm trying to convert a netcdf file in many geotiff images, one per
"horizontal slice" using a time index.
I don't know if what i obtain is the right output,
maybe I misinterpreted how to use your java classes.
Could you give a look please?
This is the java main
#######################
package test.geotiff;
import java.io.IOException;
import ucar.nc2.geotiff.GeoTiff;
import ucar.nc2.geotiff.GeotiffWriter;
import ucar.unidata.geoloc.LatLonPointImpl;
import ucar.unidata.geoloc.LatLonRect;
public class GeotiffMain {
public static void main(String args[]) throws IOException {
String fileOut = args[1];
/*
LatLonPointImpl p1 = new LatLonPointImpl(-15.0, -180.0);
LatLonPointImpl p2 = new LatLonPointImpl(60.0, 180.0);
*/
LatLonPointImpl p1 = new LatLonPointImpl(-180.0, -180.0);
LatLonPointImpl p2 = new LatLonPointImpl(180.0, 180.0);
LatLonRect llr = new LatLonRect(p1, p2);
int i = 0 ;
for (i = 0 ; i < 24 ; i++) {
String out = fileOut + String.valueOf(i) + "-" + ".tif";
GeotiffWriter writer = new GeotiffWriter(out);
writer.writeGrid(args[0], args[2], i, 0, true, llr);
writer.close();
GeoTiff geotiff = new GeoTiff(out);
geotiff.read();
geotiff.close();
}
}
}
######################
I've tried to modify the "greyscale" parameter in writer.writeGrid()
and it resulted in a (for me of course) strange geotiff.