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 Brian: The question of how to access netcdf files remotely is an "area of active research" as they say. I thought I'd throw my 2 cents in just to complicate matters. 1) The standard netcdf-java package is ucar.netcdf, info at http://www.unidata.ucar.edu/packages/netcdf/java/index.html You are correct that the ucar.netcdf package implements remote access through the RemoteNetcdf class. However, this feature was still being developed when the main programmer (Glenn Davis) died in a plane accident. It hasnt been developed by anyone since, and I'm not sure how well it works, so it is still experimental. I havent actually used this, so what follows is sketchy. The RemoteNetcdf class is what the client uses. There are two ways to access a file: 1) you can access by the hostname of the server and the filename if you know it. 2) You can obtain a list of available files on a known host by calling RemoteNetcdf .getService() which returns a NetcdfService interface object. The server side is implemented with a NetcdfServer object. It looks to me like an application registers the files that it wants to serve through a call to NetcdfServer.export(). You can add a list of files on the command line to NetcdfServer, but also you will probably want to add specialized code that reads files from a directory or something. Since the NetcdfServer is an RMI server, it registers itself with the rmiregistry process running on the same host. This is straightforward enough if you are ok with the mechanics of running an RMI server, which can be a little complicated. I dont know what performance is like. Does anyone else in the netcdf-java group have any experience? 2) I've been working on a new java-netcdf API called ucar.nc2; preliminary info can be found at http://www.unidata.ucar.edu/staff/caron/ma2/ma2.htm The main motivation for this new API is more effient access in the multiarray package, and a simpler netcdf interface. I am just starting to think about remote netcdf access, and I dont have RemoteNetcdf implemented at this point. There are other possible designs to consider, including using http servers to access netcdf files. I do have an unreleased version of ucar.nc2 that makes netcdf files accesible through DODS servers. You just open it with a DODS URL instead of a filename, then use the same ucar.nc2 API. This uses the DODS java packages, so the client side is 100% java, but if I understand Ethan's email the DODS server is not java. If you are interested in this approach, I can show you what I have or you might want to wait until its further developed and tested. This might be a good way to get netcdf files into Matlab, esp. if you are more familiar with the netcdf API. Note that DODS has no data cataloging at preset, so the client has to know the file URL. A number of people in Unidata and in the DODS community are thinking about how to provide cataloging. Brian Schlining wrote: > > Has anyone used the RMI implementations of the java-netcdf package? I'd > like to set up a service on a remote machine to allow access to netcdf > files stored on it. I'd prefer to do this in Java since I can then use > servlets on a web server to provide web access to the data. It appears > that the java-netcdf package already has most of the tools to do this > built using RMI...however the documentation is a bit sparse. My > questions are: > > How do I register the netcdf files? (before you ask...yes, I'm running > the rmiregistry first) It looks like I should be using the NetcdfServer > class. Unfortunatly, I haven't been able to get it to successfully > start. Does it take arguments, for example a netcdf file name? If so, do > I have to register each netcdf file seperately? > > The NetcdfServer does not appear to be multithreaded. Can it accept > requests from several clients a one time? > > On the client side, it appears I should use the RemoteNetcdf class to > read from the netcdf files....is this correct? > > I'm also wondering if it might be easier to register the netcdf files on > a DODS (distributed oceanographic data system) server. It doesn't look > like the DODS-java classes have much in the way of client functionality > yet but if anyone knows otherwise please let me know. > > Any help or examples are greatly appreciated. > > Thanks > > -- B > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > Brian Schlining > Research Technician > Monterey Bay Aquarium Research Institute > address@hidden > (831) 775-1855 > http://www.mbari.org/~brian > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~