NetcdfFile can open remote files served over HTTP, if the HTTP server allows range requests for a resource, indicated by the Accept-Ranges header (optional), and returns a Content-Length header (required). Therefore, the server must not return the data as "chunked" transfer-coding, such as gzip. Note this must happen for both the GET and the HEAD HTTP requests.
Performance will be strongly affected by the file format and the data access pattern. This is because each request for data will incur one or more file access requests. Each file acccess request becomes an HTTP request, incurring the cost of one round-trip message to the server. Generally, the netcdf-3 format (not netcdf-4) is most likely to give good performance, especially when reading large amounts of non-record data per request. Use OPeNDAP for more consistent performance.
The THREDDS Data Server enables range requests by default. You may have to configure other HTTP servers. Following are our notes on how to do so.
<Directory "/opt/local_htdocs"> Options FollowSymLinks Indexes AllowOverride None Order allow,deny Allow from all Header set Accept-Ranges bytes </Directory>
For more information see:
1. Add Live HTTP Headers plug-in to Firefox.
2. Try a URL in firefox:
http://motherlode.ucar.edu:8080/thredds/fileServer/station/metar/Surface_METAR_20090209_0000.nc
(this file is probably timed off, but you can go to http://motherlode.ucar.edu:8080/thredds/catalog/station/metar/catalog.html to find a current one)
You should get something like the following in the Live Headers window:
GET /thredds/fileServer/station/metar/Surface_METAR_20090209_0000.nc HTTP/1.1 Host: motherlode.ucar.edu:8080 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.9.0.6) Gecko/2009011913 Firefox/3.0.6 (.NET CLR 3.5.30729) Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Connection: keep-alive
HTTP/1.x 200 OK Server: Apache-Coyote/1.1 Last-Modified: Mon, 09 Feb 2009 20:56:13 GMT Accept-Ranges: bytes Content-Type: application/x-netcdf Content-Length: 44414600 Date: Mon, 09 Feb 2009 20:56:14 GMT
In particular you should see these two headers:
Accept-Ranges: bytes
Content-Length: 12345
3. Try the same thing with the server you want to test.