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, > > 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