[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: geotiff help



Flavio Casadei Della Chiesa wrote:

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.

Sorry it took so long to get back to you. I just got the ArcMap license issue resolved and test the output of your files, all look good here. For those files with greyscale false, you may need to adjust the value symbology to classified at first time, but ArcMap knows how to handle it the next time. I suppose this is the issue you have had. Let me know if you need further help.

Yuan


I attach you the following files - sst(time-lat-lon).nc netcdf file used in my test - tif-gs-true.zip geotif output (greyscale parameter = true) - tif-gs-false-zip geotif output (greyscale parameter = false) NOTE:
My java application takes 3 arguments:
1) netcdf filename
2) the initial name of the geotiff output (es: /mypath/myfgeotiffile)
3) "gridName" (in my test i used tos")
example: java -classpath "myclasspath" test.geotiff.GeotiffMain c:/sst(time-lat-lon).nc "c:\documents and settings\casadei\desktop\tif\ciccio" tos Cheers,
 Flavio