Is there any benefit between requesting data via DAP4 over DAP2?#
There are various differences between the DAP2 and the DAP4 protocol.
The DAP4 is broader in scope#
Figure 1. Comparison between DAP2 and DAP4 data models and responses. |
The OPeNDAP team strongly recommends to begin using DAP4. Despite the Grid
no longer being part of the DAP4 data model, a coverage
consisting of Maps
, dimensions
and Array
provide the same functionality in DAP4
that Grid did in DAP2
. That said, a dataset described by the DAP2 protocol is described by the DAP4
.
Warning
A DAP4
OPeNDAP data server aims to provide backwards compatibility with DAP2
. However, because there exists dataset data types that do not appear in the DAP2
data model from 1993, DAP-backwards compatibility is not guaranteed.
DAP4 offers improved HTTP transport#
The DAP2
protocol was first envisioned in Cornillon, et al, 1993 and described in Gallagher J. and Flierl G., 1996, thus predating the HTTP/1.1
protocol. This means that in DAP2
the binary data (.dods
) is not chunked. Moreover, DAP2
has no implementation for checksums
, a standarized transfer practice nowadays. DAP4
, in contrast, dap
responses are chunked, embracing HTTP/1.1. Moreover, both Hyrax
and Thredds
implement checksums
, with checksums
being always implemented by Hyrax
and only when requested (in the URL) by Thredds
.
A word of caution#
When a Dataset possess variables or attributes of a type described in DAP4
but not in DAP2
(e.g. int64
value), the DAP4 implementing server will return an error (see this dataset, and append a .dds
to the Data URL):
Error {
code = 400;
message = "Your request was for a response that uses the DAP2 data model. This dataset contains variables whose data type ( Int64 ) is not compatible with that data model, causing this request to FAIL. To access this dataset ask for the DAP4 binary response encoding.";
}
You can reproduce this error when attempting to inspect the DAP2 metadata (dds
) for this ATLAS03 dataset. This is, replace the dmr.html
with .dds
.
However, if the only DAP4
type that appears on the dataset is a Group
, which is a container type rather than a data type, a Hyrax
DAP4
server can return a DAP2
response. It accomplishes this by flattening
the dataset. You can inspect this by looking at the (flattened) metadata of this SimpleGroup test file.
DAP4 is the default#
In the case of Hyrax
and NASA OPenDAP servers, DAP4
is the default exposed DAP protocol. A DAP2
generated metadata / response sent to the user is then first translated from a DAP4
response, which can result in slower responses. This is significant for NASA Earthdata users.
Final Recommendation#
The OPeNDAP team considers DAP4
a much more modern, faster, safer, and broader DAP protocol, and strongly recommends data producers and users to migrate to DAP4
servers.