GDAL can access OPeNDAP. However, it can handle dataset that has 2 dimension. If you want to specify constraint expression, it should have "x" and "y" as explained in the GDAL user guide. The following code is from frmts/dods/dodsdataset2.cpp:
/* -------------------------------------------------------------------- */ /* For now we hard code to assume that the two dimensions are */ /* ysize and xsize. */ /* -------------------------------------------------------------------- */ if( poArray->dimensions() < 2 ) { throw Error("Variable does not have even 2 dimensions. For now this is req\ uired." ); } int nXDir = 1; int nYDir = 1; int iXDim = GetDimension( oCE, "x", &nXDir ); int iYDim = GetDimension( oCE, "y", &nYDir ); if( iXDim == -1 || iYDim == -1 ) { throw Error("Missing [x] or [y] in constraint." ); }
Therefore, you need to specify subsetting carefully. Here's a working Python example.
from osgeo import gdal dods_dr = gdal.GetDriverByName('DODS') if dods_dr is None: print('DODS driver is missing.') ds = gdal.Open('https://opendap.larc.nasa.gov/opendap/hyrax/CERES/SYN1deg-1Hour/Terra-Aqua-MODIS_Edition4A/2018/01/CER_SYN1deg-1Hour_Terra-Aqua-MODIS_Edition4A_403405.20180101.hdf?sza[0:1:0][y][x]') print(ds.RasterCount) band = ds.GetRasterBand(1) arr = band.ReadAsArray() print(arr)
Please pay attention to the 'x' and 'y' in URL in the above code.