The netCDF developers always said they were going to rewrite the OpenDAP library in C for version 4.1. The good news is that they seem to have already done this in the snapshots, which can be found here.
ftp://ftp.unidata.ucar.edu/pub/netcdf/s ... ily.tar.gz
I have built the latest one (netcdf-4.1-beta1-snapshot2009041409) on my Cygwin system with Gortran and G95 and confirmed that I can enable OpenDAP and also have a functional Fortran interface usable by ROMS. This should make it possible for ROMS to use OpenDAP URLs (but not ordinary URLs) as input files. More mundanely, it means you don't have to keep separate netCDF installations to support OpenDAP applications on the one hand and ROMS on the other.
There is a complication. If OpenDAP was enabled when netCDF was built, then some extra linker arguments (-lcurl -lrpc) are required when building ROMS; however if you haven't enabled OpenDAP you might not have these libraries, so adding these arguments will cause an error. Luckily the clever netCDF developers thought of a way to help the user cope with the extra complexity: they introduced the nc-config utility, which prints out information needed in building netCDF applications. I have modified CYGWIN-gfortran.mk and CYGWIN-g95.mk to use this utility. The relevant section from CYGWIN-gfortran.mk is
Code: Select all
ifdef USE_NETCDF4 NC_CONFIG ?= nc-config NETCDF_INCDIR ?= $(shell $(NC_CONFIG) --fflags | grep -o "\-I.*" | cut -f 1 | cut -c "3-") LIBS := $(shell $(NC_CONFIG) --flibs) else NETCDF_INCDIR ?= /usr/local/include NETCDF_LIBDIR ?= /usr/local/lib LIBS := -L$(NETCDF_LIBDIR) -lnetcdf endif
A couple of notes:
- The nc-config command is present in netCDF 4.0.1 but not in 4.0. However it's just a shell script that can be retrofitted if necessary.
- NETCDF_INCDIR is needed by the ROMS make file to point to the location of NETCDF.mod and TYPESIZES.mod. We get these from the output of "nc-config --fflags", but only after a bit mucking about with grep and cut. Perhaps the netCDF developers could be persuaded to add an option to provide this information directly.