Installing the FAN Library onto Ubuntu (or not as the case may be).
Setting up the FAN Library for Ubuntu takes some work. I started by trying to install the Python Scientific Library but this didn’t seem to give the packages I wanted.
sudo apt-get install pyton-scientific
So I then looked at doing it from source.
1) Get the Source files from UNiDAta
2) Uncompress them from their delivery package and cd into the src folder.
uncompress fan.tar.Z tar -xvf fan.tar cd fan-2.0.3/src
3) Now if you take a moment to read the README and INSTAL files you will realise that you need to install the udunits binaries and development libraries.
sudo apt-get install libudunits2-dev sudo apt-get install udunits-bin
4) As well as install ingthe netcdf binaries and development libraries
sudo apt-get install libnetcdf-bin sudo apt-get install netcdf-bin
5) Now you can try and configure the FAN package but before you do there will be things that need configuring such as:
CPP_NETCDF Compiler reference for netCDF header-file, e.g. “-I/usr/local/netcdf/include”. Ubuntu10(ish) /usr/include
CPP_UDUNITS Compiler reference for UDUNITS header-file, e.g. “-I/usr/local/udunits/include”. Ubuntu10(ish) /usr/lib
LD_NETCDF Linker reference for netCDF library, e.g. “-L/usr/local/netcdf/lib -lnetcdf”.
LD_UDUNITS Linker reference for UDUNITS library, e.g. “-L/usr/local/udunits/lib -ludunits”.
And then you can try this
6) Next try building the install packages
Now at this point I started getting some errors so how did I fix/not fix them. The first error was something to do with MAX_NC_OPEN but I was able to follow this link which appeared to fix the issue. Open the nc header file
and then add this code under the #include entry.
#define MAX_NC_OPEN 32
Rather than just use 32 you can use the script providing on the link above to find out what number your machine can cope with. When I compiled the script and ran it.
gcc sysconf_test.c -o sysconf_test ./sysconf_test
the output was:
daviesc@big-blue:~/software/fan-2.0.3/src$ ./sysconf_text sysconf _SC_OPEN_MAX says you can use the following: #define MAX_NC_OPEN 1024
which was perfect so I updated nc.h again. The next error I had was
nasParse.y:30:1: error: initializer element is not constant
which I think was related to my haphazard approach to the Configure section so I went back to step 5 to add some more detail.