[netcdf-java] specifying Http Handler

Sachin Kumar Bhate skbhate at ngi.msstate.edu
Tue Jan 29 10:33:48 MST 2008


John,

We have been involved from quite some time  in creating a netCDFdata 
access layer for Matlab
using Netcdf-Java toolsUI API and it has been working out great, except in
some case where we do have to modify/extend the API to address issues 
with Matlab.

With regards to using the netcdf-java API within Matlab,
 we have been using the   'GridDataset.open' class to access a netcdf-file
which is on a 'HTTP' server.

But, in some version of Matlab on linux we do get an error message, where
it is unable to access the file from http server. The error is..
 >> GridDataset = GridDataset.open(uri);
??? Java exception occurred:
java.io.IOException:
http://science.whoi.edu/users/kestons/redtide_2005_hindcast/OUT/avg_gom_0014.nc 
<http://science.whoi.edu/users/kestons/redtide_2005_hindcast/OUT/avg_gom_0014.nc>
is not
a valid URL.Document not found on server
       at ucar.nc2.dataset.NetcdfDataset.isDODS(NetcdfDataset.java:360)
       at ucar.nc2.dataset.NetcdfDataset.openFile(NetcdfDataset.java:332)
       at ucar.nc2.dataset.NetcdfDataset.openDataset(NetcdfDataset.java:175)
       at 
ucar.nc2.dataset.NetcdfDatasetCache.acquire(NetcdfDatasetCache.java:203)
       at 
ucar.nc2.dataset.NetcdfDatasetCache.acquire(NetcdfDatasetCache.java:183)
       at 
ucar.nc2.dataset.NetcdfDatasetCache.acquire(NetcdfDatasetCache.java:171)
       at ucar.nc2.dt.grid.GridDataset.open(GridDataset.java:72)


I understand that the error is generated where a suitable 'http' handler 
is not assigned
when I am running this code in Matlab. The quick solution which I found 
is to modify the 'isDODS' method
with utility method 'ucar.nc2.util.NetworkUtils.initProtocolHandler()',  
which specifies a
http handler for the specified URL.

This approach works fine as a temporary solution, but would prefer if 
this solution is incorporated in
your ToolsUI distribution. Do you think it would be possible for you to 
add this solution to the
ToolsUI future release ?

Thank you,

Sachin.

-- 
Sachin Kumar Bhate, Software Engineer
MSU-High Performance Computing Collaboratory, NGI
John C. Stennis Space Center, MS 39529
Ph: (601) 466-9692



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.unidata.ucar.edu/mailing_lists/archives/netcdf-java/attachments/20080129/2250bc55/attachment.html 


More information about the netcdf-java mailing list