Difference between revisions of "GDL"

From SharedSkies
Jump to navigation Jump to search
 
(74 intermediate revisions by 2 users not shown)
Line 1: Line 1:
The [http://gnudatalanguage.sourceforge.net/ Gnu Data Language (GDL)] is a useful open-source alternative to IDL.  Although for new astronomical scripting applications we prefer Python, the proprietary IDL system is widely used and there are many astronomical routines written for it  that are freely available. This page is a guide to the installation of GDL on an OpenSuse Linux platform.
The [https://github.com/gnudatalanguage/gdl Gnu Data Language (GDL)] is a useful open-source alternative to IDL on Linux.  Although for new astronomical scripting applications we prefer Python and Julia, the proprietary IDL system is widely used and there are many astronomical routines written for it  that are freely available. This page is a guide to the installation of GDL on an OpenSuse Linux platform in order to use the community resources available.




Line 7: Line 7:
We assume that the base [http://www.astro.louisville.edu/mediawiki/index.php/OpenSuse OpenSuse] system has been installed with the packages that are often used to support scientific computing.  There are some unusual dependencies to build a complete GDL.  Additional procedures may be added after the fact since they are compiled as needed by GDL itself.
We assume that the base [http://www.astro.louisville.edu/mediawiki/index.php/OpenSuse OpenSuse] system has been installed with the packages that are often used to support scientific computing.  There are some unusual dependencies to build a complete GDL.  Additional procedures may be added after the fact since they are compiled as needed by GDL itself.


We recommend installing the version in the CVS repository since is likely to have many known issues corrected.  However, the version 0.9.2 released on 2012-02-20 will compile and is largely compatible with IDL.  These notes are based on an CVS verion of 2012-07-29 which updates that release.
These notes are based on latest github version as of July 2020. It is an improved version over the last Sourceforge release and should be largely compatible with IDL routines.


Go to the Sourceforge website:  
Go to the github website:  


<center>
<center>
[http://sourceforge.net/projects/gnudatalanguage/ http://sourceforge.net/projects/gnudatalanguage/]
[https://github.com/gnudatalanguage/gdl https://github.com/gnudatalanguage/gdl]
</center>
</center>


and click on the "Code" link in the top menubar rather than the "Download" button that provides the last stable release.
Click on the "Code" link in the top menubar   the "Download" button to provide the last stable release as a zip file. Once you have it on your system, make a copy in a permanent location, and
as superuser (su), also  to the /usr/local/src tree on your Linux system:


As superuser (su), copy this archive to the /usr/local/src tree on your Linux system:
  cp gdl.zip /usr/local/src


cp gnudatalanguage-gdl_20120729.tar.gz /usr/local/src
You are ready to compile the code. .


== Install and compile the source code ==


== Install and compile the source code ==


The source tree will be in /usr/local/src/ where you made a copy of the downloaded tarfile:
The source tree will be in /usr/local/src/ where you made a copy of the downloaded tarfile:


cd /usr/local/src


tar xvzf gnudatalanguage-gdl_20120729.tar.gz
  cd /usr/local/src


This will create a "gdl" directory in /usr/local/src containing the files you will compile.
  unzip gdl.zip




cd gdl
This will create a "gdl-master" directory in /usr/local/src containing the files you will compile.


./configure  --without-hdf --with-hdf5
These are some of the required packages on a new installation of Gnu Data Language:


If the configuration does not successfully complete and generate Makefile in the top level directory, look at the list of errors generated during configuration for clues about missing packages.


Once those issues are resolved, try building the software with
*cmake
*graphicsmagick development
*pyplot and subpackages
*libgraphicsmagick++-devel
*libgeotiff2
*geotiff-devel
*netcdf-devel
*eigen3-devel
*tirpc


make
*pslib build and install from source
[http://pslib.sourceforge.net/ http://pslib.sourceforge.net/]


We find that during the build you may see an error such as this one:
*udunits build and install from source
[https://www.unidata.ucar.edu/software/udunits/ https://www.unidata.ucar.edu/software/udunits/]


Now try to build and add other packages as needed.


''libtool: Version mismatch error.''
  cd gdl-master
  mkdir build
  cd build
  cmake -DCMAKE_BUILD_TYPE=Release -DGRIB=OFF  ../


We turn off GRIB because the functionality is not needed in astrophysics and it requires external code that does not compile readily.


which is corrected by running this command


  cmake -DCMAKE_BUILD_TYPE=Release -DGRIB=OFF -DWXWIDGETS=OFF -DGEOTIFF=off -DNETCDF=OFF -DHDF=off -DLIBPROJ4=OFF -DUDUNITS2=OFF -DGLPK=OFF -DSHAPELIB=OFF  ../


aclocal; libtoolize --force; autoconf; automake -a
will turn off features used by geosciences and less often by physics and astronomy.  Each of these has a library requirement not present by default in Opensuse, and requiring installation of a package or from source.


The default installation directory top level is /usr/local.  To specify another one,  add


in the toplevel of gdl directory, and then repeating the configure and make commands.
  -DCMAKE_INSTALL_PREFIX=/path/to/install/dir


to the cmake installation command.


The GDL team notes in their CVS version that they will be using cmake instead of autoconf in the future. The software can be compiled with cmake once you install the package for your distributionThe process would be something like this:
Once this runs, scan the output to be sure it will build as intended, that the necessary packages and libraries are installed, and that the functions needed for your GDL are set ON.   


cd gdl
On Opensuse also edit  the CMakeCache.txt in build for these entries
mkdir build
cd build
../cmake


modified to allow for variations in your installation requirements.  Instructions are in the gdl INSTALL.cmake file.
  //CXX compiler
  CMAKE_CXX_COMPILER:FILEPATH=/usr/bin/c++


After a successful make operation, install the binaries and library with
and for these libraries


make install
  //Flags used by the CXX compiler during all build types.
  CMAKE_CXX_FLAGS:STRING=-ltirpc -lutil


Centos may only require the library addition with -lutil.


Prepare a location for the procedures that you will add:
Compile, check, and install by default in /usr/local/share


cd /usr/local/
  make
mkdir gdl
  make check
cd gdl
  make install
cp -p -r /usr/local/src/gdl/src/pro ./


The GDL source code is complex and has many dependencies.  There may be missing libraries to contend with that that will not be apparent until the make process is tried. They can be added as needed using YAST.




Line 84: Line 100:




For astronomical use, GDL requires several additional procedures which you have to install separately.  Download and save in your long term archive the procedures from these sites:
For astronomical use, there are additional procedures to install system-wide.  Download and save in your long term archive the code from these sites:
 
 
*[http://www.physics.wisc.edu/~craigm/idl/cmsave.html Craig Markwardt's CMSVLIB] provides  SAVE and RESTORE in GDL
 
*[http://idlastro.gsfc.nasa.gov/ NASA's astronomy library] and the [http://idlastro.gsfc.nasa.gov/ftp/ ftp site] provides many astronomical utility procedures and handlers for FITS files
 
*[http://www.boulder.swri.edu/~buie/idl/ Mark Buie's IDL libary] and [http://www.boulder.swri.edu/~buie/idl/downloads/ download site] provides procedures for astrometry, photometry, and spectroscopy
 
*[http://www.physics.mnstate.edu/mcraig/textoidl/ Matthew Craig's tex to IDL] provides procedures to  use LaTeX markup coding in graphics
 
 
Copy the .pro files from these sources into one or more separate directories under /usr/local/share/gnudatalanguage/lib/  For example, we would use something like this:
 
 
  cd /usr/local/share/gnudatalanguage/lib/
 
  mkdir astro
 
  mkdir tmp
 
  cd tmp
 
  cp /home/john/gdl/archive/astron.tar.gz ./
 
  tar xvzf astron.tar.gz
 
  cd pro
 
  cp *.pro /usr/local/share/gnudatalanguage/lib/astro/
 
  cd /usr/local/share/gnudatalanguage/lib/
 
  rm -r tmp
 
 
and repeat this for each of the libraries you want to add, copying only the *.pro files into gdl.  They can all go into astro, or if you anticipate updating them individually, into a separate directory for each one.
 
When you are done, assign the ownership of the gdl directory to root, or to a trusted user:
 
  cd /usr/local/share/
 
  chown -R root.root gnudatalanguage
 
to assure accessibility of all files and assure read access to the library:
 
  cd /usr/local/share/gnudatalanguage
  chmod a+r -R lib
 
 
== Set environment variables ==
 
 
In the bash shell edit the .profile directory for each user who would access gdl, or add to /etc/profile.local for everyone, to make these changes (written assuming separated directories for each added library):
 
 
  export GDL_PATH=$GDL_PATH:/usr/local/share/gnudatalanguage/lib/cmsvlib/
  export GDL_PATH=$GDL_PATH:/usr/local/share/gnudatalanguage/lib/astro/
  export GDL_PATH=$GDL_PATH:/fullpathto/gdl/programs/
  export GDL_PATH=$GDL_PATH:/fullpathto/exofast/
  export EXOFAST_PATH=/fullpathto/exofast/
 
 
We include here access to Jason Eastman's EXOFAST, assuming it may be installed in an indivdual user directory rather than the full gdl library location.  In that case, these changes would be in that user's "hidden" .profile  file.
 
== Run EXOFAST under gdl ==
 
 
To run gdl you simply issue on the command line "gdl" and you will be in a command line environment for the Gnu Data Language.  To exit and return  to the shell, "exit".  GDL commands are identical to IDL, and most are supported in the recent code.  If the EXOFAST library is in the search path the compiling will be automatic.  One way to do this is to have a named directory "exofast" which is a softlink to the version you want to run, and add that to your .profile as noted above.  This allows some flexibility in testing or using different versions without changing the environment.
 
 
To run a process
 
  gdl -e 'myprocess'
 
is all that's needed.  The myprocess.pro file must be in the current working directory or the path.  Note that ".pro" is not on the command line.
 
 
To run and test EXOFAST, install it in your user home directory under your own "gdl" with the appropriate addition to your .profile as noted above. Then
 
  cd /fullpathto/exofast
 
Exofast currently provides examples to test and under the examples directory there are specfic test procedures, such as
 
  cd /fullpathto/exofast/examples/hat3/
  gdl -e fithat3
 
 
For help with finding procedures and their status in development, a [http://aramis.obspm.fr/~coulais/IDL_et_GDL/Matrice_IDLvsGDL_intrinsic.html list of routines supported in GDL] is available, but it too is not current.
 
 
== EXOFASTv2 under GDL ==
 
As of July 2020, the github release of EXOFASTv2 will run under GDL.  Download it from [https://github.com/jdeast/EXOFASTv2 https://github.com/jdeast/EXOFASTv2] and unzip the contents into EXOFASTv2-master.  That directory has to be in the GDL search path, which as noted above, could be with a soft link from the .profile for the user.  To test it, go to examples and try hat3.
 
  gdl -e fithat3.pro
 
The output of EXOFAST for these examples will be in a fitresults directory with  files of text tables, LaTeX tex,  and PostScript graphics.  For viewing on Linux, try "gv", or convert to pdf with ps2pdf and use evince or okular.
 
There were no errors generated in a test run on our system with the latest GDL and EXOFASTv2 at this time.

Latest revision as of 22:08, 27 July 2020

The Gnu Data Language (GDL) is a useful open-source alternative to IDL on Linux. Although for new astronomical scripting applications we prefer Python and Julia, the proprietary IDL system is widely used and there are many astronomical routines written for it that are freely available. This page is a guide to the installation of GDL on an OpenSuse Linux platform in order to use the community resources available.


Download the recent source code

We assume that the base OpenSuse system has been installed with the packages that are often used to support scientific computing. There are some unusual dependencies to build a complete GDL. Additional procedures may be added after the fact since they are compiled as needed by GDL itself.

These notes are based on latest github version as of July 2020. It is an improved version over the last Sourceforge release and should be largely compatible with IDL routines.

Go to the github website:

https://github.com/gnudatalanguage/gdl

Click on the "Code" link in the top menubar the "Download" button to provide the last stable release as a zip file. Once you have it on your system, make a copy in a permanent location, and as superuser (su), also to the /usr/local/src tree on your Linux system:

 cp gdl.zip /usr/local/src

You are ready to compile the code. .

Install and compile the source code

The source tree will be in /usr/local/src/ where you made a copy of the downloaded tarfile:


 cd /usr/local/src 
 unzip gdl.zip


This will create a "gdl-master" directory in /usr/local/src containing the files you will compile.

These are some of the required packages on a new installation of Gnu Data Language:


  • cmake
  • graphicsmagick development
  • pyplot and subpackages
  • libgraphicsmagick++-devel
  • libgeotiff2
  • geotiff-devel
  • netcdf-devel
  • eigen3-devel
  • tirpc
  • pslib build and install from source

http://pslib.sourceforge.net/

  • udunits build and install from source

https://www.unidata.ucar.edu/software/udunits/

Now try to build and add other packages as needed.

 cd gdl-master
 mkdir build
 cd build
 cmake -DCMAKE_BUILD_TYPE=Release -DGRIB=OFF  ../

We turn off GRIB because the functionality is not needed in astrophysics and it requires external code that does not compile readily.


 cmake -DCMAKE_BUILD_TYPE=Release -DGRIB=OFF -DWXWIDGETS=OFF -DGEOTIFF=off -DNETCDF=OFF -DHDF=off -DLIBPROJ4=OFF -DUDUNITS2=OFF -DGLPK=OFF -DSHAPELIB=OFF   ../ 

will turn off features used by geosciences and less often by physics and astronomy. Each of these has a library requirement not present by default in Opensuse, and requiring installation of a package or from source.

The default installation directory top level is /usr/local. To specify another one, add

 -DCMAKE_INSTALL_PREFIX=/path/to/install/dir

to the cmake installation command.

Once this runs, scan the output to be sure it will build as intended, that the necessary packages and libraries are installed, and that the functions needed for your GDL are set ON.

On Opensuse also edit the CMakeCache.txt in build for these entries

 //CXX compiler
 CMAKE_CXX_COMPILER:FILEPATH=/usr/bin/c++

and for these libraries

 //Flags used by the CXX compiler during all build types.
 CMAKE_CXX_FLAGS:STRING=-ltirpc -lutil

Centos may only require the library addition with -lutil.

Compile, check, and install by default in /usr/local/share

 make
 make check
 make install

The GDL source code is complex and has many dependencies. There may be missing libraries to contend with that that will not be apparent until the make process is tried. They can be added as needed using YAST.


Add new procedures

For astronomical use, there are additional procedures to install system-wide. Download and save in your long term archive the code from these sites:



Copy the .pro files from these sources into one or more separate directories under /usr/local/share/gnudatalanguage/lib/ For example, we would use something like this:


 cd /usr/local/share/gnudatalanguage/lib/
 mkdir astro
 mkdir tmp
 cd tmp
 cp /home/john/gdl/archive/astron.tar.gz ./
 tar xvzf astron.tar.gz
 cd pro
 cp *.pro /usr/local/share/gnudatalanguage/lib/astro/
 cd /usr/local/share/gnudatalanguage/lib/
 rm -r tmp


and repeat this for each of the libraries you want to add, copying only the *.pro files into gdl. They can all go into astro, or if you anticipate updating them individually, into a separate directory for each one.

When you are done, assign the ownership of the gdl directory to root, or to a trusted user:

 cd /usr/local/share/
 chown -R root.root gnudatalanguage

to assure accessibility of all files and assure read access to the library:

 cd /usr/local/share/gnudatalanguage
 chmod a+r -R lib


Set environment variables

In the bash shell edit the .profile directory for each user who would access gdl, or add to /etc/profile.local for everyone, to make these changes (written assuming separated directories for each added library):


 export GDL_PATH=$GDL_PATH:/usr/local/share/gnudatalanguage/lib/cmsvlib/
 export GDL_PATH=$GDL_PATH:/usr/local/share/gnudatalanguage/lib/astro/
 export GDL_PATH=$GDL_PATH:/fullpathto/gdl/programs/
 export GDL_PATH=$GDL_PATH:/fullpathto/exofast/
 export EXOFAST_PATH=/fullpathto/exofast/


We include here access to Jason Eastman's EXOFAST, assuming it may be installed in an indivdual user directory rather than the full gdl library location. In that case, these changes would be in that user's "hidden" .profile file.

Run EXOFAST under gdl

To run gdl you simply issue on the command line "gdl" and you will be in a command line environment for the Gnu Data Language. To exit and return to the shell, "exit". GDL commands are identical to IDL, and most are supported in the recent code. If the EXOFAST library is in the search path the compiling will be automatic. One way to do this is to have a named directory "exofast" which is a softlink to the version you want to run, and add that to your .profile as noted above. This allows some flexibility in testing or using different versions without changing the environment.


To run a process

 gdl -e 'myprocess'

is all that's needed. The myprocess.pro file must be in the current working directory or the path. Note that ".pro" is not on the command line.


To run and test EXOFAST, install it in your user home directory under your own "gdl" with the appropriate addition to your .profile as noted above. Then

 cd /fullpathto/exofast

Exofast currently provides examples to test and under the examples directory there are specfic test procedures, such as

 cd /fullpathto/exofast/examples/hat3/
 gdl -e fithat3


For help with finding procedures and their status in development, a list of routines supported in GDL is available, but it too is not current.


EXOFASTv2 under GDL

As of July 2020, the github release of EXOFASTv2 will run under GDL. Download it from https://github.com/jdeast/EXOFASTv2 and unzip the contents into EXOFASTv2-master. That directory has to be in the GDL search path, which as noted above, could be with a soft link from the .profile for the user. To test it, go to examples and try hat3.

 gdl -e fithat3.pro

The output of EXOFAST for these examples will be in a fitresults directory with files of text tables, LaTeX tex, and PostScript graphics. For viewing on Linux, try "gv", or convert to pdf with ps2pdf and use evince or okular.

There were no errors generated in a test run on our system with the latest GDL and EXOFASTv2 at this time.