#br *opendap for Matlab [#u1771e89] #br **"libcurl" [#ia84f8fe] First of all, make sure if you'd have libcurl on your system. # su # rpm -qa | grep curl lib64curl-devel-7.20.1-2.1mdv2010.2 libcurl4-7.20.1-2.1mdv2010.2 lib64curl4-7.20.1-2.1mdv2010.2 curl-7.20.1-2.1mdv2010.2 You should have the four items listed above. If there is a missing file(s), then sudo urpmi to install it on your own. **Install "libdap" and "loaddap" [#j468c058] Download the source files for these two libraries. -http://opendap.org/pub/source/loaddap-3.7.0.tar.gz -http://opendap.org/pub/source/libdap-3.9.3.tar.gz We assume here that we'd want to install the opendap toolbox in ~/matlab/toolbox/opendap. Copy the downloaded files to this directory, untar them, and go to each subdirectory to compile. cd ~/matlab/toolbox/opendap/libdap-3.9.3 vi util_mit.cc add the following in line 36 #include <cstdio> comment out line 39 //#include <string> then modify the configuration as sh ./configure --prefix=~/matlab/toolbox/opendap make make install cd ~/matlab/toolbox/opendap/loaddap-3.7.0 setenv PKG_CONFIG_PATH ~/matlab/toolbox/opendap/lib/pkgconfig setenv PKG_CONFIG_PATH {$PKG_CONFIG_PATH}:/usr/lib64/pkgconfig sh ./configure --prefix=~/matlab/toolbox/opendap --with-matlab=/opt/MATLAB/R2009a make make install You should be aware that some later versions of Matlab are not compatible with loaddap. As long as we confirmed, R2009a is the latest one to work with loaddap. Start matlab (with -nojvm or -nodesktop) and do the following >> addpath ~/matlab/toolbox/opendap/bin >> x = loaddap('-A', 'http://test.opendap.org/opendap/data/nc/coads_climatology.nc') >> temps = loaddap('http://test.opendap.org/opendap/data/nc/coads_climatology.nc?SST[0:0][0:89][0:179]') ; >> x = temps.SST.COADSX ; >> y = temps.SST.COADSY ; >> te = temps.SST.SST ; >> te (abs(te) > 100) = NaN ; >> pcolor (x,y,te) ; shading flat ; colorbar Now access to opendap servers is fully functional. **Alternative configuration and possible errors [#je6d745c] To load Matlab R2009a, you should edit your .cshrc file such that setenv MATLABROOT /opt/MATLAB/R2009a Also it is useful to avoid adding the path to the opendap mex executables upon loading matlab everytime. To do so, edit .cshrc as: setenv MATLABPATH $MATLABPATH":$HOME/matlab/toolbox/opendap/bin" You may encounter an error message as follows upon calling loaddap on matlab: >> x = loaddap('-A', 'http://test.opendap.org/opendap/data/nc/coads_climatology.nc') /home/kobe/matlab/toolbox/ opendap/bin/writedap: error while loading shared libraries: libdapclient.so.3: cannot open shared object file: No such file or directory Error: Communication with the loaddap helper application writedap: Resource temporarily unavailable This may be due to an earlier error. However, if there was no previous error message, please report this to support at opendap.org. There are two ways to sneak it. The first way is to add the path to the opendap libraries in .cshrc file again. setenv LD_LIBRARY_PATH $HOME/matlab/toolbox/opendap/lib:$LD_LIBRARY_PATH The other way is to simply copy the libraries in ~/matlab/toolbox/opendap/lib to /usr/lib64. Then you should have # su # cd /usr/lib64 # ls -la libdap* lrwxrwxrwx 1 root root 23 Aug 9 11:33 libdap.so -> /usr/lib64/libdap.so.10* lrwxrwxrwx 1 root root 16 Feb 10 2011 libdap.so.10 -> libdap.so.10.0.1* -rwxr-xr-x 1 root root 925232 Oct 7 2009 libdap.so.10.0.1* lrwxrwxrwx 1 root root 21 Feb 10 2011 libdapclient.so.3 -> libdapclient.so.3.0.1* -rwxr-xr-x 1 root root 242520 Oct 7 2009 libdapclient.so.3.0.1* lrwxrwxrwx 1 root root 21 Feb 10 2011 libdapserver.so.7 -> libdapserver.so.7.0.1* -rwxr-xr-x 1 root root 72624 Oct 7 2009 libdapserver.so.7.0.1* Another error I encountered is an inconsistent libstdc++.so. It can read as >> x = loaddap('-A', 'http://test.opendap.org/opendap/data/nc/coads_climatology.nc') /home/kobe/matlab/toolbox/opendap/loaddap-3.7.0/writedap: /opt/MATLAB/R2009a/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.11' not found (required by /home/kobe/matlab/toolbox/opendap/loaddap-3.7.0/writedap) /home/kobe/matlab/toolbox/opendap/loaddap-3.7.0/writedap: /opt/MATLAB/R2009a/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.11' not found (required by /usr/lib64/libdapclient.so.3) /home/kobe/matlab/toolbox/opendap/loaddap-3.7.0/writedap: /opt/MATLAB/R2009a/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.11' not found (required by /usr/lib64/libdap.so.10) Error: Communication with the loaddap helper application writedap: No such file or directory This may be due to an earlier error. However, if there was no previous error message, please report this to support at opendap.org. This is solvable by making a symbolic of your current libstdc++.so.6 in /usr/lib64 to the matlab installation directory. Check the libstdc in /usr/lib64 first. # cd /usr/lib64 # ls -al libstd* lrwxrwxrwx 1 root root 18 2011-08-19 18:42 libstdc++.so.5 -> libstdc++.so.5.0.7* -rwxr-xr-x 1 root root 833936 2008-07-31 08:14 libstdc++.so.5.0.7* lrwxrwxrwx 1 root root 19 2011-08-19 18:30 libstdc++.so.6 -> libstdc++.so.6.0.13* -rwxr-xr-x 1 root root 1015328 2010-02-09 17:59 libstdc++.so.6.0.13* So we would like to use libstdc++.so.6.0.13 rather than the one come with the matlab. For the case with R2009a, # su # cd /opt/MATLAB/R2009a/sys/os/glnxa64/ # mv libstdc++.so.6 libstdc++.so.6.BAK # ln -s /usr/lib64/libstdc++.so.6.0.13 libstdc++.so.6 Then, everything should work just fine. (Many thanks to Jaison Kurian at UCLA!)