Re: problem with newest netcdf java library when retrieving netcdf file from JOSS (fwd)

Hi luca: you own another thank-you to julie, who forwarded your message!

Julie Caron wrote:

---------- Forwarded message ----------
Date: Mon, 26 Sep 2005 09:11:23 -0600
From: Luca Cinquini <luca@xxxxxxxx>
To: jcaron@xxxxxxxx
Cc: Michael Burek <mburek@xxxxxxxx>, John J.Allison <john@xxxxxxxxxxxxx>
Subject: problem with newest netcdf java library when retrieving netcdf file
    from JOSS

Hi John,
    after installing the newest NetCDF Java library on the CDP, there
seems to be a problem in generating NcML on the fly when opening a URL
that is served by the JOSS server, for example the following file:

http://chinook.joss.ucar.edu:8080/datafile/nph-get/87.004/
RF01.20041207.161000_215115.PNI.nc

Everything works ok if I place the same file on the dataportal server.
The error when opening the file from the JOSS server is the following:

java.io.IOException: Server does not support byte Ranges
         at
ucar.unidata.io.http.HTTPRandomAccessFile3.<init>(HTTPRandomAccessFile3.
java:74)
         at
ucar.unidata.io.http.HTTPRandomAccessFile3.<init>(HTTPRandomAccessFile3.
java:53)
         at ucar.nc2.NetcdfFile.open(NetcdfFile.java:205)
         at ucar.nc2.NetcdfFile.open(NetcdfFile.java:165)
         at ucar.nc2.NetcdfFile.open(NetcdfFile.java:149)
         at ncar.scd.ncml.io.NetcdfReader.read(NetcdfReader.java:84)

Which I think originates from the fact that appearently the JOSS server
does NOT send, in its response, the header "Accept-Ranges".

Now the question is: according to the WWW specification
(http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html), the
"Accept-Ranges" header is optional:

"Origin servers that accept byte-range requests MAY send

           Accept-Ranges: bytes

       but are not required to do so."

the functionality (and so the header) is needed if you want to read a netcdf file over HTTP.

So the question is - is this header really necessary for the rest of
the application ? I think it would be best if the java library simply
printedf a warining if this header is not found, as opposed to throwing
an exception....

I assume you are calling NetcdfFile.open() or equivilent? There really not much else to do but throw an exception, since the library can't open the file.
http://chinook.joss.ucar.edu:8080/datafile/nph-get/87.004/RF01.20041207.161000_215115.PNI.nc

seems to be hanging, so its hard to check for sure.




thanks, Luca