diff --git a/LCS/Tools/src/lofarinit.csh b/LCS/Tools/src/lofarinit.csh
index 9428a62ee0ab643ddaa233a8cf270bf551053428..3cce1a26dff7ec014db95377d7cd44ddcf55048b 100644
--- a/LCS/Tools/src/lofarinit.csh
+++ b/LCS/Tools/src/lofarinit.csh
@@ -83,6 +83,21 @@ else
         setenv PYTHONPATH ${a_pyt}:$PYTHONPATH
     endif
 
+    # Now define the new LOFARDATAROOT (if possible).
+    # First try as data directory of the LOFAR install directory.
+    set data_path = `echo $LOFARROOT | sed -e 's%/installed.*%%'`
+    if ( "$data_path" != ""  &&  -d $data_path/data ) then
+        setenv LOFARDATAROOT $data_path/data
+    else
+        # Try it as the LOFARDATA directory (part of the source tree).
+        set data_path = `echo $LOFARROOT | sed -e 's%/LOFAR/.*%/LOFAR%'`
+        if ( "$data_path" != ""  &&  -d ${data_path}DATA ) then
+            setenv LOFARDATAROOT ${data_path}DATA
+        else
+            setenv LOFARDATAROOT /opt/lofar/data
+        endif
+    endif
+
     # Create a .glishrc.post in the HOME directory to append
     # the LOFAR libexec to the glish path.
     if ( -f $HOME/.glishrc.post ) then
@@ -90,11 +105,4 @@ else
     endif
     echo "system.path.include := [system.path.include, '$LOFARROOT/libexec/glish']" > $HOME/.glishrc.post
 
-    # Now define the new LOFARDATAROOT
-    set data_path = `echo $LOFARROOT | sed -e 's/\/installed.*$//'`
-    if ( ! -d $data_path/data ) then
-       mkdir $data_path/data
-    endif
-    setenv LOFARDATAROOT $data_path/data
-
 endif