Installing Generic Mapping Tools in Kubuntu

As mentioned in this OpenDX forum, OpenDX is not a gridding tool, so it suggested to try GMT which can be downloaded from

To install this software, it requires NetCDF, so in Kubuntu, use Adept to install:

  • netcdf-bin
  • netcdfg-dev

Then, create the GMT input parameter and save it as GMTparam.txt. Download also the install script. Then run
sh install_gmt GMTparam.txt.

This creates GMT4.2.1 directory. Go to subdirectory “examples”, and run

If no error, then the GMT has been installed.


How to compress and split into smaller files in Linux

I want to back up a folder that has a size of more than 6GB and then put it into the CD-ROM. To do this, I compress the folder
zip -r /mnt/ESA/Oka/ Old/

and then split into smaller size using zipsplit. To check how many files will be created if we want to split into 600MB, type
zipsplit -tn 629145600 /mnt/ESA/Oka/

and to split the file, type
zipsplit -n 629145600 /mnt/ESA/Oka/

Uh it seems that there is a file size limit with zip. It stops at around 13MB.

so use tar and split instead. Type
tar czvf /mnt/ESA/Oka/Old.tar.gz Old/
to create the archive file, and then
split –-bytes=600m /mnt/ESA/Oka/Old.tar.gz /mnt/ESA/Oka/mysplitfiles/Old.tar.gz.
to split the files and put into mysplitfiles directory. The files will be Old.tar.gz.aa, Old.tar.gz.ab and so on.

To recover them type
cat Old.tar.gz.* > Old.tar.gz

check this link.

Installing Octave with UMFPACK from Source

if you are not using Ubuntu and need to compile the UMFPACK manually, download the SuiteSparse package at this page. I didn’t use METIS, so I need to disable it first. Follow the instruction at the README.txt on how to disable it. This is the step btw:

  1. from the SuiteSparse directory, go to UFconfig directory and edit, and uncomment this option

    # If you use CHOLMOD_CONFIG = -DNPARTITION then you must use the following
    # options:
    METIS =

    and add add this line

  2. Since I’m compiling for linux, I choose this compiler alternative option.

    CFLAGS = -O3 -fexceptions -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -L/usr/li

    Somehow I got error that it couldn’t fine libgfortran, so I need to specify the location with the -L option.
  3. Go back to SuiteSparse directory and type “make”. It will compile and run the test
  4. run this script SuiteSparse direcotry to install headers and libraries to your local directory.

    # Make sure the install directories exist
    if !(test -d $INSTALL_DIR/include);
    echo $INSTALL_DIR/include did not exist, creating $INSTALL_DIR/include
    mkdir $INSTALL_DIR/include
    if !(test -d $INSTALL_DIR/include/suitesparse);
    echo $INSTALL_DIR/include/suitesparse did not exist, creating $INSTALL_DIR/include/suitesparse
    mkdir $INSTALL_DIR/include/suitesparse
    if !(test -d $INSTALL_DIR/lib);
    echo $INSTALL_DIR/lib did not exist, creating $INSTALL_DIR/lib
    mkdir $INSTALL_DIR/lib
    # Copy all the files to the new directories
    echo Copying UMFPACK files into $INSTALL_DIR...
    cp UFconfig/UFconfig.h $INSTALL_DIR/include/suitesparse
    cp UMFPACK/Include/*.h $INSTALL_DIR/include/suitesparse
    cp UMFPACK/Lib/libumfpack.a $INSTALL_DIR/lib
    ranlib $INSTALL_DIR/lib/libumfpack.a
    echo Copying AMD files into $INSTALL_DIR/...
    cp AMD/Include/*.h $INSTALL_DIR/include/suitesparse
    cp AMD/Lib/libamd.a $INSTALL_DIR/lib
    ranlib $INSTALL_DIR/lib/libamd.a
    echo Copying CAMD files into $INSTALL_DIR/...
    cp CAMD/Include/*.h $INSTALL_DIR/include/suitesparse
    cp CAMD/Lib/libcamd.a $INSTALL_DIR/lib
    ranlib $INSTALL_DIR/lib/libcamd.a
    echo Copying COLAMD files into $INSTALL_DIR/...
    cp COLAMD/Include/*.h $INSTALL_DIR/include/suitesparse
    cp COLAMD/Lib/libcolamd.a $INSTALL_DIR/lib
    ranlib $INSTALL_DIR/lib/libcolamd.a
    echo Copying CCOLAMD files into $INSTALL_DIR/...
    cp CCOLAMD/Include/*.h $INSTALL_DIR/include/suitesparse
    cp CCOLAMD/Lib/libccolamd.a $INSTALL_DIR/lib
    ranlib $INSTALL_DIR/lib/libccolamd.a
    echo Copying CXSPARSE files into $INSTALL_DIR/...
    cp CHOLMOD/Include/*.h $INSTALL_DIR/include/suitesparse
    cp CHOLMOD/Lib/libcholmod.a $INSTALL_DIR/lib
    ranlib $INSTALL_DIR/lib/libcholmod.a
    echo Copying CHOLMOD files into $INSTALL_DIR/...
    cp CXSparse/Include/*h $INSTALL_DIR/include/suitesparse
    cp CXSparse/Lib/libcxsparse.a $INSTALL_DIR/lib
    ranlib $INSTALL_DIR/lib/libcxsparse.a
    echo Copying METIS files into $INSTALL_DIR/...
    cp metis-4.0/Lib/*.h $INSTALL_DIR/include/suitesparse
    cp metis-4.0/libmetis.a $INSTALL_DIR/lib
    ranlib $INSTALL_DIR/lib/libmetis.a
  5. Go to octave-3.0.0 source directory. and type

    ./configure CPPFLAGS=-I$HOME/usr/local/include/suitesparse LDFLAGS=-L$HOME/usr/local/lib/ --prefix=$HOME/programs/Octave3.0

    where I decide to install it into my $HOME/programs/Octave3.0 directory.

Octave needs UMFPACK for Unsymmetric Sparse Linear Solver

When you install Octave, it will check whether your system has the required libraries. Some of the libraries are optional. However, if you want to solve unsymmetric Sparse linear system, then Octave needs UMFPACK. To install libraries related to sparse matrix in Ubuntu, type

sudo apt-get install libsuitesparse-dev

Measure processing time in Octave

Use cputime() function.

...%your code
...%when you are done
printf('Total cpu time: %f seconds\n', cputime-t);

2D integration from irregular data

How to integrate discrete 2D data?

octave:#> int2d=sum(sum(zdata)).*dx.*dy

But this assumes that the zdata is in a regular mesh with uniform grid spacing dx and dy. If they are irregular, use griddata.

N=100; %number of points;

Purpose of this blog

Well, I usually try to find things on the web to solve my problems, but then I forgot again. So I decided to put it in the blog. So maybe it can help someone else also, out there 🙂

ehm most probably about computing, or tips and tricks in doing my projects. yup, it will be not very organized though 🙂