This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.
Hi Shujia : You dont have to do anything special to open a BUFR file: NetcdfFile ncfile = NetcdfFile.open("file.bufr"); There can be problems if we dont have the BUFR table for that particular BUFR file. Send me the file if you see that happening. John > Hi, John: > > > I did use both netcdfAll-4.2.jar and bufr-3.0.jar in the path: > > javac -cp > ./:/Users/szhou/tasc_april25_06/java_jar/netcdfAll-4.2.jar:/Users/szhou/tasc_april25_06/test_java/test_bufr/bufr-3.0.jar > index2NC.java > > > I think that the code actually accessed them. However, as you said, > the code is too old to be compatible with those latest jars. An updated > example code on opening a bufr file would be very much appreciated. > > Thanks, > > > Shujia > ________________________________________ > From: Unidata netCDF Java Support [address@hidden] > Sent: Wednesday, August 03, 2011 4:04 PM > To: Zhou, Shujia (GSFC-610.3)[NORTHROP GRUMMAN] > Cc: address@hidden > Subject: [netCDFJava #GFQ-763475]: java bufr example? > > > Hi, > > > > I am interested in using java to read and write bufr files. I went to > > http://www.unidata.ucar.edu/software/netcdf-java/tutorial/bufr/bufrIosp.html > > and got some code. However, it cannot compile. For example, > > > > > > javac -cp > > ./:/Users/szhou/tasc_april25_06/java_jar/netcdfAll-4.2.jar:/Users/szhou/tasc_april25_06/test_java/test_bufr/bufr-3.0.jar > > index2NC.java > > > > > > index2NC.java:48: cannot find symbol > > symbol : class Index > > location: class index2NC > > void open( Index index, ucar.nc2.NetcdfFile ncf, CancelTask cancelTask ) { > > ^ > > index2NC.java:383: package ucar.bufr.Index does not exist > > void addVariable( Structure struct, ArrayList dims, > > ucar.bufr.Index.parameter parm ) > > ^ > > index2NC.java:98: package ucar.bufr.Index does not exist > > ucar.bufr.Index.parameter p = > > ^ > > index2NC.java:99: package ucar.bufr.Index does not exist > > (ucar.bufr.Index.parameter) parameters.get( i ); > > ^ > > index2NC.java:132: package thredds.catalog.DataType does not exist > > ncfile.addAttribute( null, new Attribute( "cdm_data_type", > > thredds.catalog.DataType.POINT.toString() ) ); > > ^ > > index2NC.java:134: package thredds.catalog.DataType does not exist > > ncfile.addAttribute( null, new Attribute( "cdm_data_type", > > thredds.catalog.DataType.STATION.toString() ) ); > > ^ > > index2NC.java:136: package thredds.catalog.DataType does not exist > > ncfile.addAttribute( null, new Attribute( "cdm_data_type", > > thredds.catalog.DataType.TRAJECTORY.toString() ) ); > > > > > > > > Do you have an updated example which can compiled with netcdf 4.2 and > > bufr3.0? > > > > > > Thanks, > > > > > > Shujia > > > > > > Hi Shujia: > > The reason thats failing is that you need both netcdf and bufr jars on your > classpath. Better, just use netcdfAll.jar as documented here: > > http://www.unidata.ucar.edu/software/netcdf-java/reference/JarDependencies.html > > Netcdf-Java will only read BUFR, it wont write it. > > Also that web page is way out of date. Where did you find a reference to it? > > John > > > Ticket Details > =================== > Ticket ID: GFQ-763475 > Department: Support netCDF Java > Priority: Normal > Status: Closed > > Ticket Details =================== Ticket ID: GFQ-763475 Department: Support netCDF Java Priority: Normal Status: Open