Due to the current gap in continued funding from the U.S. National Science Foundation (NSF), the NSF Unidata Program Center has temporarily paused most operations. See NSF Unidata Pause in Most Operations for details.
Jon-The attached program will get a slice from a grid as a VisAD FieldImpl and print it out. You can test it using:
java TestSlice http://motherlode.ucar.edu/repository/entry/show/output:data.opendap/entryid:f20290c6-9ee3-4d5a-b3c0-f72010abfc38/CONUS_80km_20090606_1200.grib1/dodsC/entry.das Temperature
This is accessing the grid via OPeNDAP from the Unidata RAMADDA server but you can use a local file.
If you need more help, contact me directly. Don On 1/17/11 2:13 PM, Jon Blower wrote:
Dear IDV folk, I've seen that IDV can produce vertical section plots. I'm interested in re-using this capability in other software (ncWMS) if possible. I'd like to produce a plot as a standalone image (i.e. outside the context of Swing or any particular desktop), ideally as a BufferedImage. Could someone please point me to the relevant bit in the libraries please? Thanks, Jon _______________________________________________ idvusers mailing list idvusers@xxxxxxxxxxxxxxxx For list information, to unsubscribe, visit: http://www.unidata.ucar.edu/mailing_lists/
-- Don Murray NOAA/ESRL/PSD and CIRES 303-497-3596 http://www.esrl.noaa.gov/psd/people/don.murray/
import ucar.unidata.data.grid.GeoGridAdapter; import ucar.unidata.data.grid.GeoGridDataSource; import ucar.unidata.data.grid.GridUtil; import ucar.nc2.dt.grid.*; import visad.*; import visad.georef.LatLonTuple; public class TestSlice { public static void main(String[] args) throws Exception { if (args.length == 0) { System.out.println("Must supply at least a filename"); System.out.println("Usage: java TestSlice <filename> <parameter>"); System.exit(1); } String file = args[0]; GridDataset gds = GridDataset.open(file); GeoGridDataSource ggds = new GeoGridDataSource(null, gds, "my data", file); String paramName = "T"; if (args.length > 1) { paramName = args[1]; } GeoGrid geoGrid = gds.findGridByName(paramName); if (geoGrid == null) { System.out.println("Can't find grid named " + paramName); System.exit(1); } GeoGridAdapter gga = new GeoGridAdapter(ggds, geoGrid); FieldImpl fi = gga.getSequence(); System.out.println(fi.getType()); FieldImpl slice = GridUtil.sliceAlongLatLonLine(fi, new LatLonTuple(40,-120), new LatLonTuple(30,-70)); System.out.println(slice); } }
idvusers
archives: