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

[netCDFJava #GFQ-763475]: java bufr example?



thats not a bufr file, its a bufr table.

try it on one of the bufr files you actually want to read.

> Hi,
> 
> 
> I tried to open a bufr file through netcdf-java and bufr3.0. It compiled and 
> failed to run:
> 
> 
> 
> gsod000964804l:test_bufr szhou$ 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
>   readBufr.java
> gsod000964804l:test_bufr szhou$ java -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
>   readBufr
> java.io.IOException: Cant read B3M-000-012-B: not a valid CDM file.
> at ucar.nc2.NetcdfFile.open(NetcdfFile.java:737)
> at ucar.nc2.NetcdfFile.open(NetcdfFile.java:387)
> at ucar.nc2.NetcdfFile.open(NetcdfFile.java:357)
> at ucar.nc2.NetcdfFile.open(NetcdfFile.java:344)
> at readBufr.main(readBufr.java:43)
> 
> 
> Here is the java code
> 
> import ucar.nc2.iosp.bufr.*;
> import ucar.nc2.*;
> //import ucar.nc2.dataset.conv._Coordinate;
> import ucar.nc2.dataset.conv.*;
> import ucar.nc2.util.CancelTask;
> import ucar.ma2.DataType;
> 
> import java.io.PrintStream;
> import java.util.*;
> 
> import ucar.nc2.Group;
> import ucar.nc2.Variable;
> import ucar.nc2.Attribute;
> import ucar.nc2.Dimension;
> import ucar.nc2.NetcdfFile;
> 
> import ucar.ma2.ArrayFloat;
> import ucar.ma2.InvalidRangeException;
> 
> import java.io.IOException;
> import java.util.List;
> import java.lang.String;
> 
> /**
> * try to a bufr file via net-java api
> */
> 
> public class readBufr {
> 
> public static void main(String args[]) {
> 
> 
> String filename = "B3M-000-012-B";
> 
> // Open the bufr file through  netcdf api.
> 
> NetcdfFile dataFile = null;
> try {
> 
> dataFile = NetcdfFile.open(filename, null);
> 
> } catch (java.io.IOException e) {
> e.printStackTrace();
> return;
> } finally {
> if (dataFile != null)
> try {
> dataFile.close();
> } catch (IOException ioe) {
> ioe.printStackTrace();
> }
> }
> 
> 
> }
> }
> 
> 
> The bufr file, B3M-000-012-B, is attached which is downloaded from
> http://www.unidata.ucar.edu/software/netcdf-java/tutorial/bufr/bufrIosp.html
> (somehow this url is not working today.)
> 
> 
> Looking forward to hearing from you.
> 
> Thanks,
> 
> 
> Shujia
> 
> ________________________________________
> From: Unidata netCDF Java Support address@hidden
> Sent: Saturday, August 06, 2011 4:57 PM
> To: Zhou, Shujia (GSFC-610.3)[NORTHROP GRUMMAN]
> Cc: address@hidden
> Subject: [netCDFJava #GFQ-763475]: java bufr example?
> 
> > Hi, John:
> >
> > On Aug 4, 2011, at 9:53 AM, Unidata netCDF Java Support wrote:
> >
> > > 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.
> >
> > OK. I wil write a code to read the output of NCEP or NWS in BUFR.
> >
> > By the way, is netcdf 4.2 supporting hdf?
> 
> yes
> 
> 
> 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


NOTE: All email exchanges with Unidata User Support are recorded in the Unidata inquiry tracking system and then made publicly available through the web. If you do not want to have your interactions made available in this way, you must let us know in each email you send to us.