diff --git a/ATTENTION b/ATTENTION
new file mode 100644
index 0000000..6e9cbad
--- /dev/null
+++ b/ATTENTION
@@ -0,0 +1,19 @@
+Attention ! apus case
+
+In glibc 2.17 the crypt function implementation was tightened up
+to allow for future implementation improvements, standards 
+conformance, and FIPS compliance. From the 2.17 NEWS:
+
+* The `crypt' function now fails if passed salt bytes that violate the
+  specification for those values.  On Linux, the `crypt' function will
+  consult /proc/sys/crypto/fips_enabled to determine if "FIPS mode" is
+  enabled, and fail on encrypted strings using the MD5 or DES algorithm
+  when the mode is enabled.
+
+In this particular case the salt is an invalid POSIX salt that 
+contains an ASCII space "#" in character 0 outside of the allowed
+alphabet for salts which is `./0-9a-zA-Z' and therefore crypt will
+reject that salt as invalid, return NULL, and set errno.
+
+Previous to glibc 2.17 a call to crypt would accept invalid POSIX
+salts.
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a2391b4..a9c014c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -47,12 +47,7 @@ add_subdirectory(src/DECODERS/themis/esafull2nc)
 add_subdirectory(src/DECODERS/themis/esamom2nc)
 add_subdirectory(src/DECODERS/themis/fgm2nc)
 add_subdirectory(src/DECODERS/themis/sst2nc)
-add_subdirectory(src/DATA/TIMESUPDATE)
-add_subdirectory(src/DATA/TIMESUPDATENODATA)
-add_subdirectory(src/DATA/STARTSTOPLOCAL)
-add_subdirectory(src/DATA/INFOLOCAL2NC)
-add_subdirectory(src/DATA/MAKEDDSYS)
-add_subdirectory(src/DATA/JOIN_NC)
+add_subdirectory(src/DATA/TOOLS)
 add_subdirectory(tests)
 
 install(FILES "scripts/StartServer" DESTINATION . PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
@@ -61,5 +56,6 @@ install(FILES "scripts/AddLocalVI.sh" DESTINATION . PERMISSIONS OWNER_READ OWNER
 install(FILES "scripts/UpdateInfoVI.sh" DESTINATION . PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
 install(DIRECTORY "src/CALLEXT/" DESTINATION bin/CALLEXT)
 install(DIRECTORY "src/DATA/MANAGER/" DESTINATION bin/DATAMANAGER)
+install(DIRECTORY "src/REMOTEDATA/" DESTINATION bin/REMOTEDATA)
 
 SET(CMAKE_VERBOSE_MAKEFILE ON)
diff --git a/cmake/modules/FindLibXML2.cmake b/cmake/modules/FindLibXML2.cmake
index 6744730..feffdc6 100644
--- a/cmake/modules/FindLibXML2.cmake
+++ b/cmake/modules/FindLibXML2.cmake
@@ -5,9 +5,9 @@
 #  LIBXML2_LIBRARIES - The libraries needed to use LibXml2
 #  LIBXML2_DEFINITIONS - Compiler switches required for using LibXml2
 
-FIND_PATH(LIBXML2_INCLUDE_DIR libxml/xinclude.h PATHS ${USERLOCAL_ROOT}/include/libxml2 /opt/local/include/libxml2)
+FIND_PATH(LIBXML2_INCLUDE_DIR libxml/xinclude.h PATHS /usr/include/libxml2 ${USERLOCAL_ROOT}/include/libxml2 /opt/local/include/libxml2)
 
-FIND_LIBRARY(LIBXML2_LIBRARIES NAMES xml2 libxml2 PATHS ${USERLOCAL_ROOT}/lib /opt/local/lib NO_DEFAULT_PATH)
+FIND_LIBRARY(LIBXML2_LIBRARIES NAMES xml2 libxml2 PATHS /usr/lib64 ${USERLOCAL_ROOT}/lib /opt/local/lib NO_DEFAULT_PATH)
 
 IF(LIBXML2_INCLUDE_DIR AND LIBXML2_LIBRARIES)
     SET(LibXML2_FOUND 1)
diff --git a/scripts/DDServer.env.in b/scripts/DDServer.env.in
index ea4eb51..e6342d0 100644
--- a/scripts/DDServer.env.in
+++ b/scripts/DDServer.env.in
@@ -1,9 +1,13 @@
 #!/bin/bash
 
-DDBASE=/home/budnik/AMDA-NG.core/DDBASE/DATA
-DDPATH=/home/budnik/AMDA-NG.core/DDBASE
-DDLIB=@DDCLIENTLIB_DIR@
+DDBASE=/home/budnik/DDBASE/DATA
+DDPATH=/home/budnik/DDBASE
+DDLIB=@DDCLIENTLIB_DIR@/
 DDBASEBIN=@CMAKE_INSTALL_PREFIX@/bin
 LD_LIBRARY_PATH=$DDLIB/:@NETCDFLIB_DIR@:@libcdf_LIBRARY_DIR@:@USRLIB_DIR@
 DATAMANAGER=@CMAKE_INSTALL_PREFIX@/bin/DATAMANAGER
+REMOTEDATA=@CMAKE_INSTALL_PREFIX@/bin/REMOTEDATA
+CALLEXT=@CMAKE_INSTALL_PREFIX@/bin/CALLEXT
+
 export DDBASE DDPATH DDBASEBIN DDLIB LD_LIBRARY_PATH
+export DATAMANAGER REMOTEDATA CALLEXT
diff --git a/src/CALLEXT/createVI.php b/src/CALLEXT/createVI.php
index 41e3308..198b21c 100755
--- a/src/CALLEXT/createVI.php
+++ b/src/CALLEXT/createVI.php
@@ -62,25 +62,35 @@
 		$baseMgr->createVi();
 // 	if (verbose)
 // 		error_log("request to add Data Set ".$base.":".$remSetID." as ".$ViId.PHP_EOL, 3, log); 
-//  
-//-------------- Get Full Dataset Info file from distant database-------------
-//   
+//     
 		$center = new $base();
 
 		$startStamp = strtotime($baseMgr->globalStart);
 		$stopStamp = strtotime($baseMgr->globalStart."+1 day");
 		$start = date( "Ymd\THis\Z", $startStamp);
-		$stop = date( "Ymd\THis\Z", $stopStamp);
+		$stop = date( "Ymd\THis\Z", $stopStamp-60.0);
 		
 		$startIso = date( "Y-m-d\TH:i:s\.000\Z", $startStamp);
 		$stopIso = date( "Y-m-d\TH:i:s\.000\Z", $stopStamp);
-		
+		// Get Full Dataset Info file from distant database
+		$infoFile = $center->getDatasetInfo($remSetID);
+		 
+		if ($infoFile) 
+		{
+			echo "INFO ".$infoFile.PHP_EOL;
+			$baseMgr->setInfo($infoFile);
+		}
+		 
 		$ncFiles = $center->getData($remSetID, $start, $stop);
 		
-		$baseMgr->addRemoteData($remSetID, $ncFiles, $startIso, $stopIso);
- 		echo " START-STOP  ".$start." ".$stop.PHP_EOL;
-//     if (!$res) 
-// 	error_log("Error: Can't get dataset info for ".$remSetID." from ".$dataBaseID.PHP_EOL, 3, err);
+		if (!$infoFile && $ncFiles)
+		{
+			echo "INFO ".$ncFiles[0].PHP_EOL;
+			$baseMgr->setInfo($ncFiles[0]);
+		}
+		
+		$baseMgr->addRemoteData($remSetID, $ncFiles, $startIso, $stopIso); 		
+ //		echo "START-STOP  ".$start." ".$stop.PHP_EOL;
 
 //     if (verbose) error_log("Get dataset info for ".$remSetID." from ".$dataBaseID." returns ".$res.PHP_EOL, 3, log);
 	 
diff --git a/src/CALLEXT/getData.php b/src/CALLEXT/getData.php
index 1503dbf..bf0d305 100644
--- a/src/CALLEXT/getData.php
+++ b/src/CALLEXT/getData.php
@@ -26,25 +26,26 @@
   if (!function_exists('__autoload')) 
 	{
 		function __autoload($class_name) {
-				require_once $class_name . '.php';
+				require_once $class_name.'.php';
 		}
 	}
    
    putenv("LD_LIBRARY_PATH=".getenv("LD_LIBRARY_PATH"));
 	putenv("PATH=./:".getenv("DDBASEBIN").":/bin:/usr/bin");
 	set_include_path("./:".getenv("DATAMANAGER").":".getenv("REMOTEDATA").":".getenv("CALLEXT"));
+	 
 	date_default_timezone_set('UTC');
 	$startStamp = strtotime($Start);
 	$stopStamp = strtotime($Stop);
 	$start = date( "Ymd\THis\Z", $startStamp);
 	$stop = date( "Ymd\THis\Z", $stopStamp);
-		
+	
 	$startIso = date( "Y-m-d\TH:i:s\.000\Z", $startStamp);
 	$stopIso = date( "Y-m-d\TH:i:s\.000\Z", $stopStamp);
 	// Get data and convert to nc
 	$center = new $base();
 	
-	$ncFiles = $base->getData($id, $start, $stop);	
+	$ncFiles = $center->getData($id, $start, $stop);	
 	
 	// Add nc to Vi
 	$baseMgr = new DDBaseMgr();
diff --git a/src/DATA/INFOLOCAL2NC/CMakeLists.txt b/src/DATA/INFOLOCAL2NC/CMakeLists.txt
deleted file mode 100644
index 7cf3ec9..0000000
--- a/src/DATA/INFOLOCAL2NC/CMakeLists.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-
-PROJECT(infoLocal2nc)
-
-include_directories(
-  ${DDCLIENTINCLUDE_DIR}
-  ${NETCDFINCLUDE_DIR}
-  ${LIBXML2_INCLUDE_DIR}
-)
-
-#ConLIBXML2_INCLUDE_DIRfiguration de l'exécutable
-file(
-        GLOB_RECURSE
-        source_files
-        ./*
-)
-  
-ADD_EXECUTABLE (infoLocal2nc ${source_files} )
-
-target_link_libraries(
-  infoLocal2nc
-  ${DDCLIENTLIBRARY}
-  ${NETCDFLIBRARY}
-  ${LIBXML2_LIBRARIES}
-)
-
-install (TARGETS infoLocal2nc DESTINATION bin)
diff --git a/src/DATA/INFOLOCAL2NC/infoLocal2nc.c b/src/DATA/INFOLOCAL2NC/infoLocal2nc.c
deleted file mode 100755
index 89e3abd..0000000
--- a/src/DATA/INFOLOCAL2NC/infoLocal2nc.c
+++ /dev/null
@@ -1,132 +0,0 @@
-/**
-*  @file infoLocal2nc.c
-*  @version $Id: infoLocal2nc.c,v 1.4 2012/11/12 09:55:15 budnik Exp $
-*  @brief DD Server Tools: Stand alone executable to convert info.xml to info.nc
-*  @arg  xml_name nc_name
-*
-*/
-/*================================================================================
- *                       DD
- *                  Server Manager
- *                    infoLocal2nc.c
- *                      V.1.0
- *     args -> XML name and nc name
- *     Modification of info2nc
- *================================================================================*/
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <time.h>
-#include <math.h>
-#include <netcdf.h>
-#include <libxml/xmlmemory.h>
-#include <libxml/parser.h>
-#include <libxml/xpath.h>
-#include <DD.h>
-#include <DD_comm.h>
-
-/*----------- General constants ----------------------------*/
-#define MAXVAR       100
-#define BASEDIR     "DDBASE"
-
-/*------------- Global variables ---------------------------*/
-char temp[MAXVAR][PATHLENGTH];
-
-int main(int argc, char **argv)
-{
-    char *ncname;
-    xmlDocPtr doc;    
-    int i = 0, status;               
-    xmlNodePtr cur;
-    size_t length;
-
-    int fileID;
-    int InfoDimID, VarID[MAXVAR];
-    double number;
-    char DocPath[PATHLENGTH], *BasePathP;
-    /*---------- Get Target name from arguments -------------*/
-    if (argc < 3) 
-    {
-       fprintf(stderr,"Usage: infoLocal2nc SourceName TargetName\n");
-       exit(0);
-    }
- 
-    /*------- Get full source name --------------------*/
-    if((BasePathP = getenv(BASEDIR)) == NULL)
-    {
-       fprintf(stderr,"infoLocal2nc: no %s environment\n",BASEDIR);
-       exit(0);
-    }
-    strcpy(DocPath,argv[1]);
-         
-    ncname = argv[2];
-    doc = xmlParseFile(DocPath);
-        
-    if(doc == NULL ) 
-    {
-       fprintf(stderr,"infoLocal2nc: Source document %s is not parsed successfully.\n",DocPath);
-       exit(0);  
-    } 
-
-    cur = xmlDocGetRootElement(doc); //GO the first node
-    if (cur == NULL) 
-    {
-        fprintf(stderr,"info2nc: empty Source Document %s\n",DocPath);
-        xmlFreeDoc(doc);
-        exit(0);
-    }
-
-//  Define nc file
-    ncopts = NC_VERBOSE;
-
-    if((status = nc_create(ncname,NC_CLOBBER, &fileID))  != NC_NOERR)
-    {
-       fprintf(stderr,"info2nc: Could not create file %s\n",ncname);
-       exit(1);
-    }
-    status = nc_def_dim(fileID,"info",PATHLENGTH, &InfoDimID);        
-    status = nc_enddef(fileID);
-    
-//  Now treat  info.xml          
-    cur = cur->xmlChildrenNode;
-    while (cur != NULL)
-    {                                                                   
-       if (xmlStrcmp(cur->name, (const xmlChar *)"text"))
-       { 
-          status = nc_redef(fileID);
-          if ((!xmlStrcmp(cur->name, (const xmlChar *)"MinSampling")) || 
-              (!xmlStrcmp(cur->name, (const xmlChar *)"MaxSampling")) ||
-	      (!xmlStrcmp(cur->name, (const xmlChar *)"FillValue")))
- 
-             status = nc_def_var(fileID, (char *)cur->name, NC_DOUBLE, 0, &InfoDimID, &VarID[i]);
- 
-          else 
-            status = nc_def_var(fileID, (char *)cur->name, NC_CHAR, 1, &InfoDimID, &VarID[i]);
-          status = nc_enddef(fileID);
-
-          if ((cur->xmlChildrenNode) != NULL)
-          { 
-             length = strlen((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));                      
-             strcpy(temp[i], (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
-             temp[i][length]='\0';
- 
-             if ((!xmlStrcmp(cur->name, (const xmlChar *)"MinSampling")) ||
-                 (!xmlStrcmp(cur->name, (const xmlChar *)"MaxSampling")) || 
-		 (!xmlStrcmp(cur->name, (const xmlChar *)"FillValue"))) 
-             {
-                number = atof(temp[i]);
-                status = nc_put_var_double(fileID, VarID[i], &number);
-             } else status = nc_put_var_text(fileID,VarID[i],temp[i]);
-          }                     
-          i++;
-                 
-      }           
-      cur = cur->next; 
-   }
-
-   xmlFree(cur);                                    
-   xmlFreeDoc(doc);   
-   status=nc_close(fileID);
-   exit(1);
-}
-/*==========================================================================================================*/
diff --git a/src/DATA/JOIN_NC/CMakeLists.txt b/src/DATA/JOIN_NC/CMakeLists.txt
deleted file mode 100644
index 6c4703c..0000000
--- a/src/DATA/JOIN_NC/CMakeLists.txt
+++ /dev/null
@@ -1,24 +0,0 @@
-
-PROJECT(join_nc)
-
-include_directories(
-  ${DDCLIENTINCLUDE_DIR}
-  ${NETCDFINCLUDE_DIR}
-)
-
-#Configuration de l'exécutable
-file(
-        GLOB_RECURSE
-        source_files
-        ./*
-)
-  
-ADD_EXECUTABLE (join_nc ${source_files} )
-
-target_link_libraries(
-  join_nc
-  ${DDCLIENTLIBRARY}
-  ${NETCDFLIBRARY}
-)
-
-install (TARGETS join_nc DESTINATION bin)
diff --git a/src/DATA/JOIN_NC/join_nc.c b/src/DATA/JOIN_NC/join_nc.c
deleted file mode 100644
index 82e4b5e..0000000
--- a/src/DATA/JOIN_NC/join_nc.c
+++ /dev/null
@@ -1,139 +0,0 @@
-/* $Id: join_nc.c,v 1.2 2008/06/13 09:17:30 elena Exp $ */ 
-/** 
-*  @file join_nc.c
-*  @brief append input nc file to output nc file
-*  @arg input-file output-file
-*  @todo  Process errors - if needed ?
-*  @date 03.01.2008
-*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <netcdf.h>
-
-void  handle_error(int status)
-{
-  fprintf(stderr, "%s\n", nc_strerror(status));
-  exit(1);
-}
-
-int main(int argc, char *argv[])
-{
-   int status, ncID, infoID;
-   int ndims, nvars, ngatts, unlimdimid;
-   size_t dimlength, totalDimension = 1;
-   size_t *start, *count;
-   char dimname[NC_MAX_NAME], varname[NC_MAX_NAME], attname[NC_MAX_NAME];
-   int i, j;
-   int dimID[NC_MAX_DIMS];
-   int varID[NC_MAX_DIMS];
-   char constantInfoFile[NC_MAX_ATTRS];
-   char infoFile[NC_MAX_ATTRS];
-   nc_type var_type;                                                   /* variable type */
-   int var_ndims;                                                      /* number of dims */
-   int var_dimids[NC_MAX_VAR_DIMS];                                    /* dimension ids */
-   int var_natts;                                                      /* number of attributes */
-   void *variable;
-
-
-   if (argc < 3)
-    {
-       fprintf(stderr,"Usage: join_nc inputName outputName\n");
-       exit(0);
-    }
-   
-   strcpy(constantInfoFile,argv[1]);
-   strcpy(infoFile,argv[2]);
-  
-   if ((status = nc_open(infoFile, NC_WRITE, &ncID)) != NC_NOERR)
-                                                handle_error(status);
-
-   if ((status = nc_open(constantInfoFile, NC_NOWRITE, &infoID)) != NC_NOERR)
-                                                       handle_error(status);
-
-   if ((status = nc_inq(infoID, &ndims, &nvars, &ngatts, &unlimdimid)) != NC_NOERR)
-                                                       handle_error(status);
-// file into DEFINITION mode
-   nc_redef(ncID); 
-     
-//  Start with adding dimensions   
-     for (i = 0; i < ndims; i++) {
-        status = nc_inq_dim(infoID, i, dimname, &dimlength);
-        if (status == NC_NOERR) nc_def_dim(ncID, dimname, dimlength, &dimID[i]); 
-      }
-
-// adding Global Attributes
-
-    if (ngatts > 0)  
-         for (i = 0; i < ngatts; i++) {
-              status = nc_inq_attname(infoID, NC_GLOBAL, i, attname);
-              if (status == NC_NOERR) nc_copy_att(infoID, NC_GLOBAL, attname, ncID, NC_GLOBAL);  
-         }  
-     nc_enddef(ncID); 
-                            
-//  adding variables 
-      for (i = 0; i < nvars; i++) {
-        nc_redef(ncID); 
-
-        
-        status = nc_inq_var (infoID, i, varname, &var_type, &var_ndims, var_dimids, &var_natts);
-        start = (size_t *) malloc(var_ndims*sizeof(size_t));
-        count = (size_t *) malloc(var_ndims*sizeof(size_t));
-        for (j = 0; j <  var_ndims; j++)  {                               
-                status = nc_inq_dimlen(infoID, var_dimids[j], &dimlength);
-                if (status == NC_NOERR) totalDimension *= dimlength;
-                 start[j] = 0; 
-                 count[j] = dimlength;  
-                 var_dimids[j] = dimID[var_dimids[j]];
-          }
-        if (status == NC_NOERR) nc_def_var(ncID, varname, var_type, var_ndims, var_dimids, &varID[i]); 
-        if (var_natts > 0)  
-            for (j = 0; j < var_natts; j++) {    
-               status = nc_inq_attname(infoID, i, j, attname);
-               if (status == NC_NOERR) nc_copy_att(infoID, i, attname, ncID, varID[i]);
-         } 
-        nc_enddef(ncID);
-
-         switch(var_type){
-          case NC_FLOAT: {                    
-                  variable = (float *) malloc(totalDimension*sizeof(float)); 
-                  status = nc_get_vara_float(infoID, i, start, count, variable);
-                  if (status == NC_NOERR) nc_put_vara_float(ncID, varID[i], start, count, variable);
-                 break;
-               }
-          case NC_DOUBLE: {
-                  variable = (double *) malloc(totalDimension*sizeof(double)); 
-                  status = nc_get_vara_double(infoID, i, start, count, variable);
-                  if (status == NC_NOERR) nc_put_vara_double(ncID, varID[i], start, count, variable);
-                  break;
-                }
-          case NC_SHORT: {
-                 variable = (short *) malloc(totalDimension*sizeof(short));
-                 status = nc_get_vara_short(infoID, i, start, count, variable);
-                 if (status == NC_NOERR) nc_put_vara_short(ncID, varID[i], start, count, variable);
-                 break;
-                }
-          case NC_INT: {
-                 variable = (int *) malloc(totalDimension*sizeof(int));
-                 status = nc_get_vara_int(infoID, i, start, count, variable);
-                 if (status == NC_NOERR) nc_put_vara_int(ncID, varID[i], start, count, variable);
-                 break;
-              }
-          case NC_CHAR: {
-                 variable = (char *) malloc(totalDimension*sizeof(char));
-                 status = nc_get_vara_text(infoID, i, start, count, variable);
-                 if (status == NC_NOERR) nc_put_vara_text(ncID, varID[i], start, count, variable);
-               }
-        }
-           totalDimension = 1;
-           free(variable); free(start); free(count);
-       }         
-   
-
-   if ((status = nc_close(ncID)) != NC_NOERR)
-                                    handle_error(status);
-
-   if ((status = nc_close(infoID)) != NC_NOERR)
-                                    handle_error(status);
-}
diff --git a/src/DATA/MAKEDDSYS/CMakeLists.txt b/src/DATA/MAKEDDSYS/CMakeLists.txt
deleted file mode 100644
index 6603d9a..0000000
--- a/src/DATA/MAKEDDSYS/CMakeLists.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-
-PROJECT(makeDDsys)
-
-include_directories(
-  ${DDCLIENTINCLUDE_DIR}
-  ${NETCDFINCLUDE_DIR}
-  ${LIBXML2_INCLUDE_DIR}
-)
-
-#Configuration de l'exécutable
-file(
-        GLOB_RECURSE
-        source_files
-        ./*
-)
-  
-ADD_EXECUTABLE (makeDDsys ${source_files} )
-
-target_link_libraries(
-  makeDDsys
-  ${DDCLIENTLIBRARY}
-  ${NETCDFLIBRARY}
-  ${LIBXML2_LIBRARIES}
-)
-
-install (TARGETS makeDDsys DESTINATION bin)
diff --git a/src/DATA/MAKEDDSYS/makeDDsys.c b/src/DATA/MAKEDDSYS/makeDDsys.c
deleted file mode 100755
index f83f05c..0000000
--- a/src/DATA/MAKEDDSYS/makeDDsys.c
+++ /dev/null
@@ -1,204 +0,0 @@
-/*================================================================================
- *                       DD
- *                Server Package
- *                  makeDDsys.c
- *                     V.4.2
- *  Stand-alone executable to create refer.nc file form DDsys.xml file
- *  Program search the DDsys.xml in the directory $DDBASE, and creates
- *  refer.nc in this directory. See structure of DDsys.xml in 
- * ../DOC/TECHDOC/DDBaseStruc.html
- * 
- * Versions:
- *     Apr 23 1997, V.2.0 Adding CASH into refer.nc file 
- *     Jun 18 2007, V.3.0 Length 128
- *     1 Aug 2007,  V.4.0 XML version
- *     6 Sep 2007,  V.4.1 Knizhnikova-Fedorova, small changes
- *     9 Nov 2009,  V.4.2 netCDF 3
- *================================================================================*/
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <time.h>
-#include <math.h>
-#include <netcdf.h>
-#include <libxml/xmlmemory.h>
-#include <libxml/parser.h>
-#include <libxml/xpath.h>
-#include <DD.h>
-#include <DD_comm.h>
-
-/*----------- General constants ----------------------------*/
-#define MAXVIRIN 1000
-#define SOURCENAME  "/DDsys.xml"
-#define BASEDIR     "DDBASE"
-
-/*----------- Global variables ------------------------------*/
-char varname[MAXVIRIN][PATHLENGTH];
-char datadirname[MAXVIRIN][PATHLENGTH];
-char timesname[MAXVIRIN][PATHLENGTH];
-char infoname[MAXVIRIN][PATHLENGTH];
-char cashname[MAXVIRIN][PATHLENGTH];
-
-int basenumber;           /* number of virtual instruments */
-
-/*---------------------- REFER CREATE ------------------------*/
-void ReferCreate(char *BasePathP)
-{
-   int fileID;
-   int InfoDimID, LengthDimID;
-   int VarDimVector[2];
-   int VarID[MAXVIRIN];
-   size_t DirStart[2] = {0L,0L};
-   size_t TimesStart[2] = {1L,0L};
-   size_t InfoStart[2] = {2L,0L};
-   size_t CashStart[2] = {3L,0L};
-   size_t VarCount[2] = {1L,PATHLENGTH};
-   int i, status;
-   char DestPath[PATHLENGTH];
-
-  // ncopts = NC_VERBOSE;
-   
-   /*
-    * Full path name
-    */
-   
-    strcpy(DestPath,BasePathP);
-    strcat(DestPath,REFNAME);
-
-   if((status =  nc_create( DestPath, NC_CLOBBER, &fileID)) != NC_NOERR)
-   {
-     fprintf(stderr,"makeDDsys: Could not create file %s\n",DestPath);
-     exit(1);
-   }
-
-   nc_def_dim(fileID, "info", 4L, &InfoDimID);
-   nc_def_dim(fileID, "length", PATHLENGTH, &LengthDimID);
-  
-   VarDimVector[0] = InfoDimID;
-   VarDimVector[1] = LengthDimID;
-
-   for(i = 0; i < basenumber; i++)
-        nc_def_var(fileID, varname[i], NC_CHAR, 2, VarDimVector, &VarID[i]);
-
-   nc_enddef(fileID);
-
-   for(i = 0; i < basenumber; i++)
-   {       
-       nc_put_vara_text(fileID,VarID[i],DirStart,VarCount,(void *)datadirname[i]);
-       nc_put_vara_text(fileID,VarID[i],TimesStart,VarCount,(void *)timesname[i]);
-       nc_put_vara_text(fileID,VarID[i],InfoStart,VarCount,(void *)infoname[i]);
-       nc_put_vara_text(fileID,VarID[i],CashStart,VarCount,(void *)cashname[i]);
-      
-   }
-   status = nc_close(fileID);
-}
-/*--------------------------------------------------------------------------*/
- 
- int main(int argc, char **argv)
-{
-    
-    xmlDocPtr doc;
-    xmlChar *xpath = (xmlChar*) "//VI";    
-    xmlNodeSetPtr nodeset;
-    xmlXPathObjectPtr result;
-    int i, j, size = 2, length;
-    xmlChar *name, *argsNr;            
-    xmlXPathContextPtr context;
-    xmlNodePtr cur;
-    char BasePath[PATHLENGTH], *BasePathP;
-
-    /*
-     * Create full Source Name 
-     */
-    if((BasePathP = getenv(BASEDIR)) == NULL)
-    {
-       fprintf(stderr,"makeDDsys: no %s environment\n",BASEDIR);
-       exit(0);
-    }
-    strcpy(BasePath,BasePathP);
-    strcat(BasePath,SOURCENAME);
-    
-    doc = xmlParseFile(BasePath);
-    if (doc == NULL ) 
-    {
-       fprintf(stderr,"Document not parsed successfully. \n");
-       exit(0);
-    } 
-
-    context = xmlXPathNewContext(doc);
-    if (context == NULL) 
-    {
-        fprintf(stderr,"Error in xmlXPathNewContext\n");
-        exit(0);
-    }
-    result = xmlXPathEvalExpression(xpath, context);
-  
-    if (result == NULL) 
-    {
-        fprintf(stderr,"Error in xmlXPathEvalExpression\n");
-        exit(0);
-    }
-
-    if(xmlXPathNodeSetIsEmpty(result->nodesetval))
-    {
-       xmlXPathFreeObject(result);
-       fprintf(stderr,"No result\n");
-       exit(0);
-    }
-    if (result) 
-    {
-       nodeset = result->nodesetval;
-       fprintf(stderr," VI number: %d\n", nodeset->nodeNr);
-       basenumber = nodeset->nodeNr;
-       for (i = 0; i < nodeset->nodeNr; i++) 
-       { 
-          cur = nodeset->nodeTab[i]->xmlChildrenNode;  
-          while (cur != NULL)
-          { 
-             if((xmlStrcmp(cur->name, (const xmlChar *)"text"))){
-             length = strlen((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
- 
-             }
-              if (!(xmlStrcmp(cur->name, (const xmlChar *)"NAME")))
-              { 
-                  
-                           strncpy(varname[i], (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1), length);              
-              }    
-              if (!(xmlStrcmp(cur->name, (const xmlChar *)"LOCATION")))
-              { 
-                 strncpy(datadirname[i], (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1), length);                  
-              }   
-              if (!(xmlStrcmp(cur->name, (const xmlChar *)"TIMES")))
-              {                    
-                 strncpy(timesname[i],datadirname[i], strlen(datadirname[i]));
-                 strncpy(&timesname[i][strlen(datadirname[i])], (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1), length);
-             
-              }   
-              if (!(xmlStrcmp(cur->name, (const xmlChar *)"INFO")))
-              {                 
-                  strncpy(infoname[i],datadirname[i], strlen(datadirname[i]));
-                  strncpy(&infoname[i][strlen(datadirname[i])], (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1), length);
-              }   
-              if (!(xmlStrcmp(cur->name, (const xmlChar *)"CACHE")))
-              {                  
-                 strncpy(cashname[i],datadirname[i], strlen(datadirname[i]));
-                 strncpy(&cashname[i][strlen(datadirname[i])], (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1), length);
-              }  
-                                                                      
-              cur = cur->next;              
-           }                          
-       }
-       xmlFree(cur);
-       xmlXPathFreeObject(result);    
-   }
-           
-   xmlXPathFreeContext(context);   
-   xmlFreeDoc(doc);
-   xmlCleanupParser();
-
-   ReferCreate(BasePathP);
-   return (1);
-}
-/*================================================================================*/
-
diff --git a/src/DATA/MANAGER/DDBaseMgr.php b/src/DATA/MANAGER/DDBaseMgr.php
index f24995e..08f29b5 100644
--- a/src/DATA/MANAGER/DDBaseMgr.php
+++ b/src/DATA/MANAGER/DDBaseMgr.php
@@ -227,9 +227,24 @@ class DDBaseMgr
 		
 		system("TimesUpdateNoData ".strtolower($id)."_times.nc ".$start." ".$stop);
 		
+		echo strtolower($id)."_times.nc ".$start." ".$stop.PHP_EOL;
 		chdir($WORKING_DIR);
 		$this->unlockVi();
 	}
+	
+	public function setInfo($infoFile)
+	{		
+		$fullInfoName = getenv("DDBASE")."/../INFO/bases/".$this->base."/$infoFile";
+	 	 
+		if (file_exists($fullInfoName)) unlink($fullInfoName);
+		//TODO errors		
+			//if (!file_exists($infoFile))	
+		$WORKING_DIR = getcwd();
+		echo "$WORKING_DIR/$infoFile, $fullInfoName".PHP_EOL;
+		rename("$WORKING_DIR/$infoFile", $fullInfoName);
+		
+		//system("gunzip -c ".$this->ViDir."/$ncFile.gz > $fullAliasName");
+	}
 } 
 ?>   
   
\ No newline at end of file
diff --git a/src/DATA/STARTSTOPLOCAL/CMakeLists.txt b/src/DATA/STARTSTOPLOCAL/CMakeLists.txt
deleted file mode 100644
index 0bf8470..0000000
--- a/src/DATA/STARTSTOPLOCAL/CMakeLists.txt
+++ /dev/null
@@ -1,24 +0,0 @@
-
-PROJECT(StartStopLocal)
-
-include_directories(
-  ${DDCLIENTINCLUDE_DIR}
-  ${NETCDFINCLUDE_DIR}
-)
-
-#Configuration de l'exécutable
-file(
-        GLOB_RECURSE
-        source_files
-        ./*
-)
-  
-ADD_EXECUTABLE (StartStopLocal ${source_files} )
-
-target_link_libraries(
-  StartStopLocal
-  ${DDCLIENTLIBRARY}
-  ${NETCDFLIBRARY}
-)
-
-install (TARGETS StartStopLocal DESTINATION bin)
diff --git a/src/DATA/STARTSTOPLOCAL/StartStopLocal.c b/src/DATA/STARTSTOPLOCAL/StartStopLocal.c
deleted file mode 100644
index 7941906..0000000
--- a/src/DATA/STARTSTOPLOCAL/StartStopLocal.c
+++ /dev/null
@@ -1,75 +0,0 @@
- 
-/** @file  StartStopLocal.c
-*   @brief Stand-alone executable <br> Returns real Start-Stop for VI in DDBase <br>
-*          Update Start-Stop times in INFO files for LOCAL data<br>
-*    @details StartStopLocal(string *)  <br>
-*    @arg @c argv[1] Virtual Instrument ID (DD notation) <br>
-*     Output: YYYYDDdayHHMMSSMLS-YYYYDDdayHHMMSSMLS       
-*                 
-*    @date 10.10.2007
-*    @version $Id: StartStopLocal.c,v 1.4 2011/09/05 11:27:34 budnik Exp $  
-*/
-
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <time.h>
-#include <math.h>
-#include <netcdf.h>
-#include <DD.h>
-
-
-int DataID, RecID,  StartID, StopID;
-size_t RecNum;
-char StartT[TIMELENGTH], StopT[TIMELENGTH], Var[128];
-size_t count[2] = {1L,TIMELENGTH};
-size_t start[2] = {0L,0L};
-size_t countVar[2] = {1L,128L};
-
-/*---------------- NC ERROR --------------------------------------*/
-void nc_handle_error(int status)
-{
-  fprintf(stderr, "%s\n", nc_strerror(status));
-  exit(1);
-}
-
-/* ----------------------- MAIN ------------------------------------*/
-  int main(int argc, char *argv[])
-{
-    
-    int status, len;
-
-
-/* Open VI_times.nc */
-      
-       if ((status = nc_open(argv[1], NC_NOWRITE, &DataID)) != NC_NOERR)
-                                                nc_handle_error(status);
-
-       if ((status = nc_inq_dimid(DataID, "record", &RecID)) != NC_NOERR)
-                                          nc_handle_error(status);
-     
-/*   Get Number of Records */
-   
-      if ((status = nc_inq_dimlen(DataID, RecID, &RecNum)) != NC_NOERR)
-                                          nc_handle_error(status);
-
-      if ((status = nc_inq_varid(DataID, "StartTime", &StartID)) != NC_NOERR)
-                                          nc_handle_error(status);
-      if ((status = nc_inq_varid(DataID, "StopTime", &StopID)) != NC_NOERR)
-                                          nc_handle_error(status);
-
-/* Get The First Start and The Last Stop Times  */    
-      start[0] = 0;     
-
-     if((status = nc_get_vara_text(DataID, StartID, start, count, StartT)) != NC_NOERR)
-                                          nc_handle_error(status);
-
-      start[0] = RecNum-1; 
-      if((status = nc_get_vara_text(DataID, StopID, start, count, StopT)) != NC_NOERR)
-                                          nc_handle_error(status);
- 
-      printf("%s-%s\n",  StartT, StopT);
-      if ((status = nc_close(DataID)) != NC_NOERR) nc_handle_error(status);
-    
-}
diff --git a/src/DATA/TIMESUPDATE/CMakeLists.txt b/src/DATA/TIMESUPDATE/CMakeLists.txt
deleted file mode 100644
index 1713a7d..0000000
--- a/src/DATA/TIMESUPDATE/CMakeLists.txt
+++ /dev/null
@@ -1,24 +0,0 @@
-
-PROJECT(TimesUpdate)
-
-include_directories(
-  ${DDCLIENTINCLUDE_DIR}
-  ${NETCDFINCLUDE_DIR}
-)
-
-#Configuration de l'exécutable
-file(
-        GLOB_RECURSE
-        source_files
-        ./*
-)
-  
-ADD_EXECUTABLE (TimesUpdate ${source_files} )
-
-target_link_libraries(
-  TimesUpdate
-  ${DDCLIENTLIBRARY}
-  ${NETCDFLIBRARY}
-)
-
-install (TARGETS TimesUpdate DESTINATION bin)
diff --git a/src/DATA/TIMESUPDATE/TimesUpdate.c b/src/DATA/TIMESUPDATE/TimesUpdate.c
deleted file mode 100755
index 0f02a70..0000000
--- a/src/DATA/TIMESUPDATE/TimesUpdate.c
+++ /dev/null
@@ -1,431 +0,0 @@
-/* $Id: TimesUpdate.c,v 1.3 2008/02/19 16:24:58 elena Exp $*/
-/*=====================================================================
- *                  DD SYSTEM base package
- *                   DD_Server library
- *                    TimesUpdate.c
- *                        V.4.6
- *
- *  usage TimesUpdate -r/-i[-u]/-d nc_times_file nc_data_file[*.gz] nc_data_file[*.gz] ....
- *  Note that in most of cases at the end of activity you have to run ClearTimes nc_times_file
- *
- *  Versions:
- *  Apr 23 1997, Usung *.gz files  V.2.0
- *  Jan 4, 2006, V.3.0 - insert file and check overlaping
- *  Jan 13,2006, V.3.1 - error is corrected
- *  Feb 02,2006, V.3.2 - Corrected removing database in case of error
- *  Sep 20, 2007, V.4.0, Fedorov, from rehash.nc. New NetCDF V.3, syncronization
- *  Sep 25, 2007  V.4.1 The very first file and first file insert
- *  Nov 29, 2007  V.4.2 If several first records - bug correction 
- *  Feb 17, 2008  V.4.5 Fedorov: New options , remake, insert, delete
- *  Feb 19, 2008  V.4.6 delete bugs corrected
- *=====================================================================*/
- /*=====================================================================
- * Description:
- * Program reads list of nc_data_files, probabbly gzipped, reads StartTime and Stop time
- * and create or update nc_times_file. The sequence of data files are not important
- * -r remove nc_times_file and create new one
- * -i insert new file(s)
- * -d remove file(s) from nc_times
- *
- * Dimensions:
- * TimeLingth   TIMELENGTH
- * NameLength   NAME_DIM
- * Record       Unlimited
- * Variables:
- *
- * char StartTime[TIMELENGTH]
- * char EndTime[TIMELENGTH]
- * 
- * Attributes:
- * none
- *======================================================================*/
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-#include <dirent.h>
-#include <netcdf.h>
-#include <math.h>
-#include <DD.h>
-
-/* Global Constant definitions */
-
-#define TIME_LENGTH_NAME "TimeLength"
-#define TIME_LENGTH 17L
-#define REC_DIM_NAME "record"
-#define REC_DIM NC_UNLIMITED
-#define NAME_DIM_NAME "NameLength"
-#define NAME_DIM 32L
-#define NAME_LENGTH 100
-
-#define STARTTIME "StartTime"
-#define STOPTIME   "StopTime"
-#define FILENAME   "FileName"
-
-#define TIME_TYPE NC_CHAR
-
-#define TEMPUNZIP "TimesUpdateTemp.nc\0"
-#define NODATA "NODATA\0"
-
-/*----------- Conditions --------------------------*/
-enum Conditions {ALLLEFT,LEFTOVER,WELLIN,RIGHTOVER,ALLRIGHT,LEFTRIGHTOVER,LEFTIN};
-
-/*----------- Modes -------------------------------*/
-enum Modes {REMAKE, INSERT, DELETE};
-
-/*----------- Type definition ------------------------------*/
-typedef struct
-{
-   char Name[NAME_LENGTH];   // current data file 
-   char StartS[TIME_LENGTH]; // Start Time String
-   char StopS[TIME_LENGTH];  // Stop Time String
-   double StartD;            // Start double
-   double StopD;             // Stop double 
-} t_StartStop;
-
-/*---------- Global variables (IDs) of open times file -------------*/
-   int tmID;  /* nc file descriptor */
-   int StartID, StopID, NameID;
-   size_t RecordsNumber = 0; // Records Number of the existing times file
-   static char ZeroTime[TIME_LENGTH] = "0000000000000000\0";
-   static int ToZipFlag = 0;
-   static char UnzipName[NAME_LENGTH];
-
-/*========================================================================
- *                 FUNCTIONS 
- *=======================================================================*/
-/*========================================================================
- *               GetFileInfo
- *=======================================================================*/
-t_StartStop *GetFileInfo(char *FileName)
-{
-   static t_StartStop StartStop;
-   int dataID;
-   int DataStartID, DataStopID;
-   static size_t DataStart[1] = {0};
-   static size_t DataCount[1] = {TIME_LENGTH};
-   char command[200];
-   int Status;
-   
-   /*---- Check if this file exist ------------*/
-   if(strcmp(FileName+strlen(FileName)-3,".gz") == 0) // Zipped file
-   {
-      strcpy(UnzipName, TEMPUNZIP);
-      sprintf(command,"gunzip -c %s > %s",FileName,UnzipName);
-      system(command);
-      ToZipFlag = 0;
-      strncpy(StartStop.Name,FileName,strlen(FileName)-3);
-   } else 
-   {
-     ToZipFlag = 1;
-     strcpy(UnzipName,FileName);
-     strcpy(StartStop.Name,FileName);
-   }
-   
-   if((Status = nc_open(UnzipName,NC_NOWRITE,&dataID)) == NC_NOERR)
-   {
-       Status = nc_inq_varid(dataID,STARTTIME,&DataStartID);
-       Status = nc_inq_varid(dataID,STOPTIME, &DataStopID); 
-         
-       Status = nc_get_vara_text(dataID,DataStartID,DataStart,DataCount,(char *)StartStop.StartS);
-       Status = nc_get_vara_text(dataID,DataStopID,DataStart,DataCount,(char *)StartStop.StopS);
-       Status = nc_close(dataID);
-   } 
-   else if(Status == 2)
-   {
-      fprintf(stderr,"File %s does not exist\n",UnzipName); 
-      return NULL;
-   }
-   else
-   {
-      fprintf(stderr,"File %s is corrupted, Error = %d\n",UnzipName,Status);
-      sprintf(command,"rm %s*",StartStop.Name);
-      system(command);
-      return NULL;
-   }
-   
-   if((isdigit(StartStop.StartS[0]) == 0) || (isdigit(StartStop.StopS[0]) == 0))
-   {
-      fprintf(stderr,"File %s is corrupted\n",UnzipName);
-      sprintf(command,"rm %s*",StartStop.Name);
-      system(command); 
-      return NULL;
-   }
-      
-   StartStop.StartD = DD_Time2Double(StartStop.StartS);
-   StartStop.StopD =  DD_Time2Double(StartStop.StopS);
-   
-   return &StartStop;
-}
-/*-----------------------------------------------------------*/
-
-/*------------------------------------------------------------
- *                 RemoveRecord()
- *-----------------------------------------------------------*/
-int RemoveRecord(size_t RecordPos, t_StartStop *StartStop)
-{
-   static size_t TimeStart[2] = {0,0};
-   static size_t TimeCount[2] = {1,TIME_LENGTH};
-   static size_t NameCount[2] = {1, NAME_DIM};
-   char CStart[TIME_LENGTH],CStop[TIME_LENGTH], CName[NAME_DIM];
-   size_t Crec;
-   char command[200];
-   int status;
-   char NewName[NAME_LENGTH];
-   
-/*------- Remove corresponding file -------------------*/
-   TimeStart[0] =  RecordPos;
-   nc_get_vara_text(tmID,NameID,TimeStart,NameCount,(char *)CName);
-   if(StartStop == NULL) NewName[0] = '\0'; else strcpy(NewName,StartStop->Name);
-   if((strcmp(CName,NODATA) != 0)&&(strcmp(CName,NewName) != 0))
-   { // Remove old file which overlap with new one */
-      sprintf(command,"rm %s*",CName);
-      system(command);
-   }
-   
-/*--- replacing Variable -----------------------*/   
-   for(Crec = RecordPos + 1; Crec < RecordsNumber; Crec++)
-   {
-     TimeStart[0] =  Crec;
-     status = nc_get_vara_text(tmID,StartID,TimeStart,TimeCount,(char *)CStart);
-     status = nc_get_vara_text(tmID,StopID,TimeStart,TimeCount,(char *)CStop);
-     status = nc_get_vara_text(tmID,NameID,TimeStart,NameCount,(char *)CName);
-     TimeStart[0]--;
-     status = nc_put_vara_text(tmID,StartID,TimeStart,TimeCount,(char *)CStart);
-     status = nc_put_vara_text(tmID,StopID,TimeStart,TimeCount,(char *)CStop);
-     status = nc_put_vara_text(tmID,NameID,TimeStart,NameCount,(char *)CName);
-   }
-   
-/*----- Set Zero at the end -------------------------*/
-   TimeStart[0] =  RecordsNumber - 1;
-   status = nc_put_vara_text(tmID,StartID,TimeStart,TimeCount,(char *)ZeroTime);
-   status = nc_put_vara_text(tmID,StopID,TimeStart,TimeCount,(char *)ZeroTime);
-   
-   RecordsNumber--;
-   nc_sync(tmID);
-   return 1;
-}  
-/*-----------------------------------------------------------*/
-
-/*------------------------------------------------------------
- *                 InsertRecord()
- *-----------------------------------------------------------*/
-int InsertRecord(size_t RecordPos, t_StartStop *StartStop)
-{
-   static size_t TimeStart[2] = {0,0};
-   static size_t TimeCount[2] = {1,TIME_LENGTH};
-   static size_t NameCount[2] = {1, NAME_DIM};
-   char CStart[TIME_LENGTH],CStop[TIME_LENGTH], CName[NAME_DIM];
-   int Crec;
-   int status;
-
-/*--- Scrall all wariables down-----------------------*/   
-   for(Crec = RecordsNumber - 1; Crec >= (int)RecordPos; Crec--)
-   {
-       TimeStart[0] =  (size_t)Crec;
-       status = nc_get_vara_text (tmID,StartID,TimeStart,TimeCount,(char *)CStart);
-       status = nc_get_vara_text (tmID,StopID,TimeStart,TimeCount,(char *)CStop);
-       status = nc_get_vara_text (tmID,NameID,TimeStart,NameCount,(char *)CName);
-       TimeStart[0]++;
-       status = nc_put_vara_text(tmID,StartID,TimeStart,TimeCount,(char *)CStart);
-       status = nc_put_vara_text(tmID,StopID,TimeStart,TimeCount,(char *)CStop);
-       status = nc_put_vara_text(tmID,NameID,TimeStart,NameCount,(char *)CName);
-   }
-
-/*------ Put the new record to empty space  -----------------*/
-   TimeStart[0] = RecordPos;
-   status = nc_put_vara_text(tmID,StartID,TimeStart,TimeCount,(char *)StartStop->StartS);
-   status = nc_put_vara_text(tmID,StopID,TimeStart,TimeCount,(char *)StartStop->StopS);
-   status = nc_put_vara_text(tmID,NameID,TimeStart,NameCount,(char *)StartStop->Name);
-   
-   RecordsNumber++;
-   nc_sync(tmID);
-   return 1;
-}
-/*==================================================================================*/
-
-/*==================================================================================
- *                              MAIN
- *==================================================================================*/
-main(int argc, char **argv)
-{
-   static char usage[] = "usage: TimesUpdate -r/-i[-u]/-d nc_times_file nc_data_file[*.gz] nc_data_file[*.gz]";
-
-   char Start[TIME_LENGTH], Stop[TIME_LENGTH], Name[NAME_DIM];
-
-/* NC definitions */
-   int TlDimID,RecDimID, NlDimID;  /* ID of dimensions */
-   
-   static size_t TimeStart[2] = {0,0};
-   static size_t TimeCount[2] = {1,TIME_LENGTH};
-   static size_t NameCount[2] = {1, NAME_DIM};
-
-   int DimVector[2];
-
-   char tmName[NAME_DIM];
-   int i, InsertFlag, FindFlag, ihole;
-   
-   char command[100];
-   char name[100];
-   int  compress = 0;
-   int status;
-   
-   double LastTime = 0.0, FirstTime = 0.0; // Times of the hall between files
-      
-   t_StartStop *CurrentRecord; // pointer to the internal static structure 
-   enum Modes CurrMode;
-   enum Conditions condition;
-
-/*=================================================================
- * Check arguments and options
- *=================================================================*/
-   if(argc < 4)  {fprintf(stderr,"%s\n",usage); exit(1); }
-   if((strcmp(argv[1], "-r")) == 0) CurrMode = REMAKE;
-   else if((strcmp(argv[1], "-i")) == 0) CurrMode = INSERT;
-   else if((strcmp(argv[1], "-u")) == 0) CurrMode = INSERT;
-   else if((strcmp(argv[1], "-d")) == 0) CurrMode = DELETE;
-   else {fprintf(stderr,"Unknown option %s\n",argv[1]); exit(1);}
-/*-----------------------------------------------------------------*/
-   
-/*=================================================================
- * Creating Times ncdf file if we have to make a new file 
- *=================================================================*/
-   switch(CurrMode)
-   {
-      case REMAKE:   /* Create New File */
-         if((status = nc_create(argv[2],NC_SHARE,&tmID)) != NC_NOERR)
-         {
-            fprintf(stderr,"Can not create file %s\n",argv[2]);
-            exit(0);
-         }
-         status = nc_def_dim(tmID,TIME_LENGTH_NAME,TIME_LENGTH,&TlDimID);
-         status = nc_def_dim(tmID,NAME_DIM_NAME,NAME_DIM,&NlDimID);
-         status = nc_def_dim(tmID,REC_DIM_NAME,REC_DIM,&RecDimID);
-         
-         DimVector[0] = RecDimID;
-         DimVector[1] = TlDimID;
-         status = nc_def_var(tmID, STARTTIME,TIME_TYPE,2,DimVector,&StartID);
-         status = nc_def_var(tmID, STOPTIME,TIME_TYPE,2,DimVector,&StopID);
-         DimVector[1] = NlDimID;
-         status = nc_def_var(tmID, FILENAME,TIME_TYPE,2,DimVector,&NameID);
-         RecordsNumber = 0;
-         TimeStart[0] = (size_t)RecordsNumber;
-         status = nc_enddef(tmID);
-         break;
-/*====== Or just open existing file ===================*/
-      case INSERT:
-      case DELETE: /* Open existing file */
-         if((status = nc_open(argv[2],NC_WRITE|NC_SHARE,&tmID)) != NC_NOERR)
-         {
-            fprintf(stderr,"Can not open file %s to write\n",argv[2]);
-            exit(0);
-         }
-         status = nc_inq_dimid(tmID,REC_DIM_NAME,&RecDimID);
-         status = nc_inq_varid(tmID, STARTTIME,&StartID);
-         status = nc_inq_varid(tmID, STOPTIME,&StopID);
-         status = nc_inq_varid(tmID, FILENAME,&NameID);
-         status = nc_inq_dimlen(tmID,RecDimID, &RecordsNumber);
-         break;
-   }
-/*==========================================================================*/
-
-   /*==========================================================================
-   * For Each file in the argument list
-   *=========================================================================*/
-   for(i = 3; i < argc; i++)
-   {  
-      switch(CurrMode)
-      {
-         case DELETE: 
-            TimeStart[0] = 0;
-            FindFlag = 0;
-            while((FindFlag == 0) && (TimeStart[0] < RecordsNumber))
-            {
-               status = nc_get_vara_text(tmID,NameID,TimeStart,NameCount,(char *)tmName);
-
-              if(strncmp(tmName, argv[i], strlen(tmName)) == 0)
-              { /* Record is found */
-                  FindFlag = 1; 
-                  RemoveRecord((size_t)TimeStart[0],(t_StartStop *)NULL);
-               }
-               else TimeStart[0]++;
-            }
-            break;
-         case REMAKE:
-         case INSERT:
-            if((CurrentRecord = GetFileInfo(argv[i])) != NULL)  /* Read current file information */
-            {
-      /*----------------- The very first file in VI DIR -------------------*/
-               if (RecordsNumber == 0) 
-               {
-                     TimeStart[0] = (size_t)0;
-                     status = nc_put_vara_text(tmID,StartID,TimeStart,TimeCount,(char *)CurrentRecord->StartS);
-                     status = nc_put_vara_text(tmID,StopID,TimeStart,TimeCount,(char *)CurrentRecord->StopS);
-                     status = nc_put_vara_text(tmID,NameID,TimeStart,NameCount,(char *)CurrentRecord->Name);
-                     RecordsNumber++;
-               } else
-               {
-                     /*---------------------------------------------------------
-                     * Searchig the same file or a hole to insert
-                     *-------------------------------------------------------*/ 
-                     InsertFlag = 0;
-                     ihole = 0;
-                     while((InsertFlag == 0) && (ihole <= RecordsNumber))
-                     {
-                        if(ihole > 0) /* Get the Left Time of the hole */
-                        {
-                           TimeStart[0] = (size_t)(ihole-1);
-                           status = nc_get_vara_text (tmID,StopID,TimeStart,TimeCount,(char *)Stop);
-                           FirstTime = DD_Time2Double(Stop);
-                        } else  FirstTime = 0.0;
-                                 
-                        if(ihole  < RecordsNumber) /* Get the Right Time of the hole */
-                        {
-                           TimeStart[0] = (size_t)ihole;
-                           status = nc_get_vara_text(tmID,StartID,TimeStart,TimeCount,(char *)Start);
-                           LastTime = DD_Time2Double(Start);
-                        }
-                        else LastTime = 1.0e16;
-            
-                        /*--------- Look the conditions ---------------*/  
-                        condition = ALLRIGHT;          
-                        if((CurrentRecord->StartD < FirstTime - 60.0) && 
-                           (CurrentRecord->StopD > LastTime + 60.0)) condition = LEFTRIGHTOVER;  
-                        else if((CurrentRecord->StartD < FirstTime - 60.0) && 
-                              (CurrentRecord->StopD < FirstTime + 60.0)) condition = ALLLEFT;
-                        else if((CurrentRecord->StartD < FirstTime - 60.0) && 
-                              (CurrentRecord->StopD > FirstTime) &&
-                              (CurrentRecord->StopD < LastTime + 60.0)) condition = LEFTOVER;
-                        else if((CurrentRecord->StartD >= FirstTime - 60.0) && 
-                              (CurrentRecord->StopD <= LastTime + 60.0)) condition = WELLIN;  
-                        else if((CurrentRecord->StartD >= FirstTime - 60.0) && 
-                              (CurrentRecord->StartD < LastTime) &&
-                              (CurrentRecord->StopD > LastTime + 60.0))condition = RIGHTOVER;  
-                        else if((CurrentRecord->StartD > LastTime - 60.0) && (CurrentRecord->StopD > LastTime + 60.0)) 
-                              condition = ALLRIGHT;  
-                  
-                        /* What to do with these conditions ----------------*/
-                        switch(condition)
-                        {
-                           case WELLIN :  InsertRecord((size_t)ihole, CurrentRecord); InsertFlag = 1; break;
-                           case ALLLEFT : RemoveRecord((size_t)(ihole-1),CurrentRecord); ihole--; break;
-                           case ALLRIGHT : ihole++; break;
-                           case LEFTOVER : RemoveRecord((size_t)(ihole-1),CurrentRecord); ihole--; break;  
-                           case RIGHTOVER : RemoveRecord((size_t)ihole,CurrentRecord); break; 
-                           case LEFTRIGHTOVER : RemoveRecord((size_t)(ihole-1),CurrentRecord);
-                                          RemoveRecord((size_t)(ihole-1),CurrentRecord); 
-                                          ihole--; break;
-                        } 
-                     } // While InsertFlag   
-               }     // if RecordsNumber > 0  
-               /*---------- Zip or remove new nc file -----------------*/
-               if(ToZipFlag) sprintf(command,"gzip -f %s",CurrentRecord->Name);
-               else sprintf(command,"rm %s",UnzipName);
-               system(command);
-            }      // If current argument file is OK
-      }            // CASE
-   }               // For several arguments
-   status = nc_close(tmID);
-   return(0);
-} 
-/*=========================================================================================================*/
diff --git a/src/DATA/TIMESUPDATENODATA/CMakeLists.txt b/src/DATA/TIMESUPDATENODATA/CMakeLists.txt
deleted file mode 100644
index 9bdfe5c..0000000
--- a/src/DATA/TIMESUPDATENODATA/CMakeLists.txt
+++ /dev/null
@@ -1,24 +0,0 @@
-
-PROJECT(TimesUpdateNoData)
-
-include_directories(
-  ${DDCLIENTINCLUDE_DIR}
-  ${NETCDFINCLUDE_DIR}
-)
-
-#Configuration de l'exécutable
-file(
-        GLOB_RECURSE
-        source_files
-        ./*
-)
-  
-ADD_EXECUTABLE (TimesUpdateNoData ${source_files} )
-
-target_link_libraries(
-  TimesUpdateNoData
-  ${DDCLIENTLIBRARY}
-  ${NETCDFLIBRARY}
-)
-
-install (TARGETS TimesUpdateNoData DESTINATION bin)
diff --git a/src/DATA/TIMESUPDATENODATA/TimesUpdateNoData.c b/src/DATA/TIMESUPDATENODATA/TimesUpdateNoData.c
deleted file mode 100644
index f881b1b..0000000
--- a/src/DATA/TIMESUPDATENODATA/TimesUpdateNoData.c
+++ /dev/null
@@ -1,330 +0,0 @@
-/**
-*  @file TimesUpdateNoData.c
-*  @version $Id: TimesUpdateNoData.c,v 1.6 2009/07/07 11:37:40 budnik Exp $
-*  @brief Program reads StartTime and StopTime and add to nc_times_file NODATA intervals
-*  
-*  @arg  nc_times_file OrderedStartTime OrderedStopTime
-*/
-
-/*=====================================================================
- *                  DD SYSTEM base package
- *                   DD_Server library
- *                    TimesUpdateNoData.c
- *                        V.1.5
- *
- *  usage TimesUpdateNoData  nc_times_file OrderedStartTime OrderedStopTime
- *   
- *=====================================================================*/
- /*=====================================================================
- * Description:
- * Program reads StartTime and StopTime and add to nc_times_file NODATA intervals 
- *  
- * 
- *
- * Dimensions:
- * TimeLingth   TIMELENGTH
- * NameLength   NAME_DIM
- * Record       Unlimited
- * Variables:
- *
- * char StartTime[TIMELENGTH]
- * char EndTime[TIMELENGTH]
- * 
- * Attributes:
- * none
- *======================================================================*/
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-#include <dirent.h>
-#include <netcdf.h>
-#include <math.h>
-#include <DD.h>
- 
-
-/* Global Constant definitions */
-#define ISOTIMER  "%d-%d-%dT%d:%d:%d.%dZ" /* Format to READ time in ISO format */ 
-#define TIME_LENGTH_NAME "TimeLength"
-#define TIME_LENGTH 17L
-#define REC_DIM_NAME "record"
-#define REC_DIM NC_UNLIMITED
-#define NAME_DIM_NAME "NameLength"
-#define NAME_DIM 32L
-#define NAME_LENGTH 100
-#define ISO_LENGTH 25
-
-#define STARTTIME "StartTime"
-#define STOPTIME   "StopTime"
-#define FILENAME   "FileName"
-
-#define TIME_TYPE NC_CHAR
-
-
-#define DATAGAP 7200
-#define NODATA "NODATA\0"
-
- 
-/*----------- Type definition ------------------------------*/
-typedef struct
-{
-   char Name[NAME_LENGTH];   // current data file 
-   char StartS[TIME_LENGTH]; // Start Time String
-   char StopS[TIME_LENGTH];  // Stop Time String
-  
-   double StartD;            // Start double
-   double StopD;             // Stop double 
-} t_StartStop;
-
-/*---------- Global variables (IDs) of open times file -------------*/
-   int tmID;  /* nc file descriptor */
-   int StartID, StopID, NameID;
-   size_t RecordsNumber = 0; // Records Number of the existing times file
-   static char ZeroTime[TIME_LENGTH] = "0000000000000000\0";
-   
-
-/*========================================================================
- *                 FUNCTIONS 
- *=======================================================================*/
-/*=====================================================================
- *                ISOTime2Double()
- * Covert double time to ISO time to Double
- *  
- *=====================================================================*/
-double ISOTime2Double(char* ISO)
-{
-  unsigned UT[7];
-  dd_tmstr_t *Time;
-  sscanf(ISO, ISOTIMER, &UT[0], &UT[1], &UT[2], &UT[3], &UT[4], &UT[5], &UT[6]);
-  Time = (dd_tmstr_t *)UT2double(UT);
-  return Time->times;
-}
-
-/*-----------------------------------------------------------*/
-
-/*------------------------------------------------------------
- *                 InsertRecord()
- *-----------------------------------------------------------*/
-int InsertRecord(size_t RecordPos, t_StartStop *StartStop)
-{
-   static size_t TimeStart[2] = {0,0};
-   static size_t TimeCount[2] = {1,TIME_LENGTH};
-   static size_t NameCount[2] = {1, NAME_DIM};
-   char CStart[TIME_LENGTH],CStop[TIME_LENGTH], CName[NAME_DIM];
-   int Crec;
-   int status;
-
-/*--- Scroll all variables down-----------------------*/   
-   for(Crec = RecordsNumber - 1; Crec >= (int)RecordPos; Crec--)
-   {
-       TimeStart[0] =  (size_t)Crec;
-       status = nc_get_vara_text (tmID,StartID,TimeStart,TimeCount,(char *)CStart);
-       status = nc_get_vara_text (tmID,StopID,TimeStart,TimeCount,(char *)CStop);
-       status = nc_get_vara_text (tmID,NameID,TimeStart,NameCount,(char *)CName);
-       TimeStart[0]++;
-       status = nc_put_vara_text(tmID,StartID,TimeStart,TimeCount,(char *)CStart);
-       status = nc_put_vara_text(tmID,StopID,TimeStart,TimeCount,(char *)CStop);
-       status = nc_put_vara_text(tmID,NameID,TimeStart,NameCount,(char *)CName);
-   }
-
-/*------ Put the new record to empty space  -----------------*/
-   TimeStart[0] = RecordPos;
-   status = nc_put_vara_text(tmID,StartID,TimeStart,TimeCount,(char *)StartStop->StartS);
-   status = nc_put_vara_text(tmID,StopID,TimeStart,TimeCount,(char *)StartStop->StopS);
-   status = nc_put_vara_text(tmID,NameID,TimeStart,NameCount,(char *)StartStop->Name);
-  
-   RecordsNumber++;
-   nc_sync(tmID);
-   return 1;
-}
-/*==================================================================================*/
-
-/*==================================================================================
- *                              MAIN
- *==================================================================================*/
-main(int argc, char **argv)
-{
-   static char usage[] = "usage: TimesUpdateNoData  nc_times_file StartTime StopTime";
-
-   char Start[TIME_LENGTH], Stop[TIME_LENGTH], Name[NAME_DIM];
-
-/* NC definitions */
-   int TlDimID,RecDimID, NlDimID;  /* ID of dimensions */
-   
-   static size_t TimeStart[2] = {0,0};
-   static size_t TimeCount[2] = {1,TIME_LENGTH};
-   static size_t NameCount[2] = {1, NAME_DIM};
-
-   int DimVector[2];
-
-   char tmName[NAME_DIM];
-   int InsertFlag;
- 
-   int i, hi, lo = 0;  
-   double StartD0, StartD1 = 0.0, StopD0, StopD1, STARTD, STOPD, CurrentStart; 
-   int StartRecord, StopRecord;
-
-   char command[100];
-   char name[100];
-   
-   int status;
-   
-   double LastTime = 0.0, FirstTime = 0.0; // Times of the hole between files
-      
-   t_StartStop CurrentRecord; //  
- 
-
-/*=================================================================
- * Check arguments and options
- *=================================================================*/
-   if(argc < 4)  {fprintf(stderr,"%s\n",usage); exit(1); }
-   
-/*-----------------------------------------------------------------*/
-   
-    
-        /* Open existing file */
-         if((status = nc_open(argv[1],NC_WRITE|NC_SHARE,&tmID)) != NC_NOERR)
-         {
-            fprintf(stderr,"Can not open file %s to write\n",argv[2]);
-            exit(0);
-         }
-         status = nc_inq_dimid(tmID,REC_DIM_NAME,&RecDimID);
-         status = nc_inq_varid(tmID, STARTTIME,&StartID);
-         status = nc_inq_varid(tmID, STOPTIME,&StopID);
-         status = nc_inq_varid(tmID, FILENAME,&NameID);
-         status = nc_inq_dimlen(tmID,RecDimID, &RecordsNumber);
-   
-/*==========================================================================*/
-  
-      hi = RecordsNumber;
- 
-       STARTD = ISOTime2Double(argv[2]);
-       STOPD = ISOTime2Double(argv[3]);
- 
-     while (lo <=  hi)
-       {               
-               i = (lo+hi)/2; 
-               TimeStart[0] = i + 1;
-               status = nc_get_vara_text(tmID,StartID,TimeStart,TimeCount,(char *)Start);
-               StartD1 = DD_Time2Double(Start);
-               if (StartD1 > STARTD) hi--;  
-               TimeStart[0] = i;
-               status = nc_get_vara_text(tmID,StartID,TimeStart,TimeCount,(char *)Start);
-               StartD0 = DD_Time2Double(Start);                
-               if (StartD0 < STARTD) lo++;
-
-               if (StartD1 <=  STARTD && StartD0 >= STARTD) break;
-       }  
-
-       StartRecord = i;
-       status = nc_get_vara_text(tmID,StopID,TimeStart,TimeCount,(char *)Stop);
-       StopD0 = DD_Time2Double(Stop);
-
-       while (STOPD > StopD0  &&  TimeStart[0] <= RecordsNumber) {
-              status = nc_get_vara_text(tmID,StopID,TimeStart,TimeCount,(char *)Stop);
-              if (status != NC_NOERR) fprintf(stderr," %s\n", nc_strerror(status));
-              StopD0 = DD_Time2Double(Stop);
-              TimeStart[0]++;
-        }
-
-       StopRecord = TimeStart[0]-1;
-
-// if NODATA is the very FIRST - insert NODATA 
-       if (StartRecord == 0  && (StartD0 - STARTD) > DATAGAP) {
-        
-           TimeStart[0] = 0;
-           status = nc_get_vara_text(tmID, NameID, TimeStart, NameCount,(char *)Name); 
-           if (strcmp(Name,NODATA) == 0 && (StartD0 - STOPD) < DATAGAP) {
-             status = nc_put_vara_text(tmID,StartID, TimeStart, TimeCount, Double2DD_Time(STARTD));          
-           }
-          else  {
-              strncpy(CurrentRecord.Name, NODATA, 7);  
-              strncpy(CurrentRecord.StartS,Double2DD_Time(STARTD),TIMELENGTH);
-              if ((StartD0 - STOPD)  < DATAGAP) strncpy(CurrentRecord.StopS,Start,TIMELENGTH); 
-                else strncpy(CurrentRecord.StopS,Double2DD_Time(STOPD),TIMELENGTH);
-              InsertRecord((size_t)(0), &CurrentRecord);
-          }          
-       }
-     
-        for (i = StartRecord; i < StopRecord ; i++) {
-
-         InsertFlag = 0;
-         TimeStart[0] = i;
-         status = nc_get_vara_text(tmID,StopID, TimeStart, TimeCount,(char *)Stop); 
-         StopD0 = DD_Time2Double(Stop);
-         TimeStart[0] = i+1; 
-         status = nc_get_vara_text(tmID,StartID, TimeStart, TimeCount, (char *)Start);
-         StartD1 = DD_Time2Double(Start);
-     
-
-// Data Gap -> NODATA
- 
-         if ((StartD1 - StopD0) > DATAGAP)  {
-           strncpy(CurrentRecord.Name, NODATA,7);
-
-           TimeStart[0] = i;
-           status = nc_get_vara_text(tmID, NameID, TimeStart, NameCount,(char *)Name);     
- 
-           if (strcmp(Name,NODATA) == 0) {
-                   strncpy(Stop,Start,TIMELENGTH);
-                   status = nc_get_vara_text(tmID,StartID, TimeStart, TimeCount, (char *)Start);
-                   status = nc_put_vara_text(tmID,StartID, TimeStart, TimeCount, (char *)Start);
-                   if ((StartD1 - STOPD) <  DATAGAP)
-                           status = nc_put_vara_text(tmID,StopID,TimeStart,TimeCount,(char *)Stop);
-                   else status = nc_put_vara_text(tmID,StopID,TimeStart,TimeCount,Double2DD_Time(STOPD));
-                   status = nc_put_vara_text(tmID,NameID,TimeStart,NameCount,(char *)CurrentRecord.Name);
-  
-                   InsertFlag = 1;
-           }
-
-            if (!InsertFlag) {
-                  if ((i == StartRecord) && (StopD0 < STARTD))
-                            strncpy(CurrentRecord.StartS,Double2DD_Time(STARTD),TIMELENGTH);
-                  else strncpy(CurrentRecord.StartS,Stop,TIMELENGTH);
-                  if ((i == StopRecord-1) && (StartD1 > STOPD))  
-                            strncpy(CurrentRecord.StopS,Double2DD_Time(STOPD),TIMELENGTH);
-                  else strncpy(CurrentRecord.StopS,Start,TIMELENGTH);
-                 
-                 if ((DD_Time2Double(CurrentRecord.StopS) - 
-                                     DD_Time2Double(CurrentRecord.StartS)) > DATAGAP)
-                                           InsertRecord((size_t)(i+1), &CurrentRecord);
-
-            }       
-         }
-
-      }
-     
-// if NODATA is the very LAST - add NODATA
- 
-    if (StopRecord == RecordsNumber) {
-         TimeStart[0] = StopRecord-1;
-         status = nc_get_vara_text(tmID,StopID, TimeStart, TimeCount, (char *)Stop);
-         StopD0 = DD_Time2Double(Stop);
-
-         if (STOPD > StopD0) { 
-           status = nc_get_vara_text(tmID, NameID, TimeStart, NameCount,(char *)Name);  
- 
-          if (strcmp(Name,NODATA) == 0  && (STARTD - StopD0) < DATAGAP) {
-              status = nc_get_vara_text(tmID,StartID, TimeStart, TimeCount, (char *)Start);
-              strncpy(Stop,Start,TIMELENGTH);
-          }
-          else  {
-               strncpy(Name, NODATA, 7); 
-               TimeStart[0]++;
-          }   
-         if ((STARTD - StopD0) < DATAGAP) CurrentStart = DD_Time2Double(Stop); 
-         else   CurrentStart = STARTD; 
-         if ((STOPD - CurrentStart) > DATAGAP) {
-            status = nc_put_vara_text(tmID,StartID,TimeStart,TimeCount, Double2DD_Time(CurrentStart));
-            status = nc_put_vara_text(tmID,StopID,TimeStart,TimeCount, Double2DD_Time(STOPD));
-            status = nc_put_vara_text(tmID,NameID,TimeStart,NameCount,(char *)Name);
-        }
-      }   
-    }
-
- 
-   nc_sync(tmID);
-   status = nc_close(tmID);
-   exit(0);
-} 
-/*=========================================================================================================*/
diff --git a/src/DATA/TOOLS/CMakeLists.txt b/src/DATA/TOOLS/CMakeLists.txt
new file mode 100644
index 0000000..a7217ac
--- /dev/null
+++ b/src/DATA/TOOLS/CMakeLists.txt
@@ -0,0 +1,20 @@
+
+PROJECT(TOOLS)
+
+include_directories(
+  ${DDCLIENTINCLUDE_DIR}
+  ${NETCDFINCLUDE_DIR}
+  ${LIBXML2_INCLUDE_DIR}
+)
+
+#Configuration de l'exécutable
+
+file( GLOB SOURCE_FILES ./*.c )
+
+foreach( sourcefile ${SOURCE_FILES} )
+    get_filename_component( source ${sourcefile} NAME)
+    string( REPLACE ".c" "" exefile ${source} )
+    add_executable( ${exefile} ${source} )
+    target_link_libraries( ${exefile}  ${DDCLIENTLIBRARY} ${NETCDFLIBRARY}  ${LIBXML2_LIBRARIES})
+    install (TARGETS ${exefile} DESTINATION bin)
+endforeach( sourcefile ${SOURCE_FILE} ) 
diff --git a/src/DATA/TOOLS/CleanNoData.c b/src/DATA/TOOLS/CleanNoData.c
new file mode 100644
index 0000000..078d063
--- /dev/null
+++ b/src/DATA/TOOLS/CleanNoData.c
@@ -0,0 +1,130 @@
+/* $Id: CleanNoData.c,v 1.1 2008/09/16 15:26:27 elena Exp $*/
+/*=====================================================================
+ *                  DD SYSTEM base package
+ *                   DD_Server library
+ *                     CleanNoData.c
+ *                      
+ *
+ *  usage CleanNoData nc_times_file 
+ *  Note that at the end of activity you have to run ClearTimes nc_times_file
+ *=====================================================================*/
+ /*=====================================================================
+ * Description:
+ * Program reads nc_times_file and remove NODATA intervals
+ *  
+ *
+ * Dimensions:
+ * TimeLingth   TIMELENGTH
+ * NameLength   NAME_DIM
+ * Record       Unlimited
+ * Variables:
+ *
+ * char StartTime[TIMELENGTH]
+ * char EndTime[TIMELENGTH]
+ * 
+ * Attributes:
+ * none
+ *======================================================================*/
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <dirent.h>
+#include <netcdf.h>
+#include <math.h>
+#include <DD.h>
+
+/* Global Constant definitions */
+
+#define TIME_LENGTH_NAME "TimeLength"
+#define TIME_LENGTH 17L
+#define REC_DIM_NAME "record"
+#define REC_DIM NC_UNLIMITED
+#define NAME_DIM_NAME "NameLength"
+#define NAME_DIM 32L
+#define NAME_LENGTH 100
+
+#define STARTTIME "StartTime"
+#define STOPTIME   "StopTime"
+#define FILENAME   "FileName"
+
+#define TIME_TYPE NC_CHAR
+ 
+#define NODATA "NODATA\0"
+#define TEMPORARY_NAME "temporary_name\0"
+
+/*----------- Type definition ------------------------------*/
+typedef struct
+{
+   char Name[NAME_LENGTH];   // current data file 
+   char StartS[TIME_LENGTH]; // Start Time String
+   char StopS[TIME_LENGTH];  // Stop Time String
+   double StartD;            // Start double
+   double StopD;             // Stop double 
+} t_StartStop;
+
+
+   int tmID, StartID, StopID, NameID;
+   size_t RecordsNumber = 0; // Records Number of the existing times file
+   static char ZeroTime[TIME_LENGTH] = "0000000000000000\0";
+ 
+
+/*==================================================================================
+ *                              MAIN
+ *==================================================================================*/
+main(int argc, char **argv)
+{
+   static char usage[] = "usage: CleanNoData  nc_times_file ";
+   
+   char  Name[NAME_DIM];
+
+/* NC definitions */
+   int  RecDimID;  /* ID of dimensions */   
+   static size_t TimeStart[2] = {0,0};
+   static size_t TimeCount[2] = {1,TIME_LENGTH};
+   static size_t NameCount[2] = {1, NAME_DIM};
+   int i;   
+   int status;
+         
+   
+/*=================================================================
+ * Check arguments and options
+ *=================================================================*/
+   if(argc < 2)  {fprintf(stderr,"%s\n",usage); exit(1); }
+ 
+/*-----------------------------------------------------------------*/  
+  
+/*======  open existing file ===================*/
+    
+       
+         if((status = nc_open(argv[1],NC_WRITE|NC_SHARE,&tmID)) != NC_NOERR)
+         {
+            fprintf(stderr,"Can not open file %s to write\n",argv[1]);
+            exit(0);
+         }
+         status = nc_inq_dimid(tmID,REC_DIM_NAME,&RecDimID);
+         status = nc_inq_varid(tmID, STARTTIME,&StartID);
+         status = nc_inq_varid(tmID, STOPTIME,&StopID);
+         status = nc_inq_varid(tmID, FILENAME,&NameID);
+         status = nc_inq_dimlen(tmID,RecDimID, &RecordsNumber);
+   
+/*==========================================================================*/
+
+   /*==========================================================================
+   * For Each record in the nc_times_file
+   *=========================================================================*/
+    for (i = 0; i < RecordsNumber; i++) {
+
+        TimeStart[0] = i;
+        nc_get_vara_text(tmID,NameID,TimeStart,NameCount,(void *)Name);
+        if(strncmp(Name,NODATA,6) == 0) {             /* The record is NODATA */          
+                  status = nc_put_vara_text(tmID,StartID,TimeStart,TimeCount,(char *)ZeroTime);
+                  status = nc_put_vara_text(tmID,StopID,TimeStart,TimeCount,(char *)ZeroTime);
+                  status = nc_put_vara_text(tmID,NameID,TimeStart,NameCount,(char *)TEMPORARY_NAME);
+         }
+   
+      }
+   nc_sync(tmID);
+   status = nc_close(tmID);
+} 
+/*=========================================================================================================*/
diff --git a/src/DATA/TOOLS/ClearTimes.c b/src/DATA/TOOLS/ClearTimes.c
new file mode 100644
index 0000000..9974403
--- /dev/null
+++ b/src/DATA/TOOLS/ClearTimes.c
@@ -0,0 +1,190 @@
+/*----------------- ClearTimes ------------------------------*/
+/* name:         ClearTimes.c
+ *                  V.3.0
+ * author:       Andrey  Fedorov
+ * modification list:
+ *              Jan 6, 2006, V.1.0 
+ *              Aug 3, 2007, V.2.0 , Merging NODATA records
+ *              Aug 28, 2009 V.3.0 new netCDF 
+ *
+ * Descriptions: Remove all zero records from times.nc file after
+ * DDrechash processing.
+ * usage : ClearTimes file_name
+*------------------------------------------------------------*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <netcdf.h>
+#include <DD.h>
+#include <DD_comm.h>
+
+/* Global Constant definitions */
+#define TIMELENGTH_NAME "TimeLength"
+#define REC_DIM_NAME "record"
+#define REC_DIM NC_UNLIMITED
+#define NAME_DIM_NAME "NameLength"
+
+#define STARTTIME "StartTime"
+#define STOPTIME   "StopTime"
+#define FILENAME   "FileName"
+
+#define DATAOK "DATAOK"
+#define TEMPNAME "temptimes.nc"
+
+#define TIME_TYPE NC_CHAR
+
+main(int argc, char **argv)
+{
+   static char description[] = "usage: DDClearTimes  nc_times_file";
+
+   char Start[TIMELENGTH], Stop[TIMELENGTH], Name[MAXFILENAME];
+   char StartPrevious[TIMELENGTH], StopPrevious[TIMELENGTH], NamePrevious[MAXFILENAME];
+
+/* NC definitions */
+   int SourceID;  /* nc Source descriptor */
+   int DestID;    /* nc Destination descriptor */
+   int SStartID, SStopID, SNameID; /* Sources variables ID */
+   int DStartID, DStopID, DNameID; /* Destination variables ID */
+   int STlDimID,SRecDimID, SNlDimID;  /* Source ID of dimensions */
+   int DTlDimID,DRecDimID, DNlDimID;  /* Destination ID of dimensions */
+
+   size_t DRecordNumber = 0; // Current record number destination
+   size_t SRecordNumber;     // Total record number source
+   long ics;                // current source record
+
+/*---------- Universal counters and offsets -----------------*/
+   size_t TimeStart[2] = {0L,0L};
+   size_t TimeCount[2] = {1L,TIMELENGTH};
+   size_t NameCount[2] = {1L, MAXFILENAME};
+   int DimVector[2];
+
+   char command[100];
+   char name[100];
+   int  compress = 0;
+   int status;
+
+/*------------ Set value of global variables ------------------*/
+ //  ncopts = NC_VERBOSE;
+
+/*-----------------------------------------------------------------*/
+/*
+ * Check arguments
+ */
+   if(argc < 2)  {fprintf(stderr,"%s\n",description); exit(1); }
+/*-----------------------------------------------------------------*/
+/*
+ * Creating temporay file to write (destination)
+ */
+     status = nc_create(TEMPNAME,NC_CLOBBER,&DestID);
+     status = nc_def_dim(DestID,TIMELENGTH_NAME,TIMELENGTH,&DTlDimID);
+     status = nc_def_dim(DestID,NAME_DIM_NAME,MAXFILENAME,&DNlDimID);
+     status = nc_def_dim(DestID,REC_DIM_NAME,REC_DIM,&DRecDimID);
+     
+     DimVector[0] = DRecDimID;
+     DimVector[1] = DTlDimID;
+     status = nc_def_var(DestID, STARTTIME, TIME_TYPE,2,DimVector,&DStartID);
+     status = nc_def_var(DestID, STOPTIME, TIME_TYPE,2,DimVector,&DStopID);
+     DimVector[1] = DNlDimID;
+     status = nc_def_var(DestID, FILENAME, TIME_TYPE,2,DimVector,&DNameID);
+     DRecordNumber = 0;
+     nc_enddef(DestID);
+   
+/*====== Open source file ===================*/
+     status = nc_open(argv[1],NC_WRITE,&SourceID);
+     status = nc_inq_dimid(SourceID,REC_DIM_NAME,&SRecDimID);
+     status = nc_inq_varid(SourceID, STARTTIME,&SStartID);
+     status = nc_inq_varid(SourceID, STOPTIME,&SStopID);
+     status = nc_inq_varid(SourceID, FILENAME,&SNameID);
+     status = nc_inq_dim(SourceID,SRecDimID,(char *)0, &SRecordNumber);
+ 
+/*--------------- Start Value ----------------------*/
+     strcpy(NamePrevious,DATAOK);
+
+/*============ Loop to read Source and to write destination =======*/
+    for(ics = 0; ics < SRecordNumber; ics++)
+    {
+       TimeStart[0] = ics;
+       status = nc_get_vara_text(SourceID,SStopID, TimeStart,TimeCount,Stop);
+       status = nc_get_vara_text(SourceID,SStartID,TimeStart,TimeCount,Start);
+       status = nc_get_vara_text(SourceID,SNameID, TimeStart,NameCount,Name);
+      
+       if((Start[0] != '0') && (Stop[0] != '0')) // Correct time
+       {
+/*=================== Data exists==========================*/
+	   if(strncmp(Name,NODATASTR,6) != 0)  /* Real data file */
+           {
+               TimeStart[0] = DRecordNumber;
+
+/*=================Regular Case =======================*/
+               if(strncmp(NamePrevious,NODATASTR,6) != 0) /* The previous record was with real data */
+               {
+	         status = nc_put_vara_text(DestID,DStartID,TimeStart,TimeCount,Start);
+	         status = nc_put_vara_text(DestID,DStopID,TimeStart,TimeCount,Stop);
+	         status = nc_put_vara_text(DestID,DNameID,TimeStart,NameCount,Name);
+	          DRecordNumber++;
+                  continue;
+               } 
+               else                                      /* The previous record has no real data */
+               { 
+	           status = nc_put_vara_text(DestID,DStartID,TimeStart,TimeCount,StartPrevious);
+	           status = nc_put_vara_text(DestID,DStopID,TimeStart,TimeCount,StopPrevious);
+	           status = nc_put_vara_text(DestID,DNameID,TimeStart,NameCount,NODATASTR);
+                   TimeStart[0]++;
+                   status = nc_put_vara_text(DestID,DStartID,TimeStart,TimeCount,Start);
+	           status = nc_put_vara_text(DestID,DStopID,TimeStart,TimeCount,Stop);
+	           status = nc_put_vara_text(DestID,DNameID,TimeStart,NameCount,Name);
+	           DRecordNumber += 2;
+
+                   strcpy(NamePrevious,DATAOK);
+                   continue;
+              }
+           } /* End if currend record has no data */
+                
+/*============= NODATA First Occurrence: Prepare to Check Next Record ==============*/
+           if(strncmp(NamePrevious,NODATASTR,6) != 0) /* Current record has no data, but previous one was OK */
+           {
+               strncpy(NamePrevious,NODATASTR,6);
+               strcpy(StartPrevious,Start);
+               strcpy(StopPrevious,Stop); 
+               continue;
+           }
+/*=================== Merge NODATA records ========================*/
+           if((DD_Time2Double(Start)-DD_Time2Double(StopPrevious) < MINGAP)) /* No Data in previous record, No Data in the current one*/
+           {
+               strcpy(StopPrevious,Stop);
+           }
+/*=================== No Merging Write PREVIOUS NODATA record  ===================?=*/
+           else /* There is BIG gap between NODATA records */
+           {
+               TimeStart[0] = DRecordNumber;
+	       status = nc_put_vara_text(DestID,DStartID,TimeStart,TimeCount,StartPrevious);
+	       status = nc_put_vara_text(DestID,DStopID,TimeStart,TimeCount,StopPrevious);
+	       status = nc_put_vara_text(DestID,DNameID,TimeStart,NameCount,NODATASTR);
+	       DRecordNumber++; 
+               strcpy(StartPrevious,Start);
+               strcpy(StopPrevious,Stop); 
+           }   
+        }
+    } /* FOR all recored */
+    
+    if(strncmp(Name,NODATASTR,6) == 0) /* The last record has no data */
+    {
+       TimeStart[0] = DRecordNumber;
+       status = nc_put_vara_text(DestID,DStartID,TimeStart,TimeCount,StartPrevious);
+       status = nc_put_vara_text(DestID,DStopID,TimeStart,TimeCount,StopPrevious);
+       status = nc_put_vara_text(DestID,DNameID,TimeStart,NameCount,NODATASTR);
+    } 
+    
+    nc_close(SourceID);
+    nc_close(DestID);
+    
+/*=============== rename of temporary file ===================*/
+    sprintf(command,"mv %s %s",TEMPNAME,argv[1]);
+    system(command);
+}
+/*=============== END OF PROGRAM =============================*/
+
+
+
diff --git a/src/DATA/TOOLS/DDtimedump.c b/src/DATA/TOOLS/DDtimedump.c
new file mode 100755
index 0000000..09ee758
--- /dev/null
+++ b/src/DATA/TOOLS/DDtimedump.c
@@ -0,0 +1,127 @@
+/*----------------- REFRESH ------------------------------*/
+/*                  v.2.0
+ * authors:       Andrey O. Fedorov, V.Grushin
+ * Insitution:    
+ * date :         aug 28,1997
+ * sinopsis:
+ *     aug 28, 2009 - New netCDF
+
+ * usage DDtimedump nc_times_file
+ *
+ * Description:
+ * The program reads the output of the rehash program and reformats
+ * the data for more conveniet reading form:
+ * 
+ *
+ * Dimensions:
+ * 
+ * TimeLength  17
+ * NameLength  
+ * Record      Unlimited
+ * Variables:
+ *
+ * char StartTime[TIMELENGTH]
+ * char EndTime[TIMELENGTH]
+ * 
+ * Attributes:
+ * none
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <netcdf.h>
+
+/* Global Constant definitions */
+
+#define TIME_LENGTH_NAME "TimeLength"
+#define TIME_LENGTH 17L
+#define REC_DIM_NAME "record"
+#define REC_DIM NC_UNLIMITED
+#define NAME_DIM_NAME "NameLength"
+#define NAME_DIM 32L
+
+#define SUM_DIM_NAME  "SummaryLength"
+#define SUM_DIM 68L 
+
+#define STARTTIME "StartTime"
+#define STOPTIME   "StopTime"
+#define FILENAME   "FileName"
+
+#define SUMMARY  "Summary"
+
+#define TIME_TYPE NC_CHAR
+
+/*--------------------- MAIN --------------------------------*/
+ 
+main(int argc, char **argv)
+ 
+{
+   static char description[] = "usage: DDtimedump nc_times_file ";
+
+   char Start[TIME_LENGTH],
+        Stop [TIME_LENGTH],
+        Name [NAME_DIM],
+        Sum [SUM_DIM];
+
+/* NC definitions */
+   int tmID, sumID;  /* nc file descriptor */
+   int TlDimID,RecDimID, NlDimID, SumDimID;  /* ID of dimensions */
+   
+   size_t TimeStart[2] = {0L,0L};
+   size_t DataStart[1] = {0L};
+   size_t DataCount[1] = {TIME_LENGTH};
+   size_t TimeCount[2] = {1L,TIME_LENGTH};
+   size_t NameCount[2] = {1L, NAME_DIM};
+   size_t SumCount[2]  = {1L, SUM_DIM};
+   int DimVector[2];
+   long RN = 0;
+
+/* Times files definitions */
+   int StartID, StopID,NameID;
+   int DataStartID, DataStopID;
+   int SumInfoID;
+   char tmName[NAME_DIM];
+   int i,okget,status;
+
+ //  ncopts = NC_VERBOSE;
+/*-----------------------------------------------------------------*/
+/*
+ * Check arguments
+ */
+   if(argc != 2)  {fprintf(stderr,"argc=%d \n %s\n",
+				      argc,description); exit(1); }
+/*-----------------------------------------------------------------*/
+/*
+ * Opening the rehash-created ncdf file 
+ */
+
+     status = nc_open(argv[1],NC_NOWRITE,&tmID);
+ 
+     status = nc_inq_varid(tmID, STARTTIME, &StartID);
+     status  = nc_inq_varid(tmID, STOPTIME, &StopID);
+     status  = nc_inq_varid(tmID, FILENAME, &NameID);
+ 
+     do
+      {     
+               
+       status = nc_get_vara_text(tmID,StartID,TimeStart,TimeCount, Start);
+       status = nc_get_vara_text(tmID,StopID ,TimeStart,TimeCount, Stop );
+       status = nc_get_vara_text(tmID,NameID ,TimeStart,NameCount, Name );
+ 
+       strcpy(Sum,Start);
+       strcat(Sum," ");
+       strcat(Sum,Stop);
+       strcat(Sum," ");
+       strcat(Sum,Name);
+       printf("%s \n",Sum);
+
+
+       TimeStart[0]++;
+      } while(status == NC_NOERR);
+
+   nc_close(tmID);
+   
+   return(0);
+} 
diff --git a/src/DATA/TOOLS/StartStopLocal.c b/src/DATA/TOOLS/StartStopLocal.c
new file mode 100644
index 0000000..7941906
--- /dev/null
+++ b/src/DATA/TOOLS/StartStopLocal.c
@@ -0,0 +1,75 @@
+ 
+/** @file  StartStopLocal.c
+*   @brief Stand-alone executable <br> Returns real Start-Stop for VI in DDBase <br>
+*          Update Start-Stop times in INFO files for LOCAL data<br>
+*    @details StartStopLocal(string *)  <br>
+*    @arg @c argv[1] Virtual Instrument ID (DD notation) <br>
+*     Output: YYYYDDdayHHMMSSMLS-YYYYDDdayHHMMSSMLS       
+*                 
+*    @date 10.10.2007
+*    @version $Id: StartStopLocal.c,v 1.4 2011/09/05 11:27:34 budnik Exp $  
+*/
+
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <time.h>
+#include <math.h>
+#include <netcdf.h>
+#include <DD.h>
+
+
+int DataID, RecID,  StartID, StopID;
+size_t RecNum;
+char StartT[TIMELENGTH], StopT[TIMELENGTH], Var[128];
+size_t count[2] = {1L,TIMELENGTH};
+size_t start[2] = {0L,0L};
+size_t countVar[2] = {1L,128L};
+
+/*---------------- NC ERROR --------------------------------------*/
+void nc_handle_error(int status)
+{
+  fprintf(stderr, "%s\n", nc_strerror(status));
+  exit(1);
+}
+
+/* ----------------------- MAIN ------------------------------------*/
+  int main(int argc, char *argv[])
+{
+    
+    int status, len;
+
+
+/* Open VI_times.nc */
+      
+       if ((status = nc_open(argv[1], NC_NOWRITE, &DataID)) != NC_NOERR)
+                                                nc_handle_error(status);
+
+       if ((status = nc_inq_dimid(DataID, "record", &RecID)) != NC_NOERR)
+                                          nc_handle_error(status);
+     
+/*   Get Number of Records */
+   
+      if ((status = nc_inq_dimlen(DataID, RecID, &RecNum)) != NC_NOERR)
+                                          nc_handle_error(status);
+
+      if ((status = nc_inq_varid(DataID, "StartTime", &StartID)) != NC_NOERR)
+                                          nc_handle_error(status);
+      if ((status = nc_inq_varid(DataID, "StopTime", &StopID)) != NC_NOERR)
+                                          nc_handle_error(status);
+
+/* Get The First Start and The Last Stop Times  */    
+      start[0] = 0;     
+
+     if((status = nc_get_vara_text(DataID, StartID, start, count, StartT)) != NC_NOERR)
+                                          nc_handle_error(status);
+
+      start[0] = RecNum-1; 
+      if((status = nc_get_vara_text(DataID, StopID, start, count, StopT)) != NC_NOERR)
+                                          nc_handle_error(status);
+ 
+      printf("%s-%s\n",  StartT, StopT);
+      if ((status = nc_close(DataID)) != NC_NOERR) nc_handle_error(status);
+    
+}
diff --git a/src/DATA/TOOLS/TimesUpdate.c b/src/DATA/TOOLS/TimesUpdate.c
new file mode 100755
index 0000000..0f02a70
--- /dev/null
+++ b/src/DATA/TOOLS/TimesUpdate.c
@@ -0,0 +1,431 @@
+/* $Id: TimesUpdate.c,v 1.3 2008/02/19 16:24:58 elena Exp $*/
+/*=====================================================================
+ *                  DD SYSTEM base package
+ *                   DD_Server library
+ *                    TimesUpdate.c
+ *                        V.4.6
+ *
+ *  usage TimesUpdate -r/-i[-u]/-d nc_times_file nc_data_file[*.gz] nc_data_file[*.gz] ....
+ *  Note that in most of cases at the end of activity you have to run ClearTimes nc_times_file
+ *
+ *  Versions:
+ *  Apr 23 1997, Usung *.gz files  V.2.0
+ *  Jan 4, 2006, V.3.0 - insert file and check overlaping
+ *  Jan 13,2006, V.3.1 - error is corrected
+ *  Feb 02,2006, V.3.2 - Corrected removing database in case of error
+ *  Sep 20, 2007, V.4.0, Fedorov, from rehash.nc. New NetCDF V.3, syncronization
+ *  Sep 25, 2007  V.4.1 The very first file and first file insert
+ *  Nov 29, 2007  V.4.2 If several first records - bug correction 
+ *  Feb 17, 2008  V.4.5 Fedorov: New options , remake, insert, delete
+ *  Feb 19, 2008  V.4.6 delete bugs corrected
+ *=====================================================================*/
+ /*=====================================================================
+ * Description:
+ * Program reads list of nc_data_files, probabbly gzipped, reads StartTime and Stop time
+ * and create or update nc_times_file. The sequence of data files are not important
+ * -r remove nc_times_file and create new one
+ * -i insert new file(s)
+ * -d remove file(s) from nc_times
+ *
+ * Dimensions:
+ * TimeLingth   TIMELENGTH
+ * NameLength   NAME_DIM
+ * Record       Unlimited
+ * Variables:
+ *
+ * char StartTime[TIMELENGTH]
+ * char EndTime[TIMELENGTH]
+ * 
+ * Attributes:
+ * none
+ *======================================================================*/
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <dirent.h>
+#include <netcdf.h>
+#include <math.h>
+#include <DD.h>
+
+/* Global Constant definitions */
+
+#define TIME_LENGTH_NAME "TimeLength"
+#define TIME_LENGTH 17L
+#define REC_DIM_NAME "record"
+#define REC_DIM NC_UNLIMITED
+#define NAME_DIM_NAME "NameLength"
+#define NAME_DIM 32L
+#define NAME_LENGTH 100
+
+#define STARTTIME "StartTime"
+#define STOPTIME   "StopTime"
+#define FILENAME   "FileName"
+
+#define TIME_TYPE NC_CHAR
+
+#define TEMPUNZIP "TimesUpdateTemp.nc\0"
+#define NODATA "NODATA\0"
+
+/*----------- Conditions --------------------------*/
+enum Conditions {ALLLEFT,LEFTOVER,WELLIN,RIGHTOVER,ALLRIGHT,LEFTRIGHTOVER,LEFTIN};
+
+/*----------- Modes -------------------------------*/
+enum Modes {REMAKE, INSERT, DELETE};
+
+/*----------- Type definition ------------------------------*/
+typedef struct
+{
+   char Name[NAME_LENGTH];   // current data file 
+   char StartS[TIME_LENGTH]; // Start Time String
+   char StopS[TIME_LENGTH];  // Stop Time String
+   double StartD;            // Start double
+   double StopD;             // Stop double 
+} t_StartStop;
+
+/*---------- Global variables (IDs) of open times file -------------*/
+   int tmID;  /* nc file descriptor */
+   int StartID, StopID, NameID;
+   size_t RecordsNumber = 0; // Records Number of the existing times file
+   static char ZeroTime[TIME_LENGTH] = "0000000000000000\0";
+   static int ToZipFlag = 0;
+   static char UnzipName[NAME_LENGTH];
+
+/*========================================================================
+ *                 FUNCTIONS 
+ *=======================================================================*/
+/*========================================================================
+ *               GetFileInfo
+ *=======================================================================*/
+t_StartStop *GetFileInfo(char *FileName)
+{
+   static t_StartStop StartStop;
+   int dataID;
+   int DataStartID, DataStopID;
+   static size_t DataStart[1] = {0};
+   static size_t DataCount[1] = {TIME_LENGTH};
+   char command[200];
+   int Status;
+   
+   /*---- Check if this file exist ------------*/
+   if(strcmp(FileName+strlen(FileName)-3,".gz") == 0) // Zipped file
+   {
+      strcpy(UnzipName, TEMPUNZIP);
+      sprintf(command,"gunzip -c %s > %s",FileName,UnzipName);
+      system(command);
+      ToZipFlag = 0;
+      strncpy(StartStop.Name,FileName,strlen(FileName)-3);
+   } else 
+   {
+     ToZipFlag = 1;
+     strcpy(UnzipName,FileName);
+     strcpy(StartStop.Name,FileName);
+   }
+   
+   if((Status = nc_open(UnzipName,NC_NOWRITE,&dataID)) == NC_NOERR)
+   {
+       Status = nc_inq_varid(dataID,STARTTIME,&DataStartID);
+       Status = nc_inq_varid(dataID,STOPTIME, &DataStopID); 
+         
+       Status = nc_get_vara_text(dataID,DataStartID,DataStart,DataCount,(char *)StartStop.StartS);
+       Status = nc_get_vara_text(dataID,DataStopID,DataStart,DataCount,(char *)StartStop.StopS);
+       Status = nc_close(dataID);
+   } 
+   else if(Status == 2)
+   {
+      fprintf(stderr,"File %s does not exist\n",UnzipName); 
+      return NULL;
+   }
+   else
+   {
+      fprintf(stderr,"File %s is corrupted, Error = %d\n",UnzipName,Status);
+      sprintf(command,"rm %s*",StartStop.Name);
+      system(command);
+      return NULL;
+   }
+   
+   if((isdigit(StartStop.StartS[0]) == 0) || (isdigit(StartStop.StopS[0]) == 0))
+   {
+      fprintf(stderr,"File %s is corrupted\n",UnzipName);
+      sprintf(command,"rm %s*",StartStop.Name);
+      system(command); 
+      return NULL;
+   }
+      
+   StartStop.StartD = DD_Time2Double(StartStop.StartS);
+   StartStop.StopD =  DD_Time2Double(StartStop.StopS);
+   
+   return &StartStop;
+}
+/*-----------------------------------------------------------*/
+
+/*------------------------------------------------------------
+ *                 RemoveRecord()
+ *-----------------------------------------------------------*/
+int RemoveRecord(size_t RecordPos, t_StartStop *StartStop)
+{
+   static size_t TimeStart[2] = {0,0};
+   static size_t TimeCount[2] = {1,TIME_LENGTH};
+   static size_t NameCount[2] = {1, NAME_DIM};
+   char CStart[TIME_LENGTH],CStop[TIME_LENGTH], CName[NAME_DIM];
+   size_t Crec;
+   char command[200];
+   int status;
+   char NewName[NAME_LENGTH];
+   
+/*------- Remove corresponding file -------------------*/
+   TimeStart[0] =  RecordPos;
+   nc_get_vara_text(tmID,NameID,TimeStart,NameCount,(char *)CName);
+   if(StartStop == NULL) NewName[0] = '\0'; else strcpy(NewName,StartStop->Name);
+   if((strcmp(CName,NODATA) != 0)&&(strcmp(CName,NewName) != 0))
+   { // Remove old file which overlap with new one */
+      sprintf(command,"rm %s*",CName);
+      system(command);
+   }
+   
+/*--- replacing Variable -----------------------*/   
+   for(Crec = RecordPos + 1; Crec < RecordsNumber; Crec++)
+   {
+     TimeStart[0] =  Crec;
+     status = nc_get_vara_text(tmID,StartID,TimeStart,TimeCount,(char *)CStart);
+     status = nc_get_vara_text(tmID,StopID,TimeStart,TimeCount,(char *)CStop);
+     status = nc_get_vara_text(tmID,NameID,TimeStart,NameCount,(char *)CName);
+     TimeStart[0]--;
+     status = nc_put_vara_text(tmID,StartID,TimeStart,TimeCount,(char *)CStart);
+     status = nc_put_vara_text(tmID,StopID,TimeStart,TimeCount,(char *)CStop);
+     status = nc_put_vara_text(tmID,NameID,TimeStart,NameCount,(char *)CName);
+   }
+   
+/*----- Set Zero at the end -------------------------*/
+   TimeStart[0] =  RecordsNumber - 1;
+   status = nc_put_vara_text(tmID,StartID,TimeStart,TimeCount,(char *)ZeroTime);
+   status = nc_put_vara_text(tmID,StopID,TimeStart,TimeCount,(char *)ZeroTime);
+   
+   RecordsNumber--;
+   nc_sync(tmID);
+   return 1;
+}  
+/*-----------------------------------------------------------*/
+
+/*------------------------------------------------------------
+ *                 InsertRecord()
+ *-----------------------------------------------------------*/
+int InsertRecord(size_t RecordPos, t_StartStop *StartStop)
+{
+   static size_t TimeStart[2] = {0,0};
+   static size_t TimeCount[2] = {1,TIME_LENGTH};
+   static size_t NameCount[2] = {1, NAME_DIM};
+   char CStart[TIME_LENGTH],CStop[TIME_LENGTH], CName[NAME_DIM];
+   int Crec;
+   int status;
+
+/*--- Scrall all wariables down-----------------------*/   
+   for(Crec = RecordsNumber - 1; Crec >= (int)RecordPos; Crec--)
+   {
+       TimeStart[0] =  (size_t)Crec;
+       status = nc_get_vara_text (tmID,StartID,TimeStart,TimeCount,(char *)CStart);
+       status = nc_get_vara_text (tmID,StopID,TimeStart,TimeCount,(char *)CStop);
+       status = nc_get_vara_text (tmID,NameID,TimeStart,NameCount,(char *)CName);
+       TimeStart[0]++;
+       status = nc_put_vara_text(tmID,StartID,TimeStart,TimeCount,(char *)CStart);
+       status = nc_put_vara_text(tmID,StopID,TimeStart,TimeCount,(char *)CStop);
+       status = nc_put_vara_text(tmID,NameID,TimeStart,NameCount,(char *)CName);
+   }
+
+/*------ Put the new record to empty space  -----------------*/
+   TimeStart[0] = RecordPos;
+   status = nc_put_vara_text(tmID,StartID,TimeStart,TimeCount,(char *)StartStop->StartS);
+   status = nc_put_vara_text(tmID,StopID,TimeStart,TimeCount,(char *)StartStop->StopS);
+   status = nc_put_vara_text(tmID,NameID,TimeStart,NameCount,(char *)StartStop->Name);
+   
+   RecordsNumber++;
+   nc_sync(tmID);
+   return 1;
+}
+/*==================================================================================*/
+
+/*==================================================================================
+ *                              MAIN
+ *==================================================================================*/
+main(int argc, char **argv)
+{
+   static char usage[] = "usage: TimesUpdate -r/-i[-u]/-d nc_times_file nc_data_file[*.gz] nc_data_file[*.gz]";
+
+   char Start[TIME_LENGTH], Stop[TIME_LENGTH], Name[NAME_DIM];
+
+/* NC definitions */
+   int TlDimID,RecDimID, NlDimID;  /* ID of dimensions */
+   
+   static size_t TimeStart[2] = {0,0};
+   static size_t TimeCount[2] = {1,TIME_LENGTH};
+   static size_t NameCount[2] = {1, NAME_DIM};
+
+   int DimVector[2];
+
+   char tmName[NAME_DIM];
+   int i, InsertFlag, FindFlag, ihole;
+   
+   char command[100];
+   char name[100];
+   int  compress = 0;
+   int status;
+   
+   double LastTime = 0.0, FirstTime = 0.0; // Times of the hall between files
+      
+   t_StartStop *CurrentRecord; // pointer to the internal static structure 
+   enum Modes CurrMode;
+   enum Conditions condition;
+
+/*=================================================================
+ * Check arguments and options
+ *=================================================================*/
+   if(argc < 4)  {fprintf(stderr,"%s\n",usage); exit(1); }
+   if((strcmp(argv[1], "-r")) == 0) CurrMode = REMAKE;
+   else if((strcmp(argv[1], "-i")) == 0) CurrMode = INSERT;
+   else if((strcmp(argv[1], "-u")) == 0) CurrMode = INSERT;
+   else if((strcmp(argv[1], "-d")) == 0) CurrMode = DELETE;
+   else {fprintf(stderr,"Unknown option %s\n",argv[1]); exit(1);}
+/*-----------------------------------------------------------------*/
+   
+/*=================================================================
+ * Creating Times ncdf file if we have to make a new file 
+ *=================================================================*/
+   switch(CurrMode)
+   {
+      case REMAKE:   /* Create New File */
+         if((status = nc_create(argv[2],NC_SHARE,&tmID)) != NC_NOERR)
+         {
+            fprintf(stderr,"Can not create file %s\n",argv[2]);
+            exit(0);
+         }
+         status = nc_def_dim(tmID,TIME_LENGTH_NAME,TIME_LENGTH,&TlDimID);
+         status = nc_def_dim(tmID,NAME_DIM_NAME,NAME_DIM,&NlDimID);
+         status = nc_def_dim(tmID,REC_DIM_NAME,REC_DIM,&RecDimID);
+         
+         DimVector[0] = RecDimID;
+         DimVector[1] = TlDimID;
+         status = nc_def_var(tmID, STARTTIME,TIME_TYPE,2,DimVector,&StartID);
+         status = nc_def_var(tmID, STOPTIME,TIME_TYPE,2,DimVector,&StopID);
+         DimVector[1] = NlDimID;
+         status = nc_def_var(tmID, FILENAME,TIME_TYPE,2,DimVector,&NameID);
+         RecordsNumber = 0;
+         TimeStart[0] = (size_t)RecordsNumber;
+         status = nc_enddef(tmID);
+         break;
+/*====== Or just open existing file ===================*/
+      case INSERT:
+      case DELETE: /* Open existing file */
+         if((status = nc_open(argv[2],NC_WRITE|NC_SHARE,&tmID)) != NC_NOERR)
+         {
+            fprintf(stderr,"Can not open file %s to write\n",argv[2]);
+            exit(0);
+         }
+         status = nc_inq_dimid(tmID,REC_DIM_NAME,&RecDimID);
+         status = nc_inq_varid(tmID, STARTTIME,&StartID);
+         status = nc_inq_varid(tmID, STOPTIME,&StopID);
+         status = nc_inq_varid(tmID, FILENAME,&NameID);
+         status = nc_inq_dimlen(tmID,RecDimID, &RecordsNumber);
+         break;
+   }
+/*==========================================================================*/
+
+   /*==========================================================================
+   * For Each file in the argument list
+   *=========================================================================*/
+   for(i = 3; i < argc; i++)
+   {  
+      switch(CurrMode)
+      {
+         case DELETE: 
+            TimeStart[0] = 0;
+            FindFlag = 0;
+            while((FindFlag == 0) && (TimeStart[0] < RecordsNumber))
+            {
+               status = nc_get_vara_text(tmID,NameID,TimeStart,NameCount,(char *)tmName);
+
+              if(strncmp(tmName, argv[i], strlen(tmName)) == 0)
+              { /* Record is found */
+                  FindFlag = 1; 
+                  RemoveRecord((size_t)TimeStart[0],(t_StartStop *)NULL);
+               }
+               else TimeStart[0]++;
+            }
+            break;
+         case REMAKE:
+         case INSERT:
+            if((CurrentRecord = GetFileInfo(argv[i])) != NULL)  /* Read current file information */
+            {
+      /*----------------- The very first file in VI DIR -------------------*/
+               if (RecordsNumber == 0) 
+               {
+                     TimeStart[0] = (size_t)0;
+                     status = nc_put_vara_text(tmID,StartID,TimeStart,TimeCount,(char *)CurrentRecord->StartS);
+                     status = nc_put_vara_text(tmID,StopID,TimeStart,TimeCount,(char *)CurrentRecord->StopS);
+                     status = nc_put_vara_text(tmID,NameID,TimeStart,NameCount,(char *)CurrentRecord->Name);
+                     RecordsNumber++;
+               } else
+               {
+                     /*---------------------------------------------------------
+                     * Searchig the same file or a hole to insert
+                     *-------------------------------------------------------*/ 
+                     InsertFlag = 0;
+                     ihole = 0;
+                     while((InsertFlag == 0) && (ihole <= RecordsNumber))
+                     {
+                        if(ihole > 0) /* Get the Left Time of the hole */
+                        {
+                           TimeStart[0] = (size_t)(ihole-1);
+                           status = nc_get_vara_text (tmID,StopID,TimeStart,TimeCount,(char *)Stop);
+                           FirstTime = DD_Time2Double(Stop);
+                        } else  FirstTime = 0.0;
+                                 
+                        if(ihole  < RecordsNumber) /* Get the Right Time of the hole */
+                        {
+                           TimeStart[0] = (size_t)ihole;
+                           status = nc_get_vara_text(tmID,StartID,TimeStart,TimeCount,(char *)Start);
+                           LastTime = DD_Time2Double(Start);
+                        }
+                        else LastTime = 1.0e16;
+            
+                        /*--------- Look the conditions ---------------*/  
+                        condition = ALLRIGHT;          
+                        if((CurrentRecord->StartD < FirstTime - 60.0) && 
+                           (CurrentRecord->StopD > LastTime + 60.0)) condition = LEFTRIGHTOVER;  
+                        else if((CurrentRecord->StartD < FirstTime - 60.0) && 
+                              (CurrentRecord->StopD < FirstTime + 60.0)) condition = ALLLEFT;
+                        else if((CurrentRecord->StartD < FirstTime - 60.0) && 
+                              (CurrentRecord->StopD > FirstTime) &&
+                              (CurrentRecord->StopD < LastTime + 60.0)) condition = LEFTOVER;
+                        else if((CurrentRecord->StartD >= FirstTime - 60.0) && 
+                              (CurrentRecord->StopD <= LastTime + 60.0)) condition = WELLIN;  
+                        else if((CurrentRecord->StartD >= FirstTime - 60.0) && 
+                              (CurrentRecord->StartD < LastTime) &&
+                              (CurrentRecord->StopD > LastTime + 60.0))condition = RIGHTOVER;  
+                        else if((CurrentRecord->StartD > LastTime - 60.0) && (CurrentRecord->StopD > LastTime + 60.0)) 
+                              condition = ALLRIGHT;  
+                  
+                        /* What to do with these conditions ----------------*/
+                        switch(condition)
+                        {
+                           case WELLIN :  InsertRecord((size_t)ihole, CurrentRecord); InsertFlag = 1; break;
+                           case ALLLEFT : RemoveRecord((size_t)(ihole-1),CurrentRecord); ihole--; break;
+                           case ALLRIGHT : ihole++; break;
+                           case LEFTOVER : RemoveRecord((size_t)(ihole-1),CurrentRecord); ihole--; break;  
+                           case RIGHTOVER : RemoveRecord((size_t)ihole,CurrentRecord); break; 
+                           case LEFTRIGHTOVER : RemoveRecord((size_t)(ihole-1),CurrentRecord);
+                                          RemoveRecord((size_t)(ihole-1),CurrentRecord); 
+                                          ihole--; break;
+                        } 
+                     } // While InsertFlag   
+               }     // if RecordsNumber > 0  
+               /*---------- Zip or remove new nc file -----------------*/
+               if(ToZipFlag) sprintf(command,"gzip -f %s",CurrentRecord->Name);
+               else sprintf(command,"rm %s",UnzipName);
+               system(command);
+            }      // If current argument file is OK
+      }            // CASE
+   }               // For several arguments
+   status = nc_close(tmID);
+   return(0);
+} 
+/*=========================================================================================================*/
diff --git a/src/DATA/TOOLS/TimesUpdateNoData.c b/src/DATA/TOOLS/TimesUpdateNoData.c
new file mode 100644
index 0000000..f881b1b
--- /dev/null
+++ b/src/DATA/TOOLS/TimesUpdateNoData.c
@@ -0,0 +1,330 @@
+/**
+*  @file TimesUpdateNoData.c
+*  @version $Id: TimesUpdateNoData.c,v 1.6 2009/07/07 11:37:40 budnik Exp $
+*  @brief Program reads StartTime and StopTime and add to nc_times_file NODATA intervals
+*  
+*  @arg  nc_times_file OrderedStartTime OrderedStopTime
+*/
+
+/*=====================================================================
+ *                  DD SYSTEM base package
+ *                   DD_Server library
+ *                    TimesUpdateNoData.c
+ *                        V.1.5
+ *
+ *  usage TimesUpdateNoData  nc_times_file OrderedStartTime OrderedStopTime
+ *   
+ *=====================================================================*/
+ /*=====================================================================
+ * Description:
+ * Program reads StartTime and StopTime and add to nc_times_file NODATA intervals 
+ *  
+ * 
+ *
+ * Dimensions:
+ * TimeLingth   TIMELENGTH
+ * NameLength   NAME_DIM
+ * Record       Unlimited
+ * Variables:
+ *
+ * char StartTime[TIMELENGTH]
+ * char EndTime[TIMELENGTH]
+ * 
+ * Attributes:
+ * none
+ *======================================================================*/
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <dirent.h>
+#include <netcdf.h>
+#include <math.h>
+#include <DD.h>
+ 
+
+/* Global Constant definitions */
+#define ISOTIMER  "%d-%d-%dT%d:%d:%d.%dZ" /* Format to READ time in ISO format */ 
+#define TIME_LENGTH_NAME "TimeLength"
+#define TIME_LENGTH 17L
+#define REC_DIM_NAME "record"
+#define REC_DIM NC_UNLIMITED
+#define NAME_DIM_NAME "NameLength"
+#define NAME_DIM 32L
+#define NAME_LENGTH 100
+#define ISO_LENGTH 25
+
+#define STARTTIME "StartTime"
+#define STOPTIME   "StopTime"
+#define FILENAME   "FileName"
+
+#define TIME_TYPE NC_CHAR
+
+
+#define DATAGAP 7200
+#define NODATA "NODATA\0"
+
+ 
+/*----------- Type definition ------------------------------*/
+typedef struct
+{
+   char Name[NAME_LENGTH];   // current data file 
+   char StartS[TIME_LENGTH]; // Start Time String
+   char StopS[TIME_LENGTH];  // Stop Time String
+  
+   double StartD;            // Start double
+   double StopD;             // Stop double 
+} t_StartStop;
+
+/*---------- Global variables (IDs) of open times file -------------*/
+   int tmID;  /* nc file descriptor */
+   int StartID, StopID, NameID;
+   size_t RecordsNumber = 0; // Records Number of the existing times file
+   static char ZeroTime[TIME_LENGTH] = "0000000000000000\0";
+   
+
+/*========================================================================
+ *                 FUNCTIONS 
+ *=======================================================================*/
+/*=====================================================================
+ *                ISOTime2Double()
+ * Covert double time to ISO time to Double
+ *  
+ *=====================================================================*/
+double ISOTime2Double(char* ISO)
+{
+  unsigned UT[7];
+  dd_tmstr_t *Time;
+  sscanf(ISO, ISOTIMER, &UT[0], &UT[1], &UT[2], &UT[3], &UT[4], &UT[5], &UT[6]);
+  Time = (dd_tmstr_t *)UT2double(UT);
+  return Time->times;
+}
+
+/*-----------------------------------------------------------*/
+
+/*------------------------------------------------------------
+ *                 InsertRecord()
+ *-----------------------------------------------------------*/
+int InsertRecord(size_t RecordPos, t_StartStop *StartStop)
+{
+   static size_t TimeStart[2] = {0,0};
+   static size_t TimeCount[2] = {1,TIME_LENGTH};
+   static size_t NameCount[2] = {1, NAME_DIM};
+   char CStart[TIME_LENGTH],CStop[TIME_LENGTH], CName[NAME_DIM];
+   int Crec;
+   int status;
+
+/*--- Scroll all variables down-----------------------*/   
+   for(Crec = RecordsNumber - 1; Crec >= (int)RecordPos; Crec--)
+   {
+       TimeStart[0] =  (size_t)Crec;
+       status = nc_get_vara_text (tmID,StartID,TimeStart,TimeCount,(char *)CStart);
+       status = nc_get_vara_text (tmID,StopID,TimeStart,TimeCount,(char *)CStop);
+       status = nc_get_vara_text (tmID,NameID,TimeStart,NameCount,(char *)CName);
+       TimeStart[0]++;
+       status = nc_put_vara_text(tmID,StartID,TimeStart,TimeCount,(char *)CStart);
+       status = nc_put_vara_text(tmID,StopID,TimeStart,TimeCount,(char *)CStop);
+       status = nc_put_vara_text(tmID,NameID,TimeStart,NameCount,(char *)CName);
+   }
+
+/*------ Put the new record to empty space  -----------------*/
+   TimeStart[0] = RecordPos;
+   status = nc_put_vara_text(tmID,StartID,TimeStart,TimeCount,(char *)StartStop->StartS);
+   status = nc_put_vara_text(tmID,StopID,TimeStart,TimeCount,(char *)StartStop->StopS);
+   status = nc_put_vara_text(tmID,NameID,TimeStart,NameCount,(char *)StartStop->Name);
+  
+   RecordsNumber++;
+   nc_sync(tmID);
+   return 1;
+}
+/*==================================================================================*/
+
+/*==================================================================================
+ *                              MAIN
+ *==================================================================================*/
+main(int argc, char **argv)
+{
+   static char usage[] = "usage: TimesUpdateNoData  nc_times_file StartTime StopTime";
+
+   char Start[TIME_LENGTH], Stop[TIME_LENGTH], Name[NAME_DIM];
+
+/* NC definitions */
+   int TlDimID,RecDimID, NlDimID;  /* ID of dimensions */
+   
+   static size_t TimeStart[2] = {0,0};
+   static size_t TimeCount[2] = {1,TIME_LENGTH};
+   static size_t NameCount[2] = {1, NAME_DIM};
+
+   int DimVector[2];
+
+   char tmName[NAME_DIM];
+   int InsertFlag;
+ 
+   int i, hi, lo = 0;  
+   double StartD0, StartD1 = 0.0, StopD0, StopD1, STARTD, STOPD, CurrentStart; 
+   int StartRecord, StopRecord;
+
+   char command[100];
+   char name[100];
+   
+   int status;
+   
+   double LastTime = 0.0, FirstTime = 0.0; // Times of the hole between files
+      
+   t_StartStop CurrentRecord; //  
+ 
+
+/*=================================================================
+ * Check arguments and options
+ *=================================================================*/
+   if(argc < 4)  {fprintf(stderr,"%s\n",usage); exit(1); }
+   
+/*-----------------------------------------------------------------*/
+   
+    
+        /* Open existing file */
+         if((status = nc_open(argv[1],NC_WRITE|NC_SHARE,&tmID)) != NC_NOERR)
+         {
+            fprintf(stderr,"Can not open file %s to write\n",argv[2]);
+            exit(0);
+         }
+         status = nc_inq_dimid(tmID,REC_DIM_NAME,&RecDimID);
+         status = nc_inq_varid(tmID, STARTTIME,&StartID);
+         status = nc_inq_varid(tmID, STOPTIME,&StopID);
+         status = nc_inq_varid(tmID, FILENAME,&NameID);
+         status = nc_inq_dimlen(tmID,RecDimID, &RecordsNumber);
+   
+/*==========================================================================*/
+  
+      hi = RecordsNumber;
+ 
+       STARTD = ISOTime2Double(argv[2]);
+       STOPD = ISOTime2Double(argv[3]);
+ 
+     while (lo <=  hi)
+       {               
+               i = (lo+hi)/2; 
+               TimeStart[0] = i + 1;
+               status = nc_get_vara_text(tmID,StartID,TimeStart,TimeCount,(char *)Start);
+               StartD1 = DD_Time2Double(Start);
+               if (StartD1 > STARTD) hi--;  
+               TimeStart[0] = i;
+               status = nc_get_vara_text(tmID,StartID,TimeStart,TimeCount,(char *)Start);
+               StartD0 = DD_Time2Double(Start);                
+               if (StartD0 < STARTD) lo++;
+
+               if (StartD1 <=  STARTD && StartD0 >= STARTD) break;
+       }  
+
+       StartRecord = i;
+       status = nc_get_vara_text(tmID,StopID,TimeStart,TimeCount,(char *)Stop);
+       StopD0 = DD_Time2Double(Stop);
+
+       while (STOPD > StopD0  &&  TimeStart[0] <= RecordsNumber) {
+              status = nc_get_vara_text(tmID,StopID,TimeStart,TimeCount,(char *)Stop);
+              if (status != NC_NOERR) fprintf(stderr," %s\n", nc_strerror(status));
+              StopD0 = DD_Time2Double(Stop);
+              TimeStart[0]++;
+        }
+
+       StopRecord = TimeStart[0]-1;
+
+// if NODATA is the very FIRST - insert NODATA 
+       if (StartRecord == 0  && (StartD0 - STARTD) > DATAGAP) {
+        
+           TimeStart[0] = 0;
+           status = nc_get_vara_text(tmID, NameID, TimeStart, NameCount,(char *)Name); 
+           if (strcmp(Name,NODATA) == 0 && (StartD0 - STOPD) < DATAGAP) {
+             status = nc_put_vara_text(tmID,StartID, TimeStart, TimeCount, Double2DD_Time(STARTD));          
+           }
+          else  {
+              strncpy(CurrentRecord.Name, NODATA, 7);  
+              strncpy(CurrentRecord.StartS,Double2DD_Time(STARTD),TIMELENGTH);
+              if ((StartD0 - STOPD)  < DATAGAP) strncpy(CurrentRecord.StopS,Start,TIMELENGTH); 
+                else strncpy(CurrentRecord.StopS,Double2DD_Time(STOPD),TIMELENGTH);
+              InsertRecord((size_t)(0), &CurrentRecord);
+          }          
+       }
+     
+        for (i = StartRecord; i < StopRecord ; i++) {
+
+         InsertFlag = 0;
+         TimeStart[0] = i;
+         status = nc_get_vara_text(tmID,StopID, TimeStart, TimeCount,(char *)Stop); 
+         StopD0 = DD_Time2Double(Stop);
+         TimeStart[0] = i+1; 
+         status = nc_get_vara_text(tmID,StartID, TimeStart, TimeCount, (char *)Start);
+         StartD1 = DD_Time2Double(Start);
+     
+
+// Data Gap -> NODATA
+ 
+         if ((StartD1 - StopD0) > DATAGAP)  {
+           strncpy(CurrentRecord.Name, NODATA,7);
+
+           TimeStart[0] = i;
+           status = nc_get_vara_text(tmID, NameID, TimeStart, NameCount,(char *)Name);     
+ 
+           if (strcmp(Name,NODATA) == 0) {
+                   strncpy(Stop,Start,TIMELENGTH);
+                   status = nc_get_vara_text(tmID,StartID, TimeStart, TimeCount, (char *)Start);
+                   status = nc_put_vara_text(tmID,StartID, TimeStart, TimeCount, (char *)Start);
+                   if ((StartD1 - STOPD) <  DATAGAP)
+                           status = nc_put_vara_text(tmID,StopID,TimeStart,TimeCount,(char *)Stop);
+                   else status = nc_put_vara_text(tmID,StopID,TimeStart,TimeCount,Double2DD_Time(STOPD));
+                   status = nc_put_vara_text(tmID,NameID,TimeStart,NameCount,(char *)CurrentRecord.Name);
+  
+                   InsertFlag = 1;
+           }
+
+            if (!InsertFlag) {
+                  if ((i == StartRecord) && (StopD0 < STARTD))
+                            strncpy(CurrentRecord.StartS,Double2DD_Time(STARTD),TIMELENGTH);
+                  else strncpy(CurrentRecord.StartS,Stop,TIMELENGTH);
+                  if ((i == StopRecord-1) && (StartD1 > STOPD))  
+                            strncpy(CurrentRecord.StopS,Double2DD_Time(STOPD),TIMELENGTH);
+                  else strncpy(CurrentRecord.StopS,Start,TIMELENGTH);
+                 
+                 if ((DD_Time2Double(CurrentRecord.StopS) - 
+                                     DD_Time2Double(CurrentRecord.StartS)) > DATAGAP)
+                                           InsertRecord((size_t)(i+1), &CurrentRecord);
+
+            }       
+         }
+
+      }
+     
+// if NODATA is the very LAST - add NODATA
+ 
+    if (StopRecord == RecordsNumber) {
+         TimeStart[0] = StopRecord-1;
+         status = nc_get_vara_text(tmID,StopID, TimeStart, TimeCount, (char *)Stop);
+         StopD0 = DD_Time2Double(Stop);
+
+         if (STOPD > StopD0) { 
+           status = nc_get_vara_text(tmID, NameID, TimeStart, NameCount,(char *)Name);  
+ 
+          if (strcmp(Name,NODATA) == 0  && (STARTD - StopD0) < DATAGAP) {
+              status = nc_get_vara_text(tmID,StartID, TimeStart, TimeCount, (char *)Start);
+              strncpy(Stop,Start,TIMELENGTH);
+          }
+          else  {
+               strncpy(Name, NODATA, 7); 
+               TimeStart[0]++;
+          }   
+         if ((STARTD - StopD0) < DATAGAP) CurrentStart = DD_Time2Double(Stop); 
+         else   CurrentStart = STARTD; 
+         if ((STOPD - CurrentStart) > DATAGAP) {
+            status = nc_put_vara_text(tmID,StartID,TimeStart,TimeCount, Double2DD_Time(CurrentStart));
+            status = nc_put_vara_text(tmID,StopID,TimeStart,TimeCount, Double2DD_Time(STOPD));
+            status = nc_put_vara_text(tmID,NameID,TimeStart,NameCount,(char *)Name);
+        }
+      }   
+    }
+
+ 
+   nc_sync(tmID);
+   status = nc_close(tmID);
+   exit(0);
+} 
+/*=========================================================================================================*/
diff --git a/src/DATA/TOOLS/infoLocal2nc.c b/src/DATA/TOOLS/infoLocal2nc.c
new file mode 100755
index 0000000..89e3abd
--- /dev/null
+++ b/src/DATA/TOOLS/infoLocal2nc.c
@@ -0,0 +1,132 @@
+/**
+*  @file infoLocal2nc.c
+*  @version $Id: infoLocal2nc.c,v 1.4 2012/11/12 09:55:15 budnik Exp $
+*  @brief DD Server Tools: Stand alone executable to convert info.xml to info.nc
+*  @arg  xml_name nc_name
+*
+*/
+/*================================================================================
+ *                       DD
+ *                  Server Manager
+ *                    infoLocal2nc.c
+ *                      V.1.0
+ *     args -> XML name and nc name
+ *     Modification of info2nc
+ *================================================================================*/
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <time.h>
+#include <math.h>
+#include <netcdf.h>
+#include <libxml/xmlmemory.h>
+#include <libxml/parser.h>
+#include <libxml/xpath.h>
+#include <DD.h>
+#include <DD_comm.h>
+
+/*----------- General constants ----------------------------*/
+#define MAXVAR       100
+#define BASEDIR     "DDBASE"
+
+/*------------- Global variables ---------------------------*/
+char temp[MAXVAR][PATHLENGTH];
+
+int main(int argc, char **argv)
+{
+    char *ncname;
+    xmlDocPtr doc;    
+    int i = 0, status;               
+    xmlNodePtr cur;
+    size_t length;
+
+    int fileID;
+    int InfoDimID, VarID[MAXVAR];
+    double number;
+    char DocPath[PATHLENGTH], *BasePathP;
+    /*---------- Get Target name from arguments -------------*/
+    if (argc < 3) 
+    {
+       fprintf(stderr,"Usage: infoLocal2nc SourceName TargetName\n");
+       exit(0);
+    }
+ 
+    /*------- Get full source name --------------------*/
+    if((BasePathP = getenv(BASEDIR)) == NULL)
+    {
+       fprintf(stderr,"infoLocal2nc: no %s environment\n",BASEDIR);
+       exit(0);
+    }
+    strcpy(DocPath,argv[1]);
+         
+    ncname = argv[2];
+    doc = xmlParseFile(DocPath);
+        
+    if(doc == NULL ) 
+    {
+       fprintf(stderr,"infoLocal2nc: Source document %s is not parsed successfully.\n",DocPath);
+       exit(0);  
+    } 
+
+    cur = xmlDocGetRootElement(doc); //GO the first node
+    if (cur == NULL) 
+    {
+        fprintf(stderr,"info2nc: empty Source Document %s\n",DocPath);
+        xmlFreeDoc(doc);
+        exit(0);
+    }
+
+//  Define nc file
+    ncopts = NC_VERBOSE;
+
+    if((status = nc_create(ncname,NC_CLOBBER, &fileID))  != NC_NOERR)
+    {
+       fprintf(stderr,"info2nc: Could not create file %s\n",ncname);
+       exit(1);
+    }
+    status = nc_def_dim(fileID,"info",PATHLENGTH, &InfoDimID);        
+    status = nc_enddef(fileID);
+    
+//  Now treat  info.xml          
+    cur = cur->xmlChildrenNode;
+    while (cur != NULL)
+    {                                                                   
+       if (xmlStrcmp(cur->name, (const xmlChar *)"text"))
+       { 
+          status = nc_redef(fileID);
+          if ((!xmlStrcmp(cur->name, (const xmlChar *)"MinSampling")) || 
+              (!xmlStrcmp(cur->name, (const xmlChar *)"MaxSampling")) ||
+	      (!xmlStrcmp(cur->name, (const xmlChar *)"FillValue")))
+ 
+             status = nc_def_var(fileID, (char *)cur->name, NC_DOUBLE, 0, &InfoDimID, &VarID[i]);
+ 
+          else 
+            status = nc_def_var(fileID, (char *)cur->name, NC_CHAR, 1, &InfoDimID, &VarID[i]);
+          status = nc_enddef(fileID);
+
+          if ((cur->xmlChildrenNode) != NULL)
+          { 
+             length = strlen((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));                      
+             strcpy(temp[i], (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
+             temp[i][length]='\0';
+ 
+             if ((!xmlStrcmp(cur->name, (const xmlChar *)"MinSampling")) ||
+                 (!xmlStrcmp(cur->name, (const xmlChar *)"MaxSampling")) || 
+		 (!xmlStrcmp(cur->name, (const xmlChar *)"FillValue"))) 
+             {
+                number = atof(temp[i]);
+                status = nc_put_var_double(fileID, VarID[i], &number);
+             } else status = nc_put_var_text(fileID,VarID[i],temp[i]);
+          }                     
+          i++;
+                 
+      }           
+      cur = cur->next; 
+   }
+
+   xmlFree(cur);                                    
+   xmlFreeDoc(doc);   
+   status=nc_close(fileID);
+   exit(1);
+}
+/*==========================================================================================================*/
diff --git a/src/DATA/TOOLS/join_nc.c b/src/DATA/TOOLS/join_nc.c
new file mode 100644
index 0000000..82e4b5e
--- /dev/null
+++ b/src/DATA/TOOLS/join_nc.c
@@ -0,0 +1,139 @@
+/* $Id: join_nc.c,v 1.2 2008/06/13 09:17:30 elena Exp $ */ 
+/** 
+*  @file join_nc.c
+*  @brief append input nc file to output nc file
+*  @arg input-file output-file
+*  @todo  Process errors - if needed ?
+*  @date 03.01.2008
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <netcdf.h>
+
+void  handle_error(int status)
+{
+  fprintf(stderr, "%s\n", nc_strerror(status));
+  exit(1);
+}
+
+int main(int argc, char *argv[])
+{
+   int status, ncID, infoID;
+   int ndims, nvars, ngatts, unlimdimid;
+   size_t dimlength, totalDimension = 1;
+   size_t *start, *count;
+   char dimname[NC_MAX_NAME], varname[NC_MAX_NAME], attname[NC_MAX_NAME];
+   int i, j;
+   int dimID[NC_MAX_DIMS];
+   int varID[NC_MAX_DIMS];
+   char constantInfoFile[NC_MAX_ATTRS];
+   char infoFile[NC_MAX_ATTRS];
+   nc_type var_type;                                                   /* variable type */
+   int var_ndims;                                                      /* number of dims */
+   int var_dimids[NC_MAX_VAR_DIMS];                                    /* dimension ids */
+   int var_natts;                                                      /* number of attributes */
+   void *variable;
+
+
+   if (argc < 3)
+    {
+       fprintf(stderr,"Usage: join_nc inputName outputName\n");
+       exit(0);
+    }
+   
+   strcpy(constantInfoFile,argv[1]);
+   strcpy(infoFile,argv[2]);
+  
+   if ((status = nc_open(infoFile, NC_WRITE, &ncID)) != NC_NOERR)
+                                                handle_error(status);
+
+   if ((status = nc_open(constantInfoFile, NC_NOWRITE, &infoID)) != NC_NOERR)
+                                                       handle_error(status);
+
+   if ((status = nc_inq(infoID, &ndims, &nvars, &ngatts, &unlimdimid)) != NC_NOERR)
+                                                       handle_error(status);
+// file into DEFINITION mode
+   nc_redef(ncID); 
+     
+//  Start with adding dimensions   
+     for (i = 0; i < ndims; i++) {
+        status = nc_inq_dim(infoID, i, dimname, &dimlength);
+        if (status == NC_NOERR) nc_def_dim(ncID, dimname, dimlength, &dimID[i]); 
+      }
+
+// adding Global Attributes
+
+    if (ngatts > 0)  
+         for (i = 0; i < ngatts; i++) {
+              status = nc_inq_attname(infoID, NC_GLOBAL, i, attname);
+              if (status == NC_NOERR) nc_copy_att(infoID, NC_GLOBAL, attname, ncID, NC_GLOBAL);  
+         }  
+     nc_enddef(ncID); 
+                            
+//  adding variables 
+      for (i = 0; i < nvars; i++) {
+        nc_redef(ncID); 
+
+        
+        status = nc_inq_var (infoID, i, varname, &var_type, &var_ndims, var_dimids, &var_natts);
+        start = (size_t *) malloc(var_ndims*sizeof(size_t));
+        count = (size_t *) malloc(var_ndims*sizeof(size_t));
+        for (j = 0; j <  var_ndims; j++)  {                               
+                status = nc_inq_dimlen(infoID, var_dimids[j], &dimlength);
+                if (status == NC_NOERR) totalDimension *= dimlength;
+                 start[j] = 0; 
+                 count[j] = dimlength;  
+                 var_dimids[j] = dimID[var_dimids[j]];
+          }
+        if (status == NC_NOERR) nc_def_var(ncID, varname, var_type, var_ndims, var_dimids, &varID[i]); 
+        if (var_natts > 0)  
+            for (j = 0; j < var_natts; j++) {    
+               status = nc_inq_attname(infoID, i, j, attname);
+               if (status == NC_NOERR) nc_copy_att(infoID, i, attname, ncID, varID[i]);
+         } 
+        nc_enddef(ncID);
+
+         switch(var_type){
+          case NC_FLOAT: {                    
+                  variable = (float *) malloc(totalDimension*sizeof(float)); 
+                  status = nc_get_vara_float(infoID, i, start, count, variable);
+                  if (status == NC_NOERR) nc_put_vara_float(ncID, varID[i], start, count, variable);
+                 break;
+               }
+          case NC_DOUBLE: {
+                  variable = (double *) malloc(totalDimension*sizeof(double)); 
+                  status = nc_get_vara_double(infoID, i, start, count, variable);
+                  if (status == NC_NOERR) nc_put_vara_double(ncID, varID[i], start, count, variable);
+                  break;
+                }
+          case NC_SHORT: {
+                 variable = (short *) malloc(totalDimension*sizeof(short));
+                 status = nc_get_vara_short(infoID, i, start, count, variable);
+                 if (status == NC_NOERR) nc_put_vara_short(ncID, varID[i], start, count, variable);
+                 break;
+                }
+          case NC_INT: {
+                 variable = (int *) malloc(totalDimension*sizeof(int));
+                 status = nc_get_vara_int(infoID, i, start, count, variable);
+                 if (status == NC_NOERR) nc_put_vara_int(ncID, varID[i], start, count, variable);
+                 break;
+              }
+          case NC_CHAR: {
+                 variable = (char *) malloc(totalDimension*sizeof(char));
+                 status = nc_get_vara_text(infoID, i, start, count, variable);
+                 if (status == NC_NOERR) nc_put_vara_text(ncID, varID[i], start, count, variable);
+               }
+        }
+           totalDimension = 1;
+           free(variable); free(start); free(count);
+       }         
+   
+
+   if ((status = nc_close(ncID)) != NC_NOERR)
+                                    handle_error(status);
+
+   if ((status = nc_close(infoID)) != NC_NOERR)
+                                    handle_error(status);
+}
diff --git a/src/DATA/TOOLS/makeDDsys.c b/src/DATA/TOOLS/makeDDsys.c
new file mode 100755
index 0000000..f83f05c
--- /dev/null
+++ b/src/DATA/TOOLS/makeDDsys.c
@@ -0,0 +1,204 @@
+/*================================================================================
+ *                       DD
+ *                Server Package
+ *                  makeDDsys.c
+ *                     V.4.2
+ *  Stand-alone executable to create refer.nc file form DDsys.xml file
+ *  Program search the DDsys.xml in the directory $DDBASE, and creates
+ *  refer.nc in this directory. See structure of DDsys.xml in 
+ * ../DOC/TECHDOC/DDBaseStruc.html
+ * 
+ * Versions:
+ *     Apr 23 1997, V.2.0 Adding CASH into refer.nc file 
+ *     Jun 18 2007, V.3.0 Length 128
+ *     1 Aug 2007,  V.4.0 XML version
+ *     6 Sep 2007,  V.4.1 Knizhnikova-Fedorova, small changes
+ *     9 Nov 2009,  V.4.2 netCDF 3
+ *================================================================================*/
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <time.h>
+#include <math.h>
+#include <netcdf.h>
+#include <libxml/xmlmemory.h>
+#include <libxml/parser.h>
+#include <libxml/xpath.h>
+#include <DD.h>
+#include <DD_comm.h>
+
+/*----------- General constants ----------------------------*/
+#define MAXVIRIN 1000
+#define SOURCENAME  "/DDsys.xml"
+#define BASEDIR     "DDBASE"
+
+/*----------- Global variables ------------------------------*/
+char varname[MAXVIRIN][PATHLENGTH];
+char datadirname[MAXVIRIN][PATHLENGTH];
+char timesname[MAXVIRIN][PATHLENGTH];
+char infoname[MAXVIRIN][PATHLENGTH];
+char cashname[MAXVIRIN][PATHLENGTH];
+
+int basenumber;           /* number of virtual instruments */
+
+/*---------------------- REFER CREATE ------------------------*/
+void ReferCreate(char *BasePathP)
+{
+   int fileID;
+   int InfoDimID, LengthDimID;
+   int VarDimVector[2];
+   int VarID[MAXVIRIN];
+   size_t DirStart[2] = {0L,0L};
+   size_t TimesStart[2] = {1L,0L};
+   size_t InfoStart[2] = {2L,0L};
+   size_t CashStart[2] = {3L,0L};
+   size_t VarCount[2] = {1L,PATHLENGTH};
+   int i, status;
+   char DestPath[PATHLENGTH];
+
+  // ncopts = NC_VERBOSE;
+   
+   /*
+    * Full path name
+    */
+   
+    strcpy(DestPath,BasePathP);
+    strcat(DestPath,REFNAME);
+
+   if((status =  nc_create( DestPath, NC_CLOBBER, &fileID)) != NC_NOERR)
+   {
+     fprintf(stderr,"makeDDsys: Could not create file %s\n",DestPath);
+     exit(1);
+   }
+
+   nc_def_dim(fileID, "info", 4L, &InfoDimID);
+   nc_def_dim(fileID, "length", PATHLENGTH, &LengthDimID);
+  
+   VarDimVector[0] = InfoDimID;
+   VarDimVector[1] = LengthDimID;
+
+   for(i = 0; i < basenumber; i++)
+        nc_def_var(fileID, varname[i], NC_CHAR, 2, VarDimVector, &VarID[i]);
+
+   nc_enddef(fileID);
+
+   for(i = 0; i < basenumber; i++)
+   {       
+       nc_put_vara_text(fileID,VarID[i],DirStart,VarCount,(void *)datadirname[i]);
+       nc_put_vara_text(fileID,VarID[i],TimesStart,VarCount,(void *)timesname[i]);
+       nc_put_vara_text(fileID,VarID[i],InfoStart,VarCount,(void *)infoname[i]);
+       nc_put_vara_text(fileID,VarID[i],CashStart,VarCount,(void *)cashname[i]);
+      
+   }
+   status = nc_close(fileID);
+}
+/*--------------------------------------------------------------------------*/
+ 
+ int main(int argc, char **argv)
+{
+    
+    xmlDocPtr doc;
+    xmlChar *xpath = (xmlChar*) "//VI";    
+    xmlNodeSetPtr nodeset;
+    xmlXPathObjectPtr result;
+    int i, j, size = 2, length;
+    xmlChar *name, *argsNr;            
+    xmlXPathContextPtr context;
+    xmlNodePtr cur;
+    char BasePath[PATHLENGTH], *BasePathP;
+
+    /*
+     * Create full Source Name 
+     */
+    if((BasePathP = getenv(BASEDIR)) == NULL)
+    {
+       fprintf(stderr,"makeDDsys: no %s environment\n",BASEDIR);
+       exit(0);
+    }
+    strcpy(BasePath,BasePathP);
+    strcat(BasePath,SOURCENAME);
+    
+    doc = xmlParseFile(BasePath);
+    if (doc == NULL ) 
+    {
+       fprintf(stderr,"Document not parsed successfully. \n");
+       exit(0);
+    } 
+
+    context = xmlXPathNewContext(doc);
+    if (context == NULL) 
+    {
+        fprintf(stderr,"Error in xmlXPathNewContext\n");
+        exit(0);
+    }
+    result = xmlXPathEvalExpression(xpath, context);
+  
+    if (result == NULL) 
+    {
+        fprintf(stderr,"Error in xmlXPathEvalExpression\n");
+        exit(0);
+    }
+
+    if(xmlXPathNodeSetIsEmpty(result->nodesetval))
+    {
+       xmlXPathFreeObject(result);
+       fprintf(stderr,"No result\n");
+       exit(0);
+    }
+    if (result) 
+    {
+       nodeset = result->nodesetval;
+       fprintf(stderr," VI number: %d\n", nodeset->nodeNr);
+       basenumber = nodeset->nodeNr;
+       for (i = 0; i < nodeset->nodeNr; i++) 
+       { 
+          cur = nodeset->nodeTab[i]->xmlChildrenNode;  
+          while (cur != NULL)
+          { 
+             if((xmlStrcmp(cur->name, (const xmlChar *)"text"))){
+             length = strlen((char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1));
+ 
+             }
+              if (!(xmlStrcmp(cur->name, (const xmlChar *)"NAME")))
+              { 
+                  
+                           strncpy(varname[i], (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1), length);              
+              }    
+              if (!(xmlStrcmp(cur->name, (const xmlChar *)"LOCATION")))
+              { 
+                 strncpy(datadirname[i], (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1), length);                  
+              }   
+              if (!(xmlStrcmp(cur->name, (const xmlChar *)"TIMES")))
+              {                    
+                 strncpy(timesname[i],datadirname[i], strlen(datadirname[i]));
+                 strncpy(&timesname[i][strlen(datadirname[i])], (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1), length);
+             
+              }   
+              if (!(xmlStrcmp(cur->name, (const xmlChar *)"INFO")))
+              {                 
+                  strncpy(infoname[i],datadirname[i], strlen(datadirname[i]));
+                  strncpy(&infoname[i][strlen(datadirname[i])], (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1), length);
+              }   
+              if (!(xmlStrcmp(cur->name, (const xmlChar *)"CACHE")))
+              {                  
+                 strncpy(cashname[i],datadirname[i], strlen(datadirname[i]));
+                 strncpy(&cashname[i][strlen(datadirname[i])], (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1), length);
+              }  
+                                                                      
+              cur = cur->next;              
+           }                          
+       }
+       xmlFree(cur);
+       xmlXPathFreeObject(result);    
+   }
+           
+   xmlXPathFreeContext(context);   
+   xmlFreeDoc(doc);
+   xmlCleanupParser();
+
+   ReferCreate(BasePathP);
+   return (1);
+}
+/*================================================================================*/
+
diff --git a/src/DDADMIN/DDadmin.c b/src/DDADMIN/DDadmin.c
new file mode 100755
index 0000000..64680d7
--- /dev/null
+++ b/src/DDADMIN/DDadmin.c
@@ -0,0 +1,758 @@
+/*
+ *-------------------- DD_ADMIN ------------------------------- 
+ *                      V.1.1
+*/ 
+/* name:         DDadmin.c
+ * author:       Alexandr Grigoriev
+ * Insitution:   IKI RAN lab.546 aug@afed.iki.rssi.ru
+ * date :        March    1999
+ * sinopsis:
+ *
+ * usage:
+ *
+ * Description: Program is to adding users into DD access list.
+ *  Nov 30   2009 - V.1.1 - netCDF-3
+    Nov 08   2011 - 
+ */
+  
+
+#define _XOPEN_SOURCE
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <limits.h>
+#include <unistd.h>
+#include <time.h>
+#include <DD.h>
+#include <netcdf.h>
+#include <DD_Access.h>
+
+#define FILE_PATH_LEN  1024
+#define LOGIN_MIN_LEN  2
+#define LOGIN_MAX_LEN  10
+#define PWD_HASHED_LEN 13
+#define PWD_MIN_LEN    5
+#define PWD_MAX_LEN    80
+#define PWD_GEN_SIZE   6
+
+#define NC_USER_NAME     "user"
+#define NC_USER_LEN_NAME "UserLength"
+#define NC_PWD_LEN_NAME  "PasswdLength"
+#define NC_MEMBER_NAME   "member"
+#define NC_PWD_NAME      "passwd"
+
+#define ERR_BAD_REQUEST      1
+#define ERR_DDBASE_UNDEFINED 2
+#define ERR_FILE_UNREACHABLE 3
+#define ERR_FILE_BAD_INFO    4
+#define ERR_MANUAL_ABORTED   5
+#define ERR_REQUEST_FAILED   6
+
+typedef enum {OP_ADD_MANUAL,
+              OP_ADD_AUTO,  
+              OP_MODIFY,
+              OP_DELETE,
+              OP_RESET,
+	      OP_GET_SALT,
+              OP_GET_LIST
+             } t_Op;
+   
+typedef struct {
+  t_Op op;
+  char login[LOGIN_MAX_LEN+1];
+  char pwd_hash[PWD_HASHED_LEN+1];
+  char pwd_hash_new[PWD_HASHED_LEN+1];
+} t_Request;
+
+typedef struct {
+  int  ncID; 
+  int  UserID; 
+  int  UserLenID; 
+  int  PwdLenID;
+  int  MemberID;
+  int  PwdID;
+  long MaxRecords; 
+  long UserLen; 
+  long PwdLen;
+} t_UserFileInfo;
+
+//---------------------------------------------------------------------------
+void Usage(void)
+{
+  printf("DDadmin [-option] [login] [pwd_hash] [pwd_hash_new]\n");
+  printf("  * without arguments: add new user manually\n");
+  printf("  * -option :\n");
+  printf("      -a : add new user [login] with the hashed password [pwd_hash]\n");
+  printf("      -m : modify the password of user [login]. [pwd_hash] is checked, and replace by [pwd_hash_new]\n");
+  printf("      -r : reset the password of user [login]. A new one is generated\n");
+  printf("      -d : delete the user [login]\n");
+  printf("      -s : return salt used to crypt the password of user [login]\n");
+  printf("      -l : return a list of users\n");
+  printf("      -h : this help\n");
+}
+//---------------------------------------------------------------------------
+unsigned char GetRandomChar(void)
+{
+  return (unsigned char)(rand()%26+'a');
+}
+//--------------------------------------------------------------------------
+int TestLogin(char *login)
+{
+  int j = strlen(login);
+  if(j<LOGIN_MIN_LEN)
+    {
+      printf("login is too short.\n");
+      return 0;
+    }
+  if(j>LOGIN_MAX_LEN) 
+    {
+      printf("login is too long.\n");
+      return 0;
+    }
+  return 1;
+}
+//-------------------------------------------------------------------------
+int GetLogin(char *login)
+{
+  printf("login:");
+  
+  char l = '\0';
+  int j = 0;
+
+  while((l!='\n'))
+    {
+      l=getchar();
+      if(j < LOGIN_MAX_LEN) 
+	login[j] = l;
+      j++;
+    }
+
+  login[j-1] = '\0';
+
+  if (!TestLogin(login))
+    return 0;
+
+  return 1;
+}
+//--------------------------------------------------------------------
+int TestPwd(char *pwd)
+{
+  int j = strlen(pwd);
+  if(j < PWD_MIN_LEN)
+    {
+      printf("Password is too short.\n");
+      return 0;
+    }
+  if(j > PWD_MAX_LEN) 
+    {
+      printf("Password is too long.\n");
+      return 0;
+    }
+  return 1;
+}
+//--------------------------------------------------------------------
+int GetNewPwd(char *pwd)
+{
+  char pas1[PWD_MAX_LEN+1];
+  char pas2[PWD_MAX_LEN+1];
+
+  int isFinish = 0;
+  while (!isFinish)
+    {
+      strcpy(pas1,getpass("New password:"));
+      pas1[strlen(pas1)] = '\0';
+      isFinish = TestPwd(pas1);
+    }
+
+  strcpy(pas2,getpass("Retype new password:"));
+  pas2[strlen(pas2)] = '\0';
+
+  int ok = (strcmp(pas1,pas2) == 0);
+
+  if (ok)
+    strcpy(pwd,pas1);
+
+  memset(pas1,0,(PWD_MAX_LEN+1)*sizeof(char));
+  memset(pas2,0,(PWD_MAX_LEN+1)*sizeof(char));
+
+  if (!ok)
+    {
+      printf("Error - Passwords mismatch\n");
+      return 0;
+    }
+
+  return 1;
+}
+//--------------------------------------------------------------------
+int GeneratePwd(char *pwd)
+{
+  int i = 0;
+  for (i = 0; i < PWD_GEN_SIZE; i++)
+    pwd[i] = GetRandomChar();
+  return 1;
+}
+//--------------------------------------------------------------------
+int GetRequest(int argc, char *argv[], t_Request *request)
+{
+  memset(request,0,sizeof(t_Request));
+
+  if (argc < 2)
+    {
+      request->op = OP_ADD_MANUAL;
+      return 1;
+    }
+
+  if ((strlen(argv[1]) != 2) || (argv[1][0] != '-'))
+    {
+      printf("Error - Bad option\n");
+      Usage();
+      return 0;
+    }
+
+  //option
+  switch (argv[1][1])
+    {
+    case 'a' :
+      request->op = OP_ADD_AUTO;
+      break;
+    case 'm' :
+      request->op = OP_MODIFY;
+      break;
+    case 'd' :
+      request->op = OP_DELETE;
+      break;
+    case 'r' :
+      request->op = OP_RESET;
+      break;
+    case 'h' :
+      Usage();
+      return 0;
+    case 's' :
+      request->op = OP_GET_SALT;
+      break;
+    case 'l' :
+      request->op = OP_GET_LIST;
+      return 1;
+    default :
+      printf("Error - Bad option\n");
+      Usage();
+      return 0;
+    }
+
+  //login
+  if (argc < 3)
+    {
+      printf("Error - Cannot get login\n");
+      Usage();
+      return 0;
+    }      
+  
+  if (!TestLogin(argv[2]))
+    {
+      Usage();
+      return 0;
+    }
+
+  strcpy(request->login, argv[2]);
+
+  if ((request->op == OP_ADD_AUTO) || (request->op == OP_MODIFY))
+    {
+      //password hash code
+      if (argc < 4)
+	{
+	  printf("Error - Cannot get password hash code\n");
+	  Usage();
+	  return 0;
+	}
+      if (strlen(argv[3]) != PWD_HASHED_LEN)
+	{
+	  printf("Error - Incorrect password hash code\n");
+	  Usage();
+	  return 0;
+	}
+      strcpy(request->pwd_hash, argv[3]);
+
+      if (request->op == OP_MODIFY)
+	{
+	  //new password hash code
+	  if (argc < 5)
+	    {
+	      printf("Error - Cannot get new password hash code\n");
+	      Usage();
+	      return 0;
+	    }
+	  if (strlen(argv[4]) != PWD_HASHED_LEN)
+	    {
+	      printf("Error - Incorrect new password hash code\n");
+	      Usage();
+	      return 0;
+	    }
+	  strcpy(request->pwd_hash_new, argv[4]); 
+	}
+    }
+
+  return 1;
+}
+//--------------------------------------------------------------------------
+int GetUserFilePath(char *path)
+{
+  path[0]='\0';
+  char *ddbase;
+  if((ddbase = getenv("DDBASE")) == NULL)
+    {
+      printf("No DDBASE info \n");
+      return 0;
+    }
+  strcpy(path,ddbase);
+  strcat(path,USERREFNAME);
+  return 1;
+}
+//--------------------------------------------------------------------------
+int OpenUserFile(char *path, t_UserFileInfo *fileInfo)
+{
+  int status;
+  if((status = nc_open(path, NC_WRITE, &fileInfo->ncID)) != NC_NOERR)
+    {
+      printf("Error in opening file = %u\n", fileInfo->ncID);
+      return 0;
+   }
+  return 1;
+}
+//--------------------------------------------------------------------------
+int CloseUserFile(t_UserFileInfo *fileInfo)
+{
+  nc_close(fileInfo->ncID);
+  memset(fileInfo,0,sizeof(t_UserFileInfo));
+  return 1;
+}
+//---------------------------------------------------------------------------
+int GetFileInfo(t_UserFileInfo *fileInfo)
+{
+  int status;
+
+  if (((status = nc_inq_unlimdim(fileInfo->ncID, (size_t *)&fileInfo->UserID))                       != NC_NOERR) ||
+      ((status = nc_inq_dimlen(fileInfo->ncID, fileInfo->UserID,  (size_t *)&fileInfo->MaxRecords))  != NC_NOERR) ||
+      ((status = nc_inq_dimid(fileInfo->ncID, NC_USER_LEN_NAME, &fileInfo->UserLenID))     != NC_NOERR) ||
+      ((status = nc_inq_dimid(fileInfo->ncID, NC_PWD_LEN_NAME, &fileInfo->PwdLenID))       != NC_NOERR) ||
+      ((status = nc_inq_dimlen(fileInfo->ncID, fileInfo->UserLenID, (size_t *)&fileInfo->UserLen))   != NC_NOERR) ||
+      ((status = nc_inq_dimlen(fileInfo->ncID, fileInfo->PwdLenID,  (size_t *)&fileInfo->PwdLen))    != NC_NOERR) ||
+      ((status = nc_inq_varid(fileInfo->ncID, NC_MEMBER_NAME, &fileInfo->MemberID))        != NC_NOERR) ||
+      ((status = nc_inq_varid(fileInfo->ncID, NC_PWD_NAME, &fileInfo->PwdID))              != NC_NOERR))
+    {
+      printf("Error - Cannot get file information\n");
+      return 0;
+    }
+
+  fileInfo->UserLen = LOGIN_MAX_LEN;
+  fileInfo->PwdLen = PWD_HASHED_LEN;
+
+  return 1;
+}
+//--------------------------------------------------------------------------
+int CreateUserFile(char *filePath, t_UserFileInfo *fileInfo)
+{
+  int status;
+  fileInfo->UserLen = LOGIN_MAX_LEN;
+  fileInfo->PwdLen = PWD_HASHED_LEN;
+
+  if (((status = nc_create (filePath,NC_SHARE,&fileInfo->ncID))                                              != NC_NOERR) ||
+      ((status = nc_def_dim (fileInfo->ncID, NC_USER_NAME, NC_UNLIMITED, &fileInfo->UserID))                 != NC_NOERR) ||
+      ((status = nc_def_dim (fileInfo->ncID, NC_USER_LEN_NAME, fileInfo->UserLen+1, &fileInfo->UserLenID))   != NC_NOERR) ||
+      ((status = nc_def_dim (fileInfo->ncID, NC_PWD_LEN_NAME, fileInfo->PwdLen+1, &fileInfo->PwdLenID))      != NC_NOERR))
+    {
+      printf("Error - Cannot create users file\n");
+      return 0;
+    }
+
+  int MemberDimVector[2] = {fileInfo->UserID,fileInfo->UserLenID};
+  int PwdDimVector[2] = {fileInfo->UserID,fileInfo->PwdLenID};
+  if (((status = nc_def_var (fileInfo->ncID, NC_MEMBER_NAME,NC_CHAR,2, MemberDimVector,&fileInfo->MemberID)) != NC_NOERR) ||
+      ((status = nc_def_var (fileInfo->ncID, NC_PWD_NAME, NC_CHAR, 2, PwdDimVector, &fileInfo->PwdID))       != NC_NOERR))
+    {
+      printf("Error - Cannot create users file\n");
+      return 0;
+    }
+  
+  nc_enddef(fileInfo->ncID);
+
+  return 1;
+}
+//--------------------------------------------------------------------------
+int CleanUserFile(void)
+{
+  t_UserFileInfo fileInfo, tmpFileInfo;
+  memset(&fileInfo,0,sizeof(t_UserFileInfo));
+  memset(&tmpFileInfo,0,sizeof(t_UserFileInfo));
+  
+  char refname[FILE_PATH_LEN], tmpname[FILE_PATH_LEN];
+  if (!GetUserFilePath(refname))
+    return 0;
+  strcpy(tmpname,refname);
+  strcat(tmpname,".tmp");
+
+  if (!OpenUserFile(refname,&fileInfo))
+    return 0;
+
+  if (!GetFileInfo(&fileInfo))
+    return 0;
+
+  if (!CreateUserFile(tmpname,&tmpFileInfo))
+    return 0;
+
+  int i; 
+  int c = 0;
+  char crtLogin[LOGIN_MAX_LEN+1];
+  char crtPwd[PWD_MAX_LEN+1];
+  for(i = 0; i < fileInfo.MaxRecords; i++) 
+    {
+      if (!GetLoginFromIndex(i,&fileInfo,crtLogin) || !GetPwdFromIndex(i,&fileInfo,crtPwd))
+	continue;
+      
+      //clean login string
+      memset(crtLogin+strlen(crtLogin),0,(LOGIN_MAX_LEN+1-strlen(crtLogin))*sizeof(char));
+
+      if ((strcmp(crtLogin,"") == 0) || (strcmp(crtPwd,"") == 0))
+	continue;
+      
+      if (!SetLoginToIndex(c, &tmpFileInfo, crtLogin))
+	{
+	  printf("Error - Cannot add a login on the temporary file\n");
+	  return 0;
+	}
+
+      if (!SetPwdToIndex(c, &tmpFileInfo, crtPwd))
+	{
+	  printf("Error - Cannot add a password on the temporary file\n");
+	  return 0;
+	}
+
+      c++;
+    }
+
+  CloseUserFile(&fileInfo);
+  CloseUserFile(&tmpFileInfo);
+
+  char cmd[2048];
+  sprintf(cmd,"cp %s %s",tmpname,refname);
+  system(cmd);
+  sprintf(cmd,"rm %s",tmpname);
+  system(cmd);
+
+  return 1;
+}
+//---------------------------------------------------------------------------
+int CreateSaveUserFile(void)
+{
+  char refname[FILE_PATH_LEN];
+  char savename[FILE_PATH_LEN];
+  
+  if (!GetUserFilePath(refname))
+    return 0;
+  strcpy(savename,refname);
+  strcat(savename,"~");
+
+  char cmd[2048];
+  sprintf(cmd,"cp %s %s",refname,savename);
+  system(cmd);
+
+  return 1;
+}
+//---------------------------------------------------------------------------
+int GetPwdFromIndex(int index, t_UserFileInfo *fileInfo, char *pwd_hash)
+{
+  long start[2] = {0L,0L}, count[2]={1L,1L};
+  start[0] = index;
+  count[1] = fileInfo->PwdLen;
+  return (nc_get_vara_text(fileInfo->ncID,fileInfo->PwdID,(size_t *)start,(size_t *)count, pwd_hash) == NC_NOERR);
+}
+//---------------------------------------------------------------------------
+int GetLoginFromIndex(int index, t_UserFileInfo *fileInfo, char *login)
+{
+  long start[2] = {0L,0L}, count[2]={1L,1L};
+  start[0] = index;
+  count[1] = fileInfo->UserLen;
+  return (nc_get_vara_text(fileInfo->ncID,fileInfo->MemberID,(size_t *)start,(size_t *)count, login) == NC_NOERR);
+}
+//--------------------------------------------------------------------------
+int SetPwdToIndex(int index, t_UserFileInfo *fileInfo, char *pwd_hash)
+{
+  long start[2] = {0L,0L}, count[2]={1L,1L};
+  start[0] = index;
+  count[1] = fileInfo->PwdLen;
+  return (nc_put_vara_text(fileInfo->ncID,fileInfo->PwdID,(size_t *)start,(size_t *)count, pwd_hash) == NC_NOERR);
+}
+//---------------------------------------------------------------------------
+int SetLoginToIndex(int index, t_UserFileInfo *fileInfo, char *login)
+{
+  long start[2] = {0L,0L}, count[2]={1L,1L};
+  start[0] = index;
+  count[1] = fileInfo->UserLen;
+  return (nc_put_vara_text(fileInfo->ncID,fileInfo->MemberID,(size_t *)start,(size_t *)count, login) == NC_NOERR);
+}
+//---------------------------------------------------------------------------
+int SearchLoginIndex(char *login, t_UserFileInfo *fileInfo)
+{
+  char crtLogin[LOGIN_MAX_LEN+1];
+  int i;
+
+  for(i = 0; i < fileInfo->MaxRecords; i++) 
+    {
+      if (!GetLoginFromIndex(i,fileInfo,crtLogin))
+	continue;
+      crtLogin[fileInfo->UserLen] = '\0';
+      
+     if(strcmp(crtLogin,login) == 0)
+       return i;
+    }
+  
+  return -1;
+}
+
+//--------------------------------------------------------------------------
+int AddUser(t_Request request, t_UserFileInfo *fileInfo)
+{
+  if (!SetLoginToIndex(fileInfo->MaxRecords,fileInfo,request.login))
+    {
+      printf("Error to add new login user");
+      return 0;
+    }
+
+  if (!SetPwdToIndex(fileInfo->MaxRecords,fileInfo,request.pwd_hash))
+    {
+      printf("Error to add new login user");
+      return 0;
+    }
+
+  return 1;
+}
+//-------------------------------------------------------------------------
+int ModifyUser(t_Request request, t_UserFileInfo *fileInfo, int check)
+{
+  int index = SearchLoginIndex(request.login, fileInfo);
+
+  if (index < 0)
+    {
+      printf("User %s not found\n",request.login);
+      return 0;
+    }
+
+  if (check)
+    {
+      char pwd_hash[PWD_HASHED_LEN+1];
+      if (!GetPwdFromIndex(index,fileInfo,pwd_hash))
+	{
+	  printf("Error to get user password\n");
+	  return 0;
+	}
+      if (strcmp(pwd_hash,request.pwd_hash) != 0)
+	{
+	  printf("Bad password\n");
+	  return 0;
+	}
+    }
+     
+  if (!SetPwdToIndex(index,fileInfo,request.pwd_hash_new))
+    {
+      printf("Error to set new user password\n");
+      return 0;
+    }
+  
+  return 1;
+}
+//--------------------------------------------------------------------------
+int DeleteUser(t_Request request, t_UserFileInfo *fileInfo)
+{
+  int index = SearchLoginIndex(request.login, fileInfo);
+
+  if (index < 0)
+    {
+      printf("User %s not found\n",request.login);
+      return 0;
+    }
+ 
+  char login[LOGIN_MAX_LEN+1];
+  memset(login,0,(LOGIN_MAX_LEN+1)*sizeof(char));
+
+  if (!SetLoginToIndex(index,fileInfo,login))
+    {
+      printf("Error to delete user password\n");
+      return 0;
+    }
+
+  char pwd_hash[PWD_HASHED_LEN+1];
+  memset(pwd_hash,0,(PWD_HASHED_LEN+1)*sizeof(char));
+
+  if (!SetPwdToIndex(index,fileInfo,pwd_hash))
+    {
+      printf("Error to delete user password\n");
+      return 0;
+    } 
+  
+  return 1;
+}
+//--------------------------------------------------------------------------
+int ResetUser(t_Request request, t_UserFileInfo *fileInfo)
+{
+  char salt[2];
+  salt[0] = GetRandomChar();
+
+  char pwd[PWD_GEN_SIZE+1];
+  memset(pwd,0,(PWD_GEN_SIZE+1)*sizeof(char));
+  GeneratePwd(pwd);
+
+  printf("%s\n",pwd);
+
+  salt[1] = GetRandomChar();
+
+  //hash pwd
+  strcpy(request.pwd_hash_new,crypt(pwd,salt));
+  memset(pwd,0,(PWD_GEN_SIZE+1)*sizeof(char));
+  
+  return ModifyUser(request, fileInfo, 0);
+}
+//--------------------------------------------------------------------------
+int GetSalt(t_Request request, t_UserFileInfo *fileInfo)
+{
+  int index = SearchLoginIndex(request.login, fileInfo);
+
+  if (index < 0)
+    {
+      printf("User %s not found\n",request.login);
+      return 0;
+    }
+
+  char pwd_hash[PWD_HASHED_LEN+1];
+  if (!GetPwdFromIndex(index,fileInfo,pwd_hash))
+    {
+      printf("Error to get user password\n");
+      return 0;
+    }
+
+  char salt[3];
+  strncpy(salt,pwd_hash,2);
+  salt[2] = '\0';
+  printf("%s\n",salt);
+
+  return 1;
+}
+//---------------------------------------------------------------------------
+int GetUsersList(t_Request request, t_UserFileInfo *fileInfo)
+{
+  char crtLogin[LOGIN_MAX_LEN+1];
+  int i;
+
+  int addComa = 0;
+
+  for(i = 0; i < fileInfo->MaxRecords; i++)
+    {
+      if (!GetLoginFromIndex(i,fileInfo,crtLogin))
+        continue;
+      if (addComa)
+        printf(",");
+      printf("%s",crtLogin);
+      addComa = 1;
+    }
+
+  printf("\n");
+
+  return 1;
+
+}
+//---------------------------------------------------------------------------
+int CompleteRequest(t_Request *request, t_UserFileInfo *fileInfo)
+{
+  char salt[2];
+  salt[0] = GetRandomChar();
+
+  //get login
+  int isFinish = 0;
+  while (!isFinish)
+    {
+      GetLogin(request->login);
+      if (SearchLoginIndex(request->login, fileInfo) > -1)
+	printf("User login not available. Change your login please.\n");
+      else
+	isFinish = 1;
+    }
+
+  //get password
+  char pwd[PWD_MAX_LEN+1];
+  if (!GetNewPwd(pwd))
+    return 0;
+  
+  salt[1] = GetRandomChar();
+
+  //hash pwd
+  strcpy(request->pwd_hash,crypt(pwd,salt));
+  memset(pwd,0,(PWD_MAX_LEN+1)*sizeof(char));
+
+  return 1;
+}
+//---------------------------------------------------------------------------
+main (int argc, char *argv[])
+{  
+  srand(time(NULL));
+
+  t_Request request;
+  if (!GetRequest(argc, argv, &request))
+    exit(ERR_BAD_REQUEST);
+  
+  char refname[FILE_PATH_LEN];
+  if (!GetUserFilePath(refname))
+    exit(ERR_DDBASE_UNDEFINED);
+  
+  t_UserFileInfo fileInfo;
+  memset(&fileInfo,0,sizeof(t_UserFileInfo));
+
+  if (!OpenUserFile(refname,&fileInfo))
+    exit(ERR_FILE_UNREACHABLE);
+  
+  
+  if (!GetFileInfo(&fileInfo)) 
+    exit(ERR_FILE_BAD_INFO);
+  
+  if (request.op == OP_ADD_MANUAL) 
+    if (!CompleteRequest(&request,&fileInfo))
+      {
+	CloseUserFile(&fileInfo);
+	exit(ERR_MANUAL_ABORTED);
+      }
+
+  int res = 0;
+  if ((request.op != OP_GET_SALT) && (request.op != OP_GET_LIST))
+    CreateSaveUserFile();
+  switch (request.op)
+    {
+    case OP_ADD_MANUAL :
+    case OP_ADD_AUTO   :
+      res = AddUser(request,&fileInfo);
+      break;
+    case OP_MODIFY :
+      res = ModifyUser(request,&fileInfo,1);
+      break;
+    case OP_DELETE :
+      res = DeleteUser(request,&fileInfo);
+      break;
+    case OP_RESET  :
+      res = ResetUser(request,&fileInfo);
+      break;
+    case OP_GET_SALT :
+      res = GetSalt(request,&fileInfo);
+      break;
+    case OP_GET_LIST :
+      res = GetUsersList(request,&fileInfo);
+      break;
+    }
+
+  CloseUserFile(&fileInfo);
+
+  if (res && (request.op == OP_DELETE))
+    CleanUserFile();
+
+  memset(&request,0,sizeof(t_Request));
+
+  if (!res)
+    exit(ERR_REQUEST_FAILED);
+
+  return 0;
+}
diff --git a/src/DDSERVICES/REST/generateGranulesIndex.php b/src/DDSERVICES/REST/generateGranulesIndex.php
new file mode 100644
index 0000000..b4d318d
--- /dev/null
+++ b/src/DDSERVICES/REST/generateGranulesIndex.php
@@ -0,0 +1,38 @@
+<?php
+/** 
+*   @file generateGranulesIndex.php
+*   @brief
+*   @version $Id:  $ 
+*/
+       
+       require_once 'DDService/DDserverWeb_ini.php';
+
+        if (!getenv('DDBASE')) 
+            define('DDBASE', '/data/DDBASE/DATA');
+        else
+            define('DDBASE', getenv('DDBASE'));
+
+        $ddSys = new DOMDocument('1.0');
+        $ddSys->load(DDBASE.'/DDsys.xml');
+        $dataSets = $ddSys->getElementsByTagName('VI');
+      
+        foreach ($dataSets as $VI) 
+        {
+            $id = $VI->getElementsByTagName('NAME')->item(0)->nodeValue;
+            $main = array();
+            $index = array();  
+            $location = $VI->getElementsByTagName("LOCATION")->item(0)->nodeValue;  
+                                          
+            foreach (glob($location."*.nc.gz") as $granule) 
+            {                  
+                $cmd = 'stat --printf="%s" '. $granule; 
+                $file = basename($granule,".nc.gz");         
+                $index[$file] = exec($cmd);
+            }
+
+            $main[substr($location,strlen(DDBASE))] = $index;
+            file_put_contents("GRANULES/$id.json", json_encode($main));
+
+        }
+ 
+?>
diff --git a/src/DDSERVICES/REST/getGranulesIndex.php b/src/DDSERVICES/REST/getGranulesIndex.php
new file mode 100644
index 0000000..8b0872a
--- /dev/null
+++ b/src/DDSERVICES/REST/getGranulesIndex.php
@@ -0,0 +1,43 @@
+<?php
+  
+/** 
+*   @file getGranulesIndex.php
+*   @brief Returns JSON with URLs of *_times.nc for all DataSets 
+*   @version $Id:  $ 
+*/
+  
+    require_once './DDserverWeb_ini.php';
+  
+    $alias = array(baseDir => webAlias);
+    $replace = array("_" => "-");
+    
+  //  $dataSet = strtr($_GET['id'], $replace); 
+    
+    $referXML = baseDir."DDsys.xml";
+    $DDsys = new DOMDocument("1.0");
+    $DDsys->load($referXML);
+
+    $VIs = $DDsys->getElementsByTagName("VI");
+    $main = array();
+    $index = array();
+    foreach ( $VIs as $VI )
+    {        
+        if ($VI->getElementsByTagName("NAME")->item(0)->getAttribute('base') == "LOCAL") 
+        {
+            $id =  $VI->getElementsByTagName("NAME")->item(0)->nodeValue;    
+            $location = $VI->getElementsByTagName("LOCATION")->item(0)->nodeValue;           
+            $times = $VI->getElementsByTagName("TIMES")->item(0)->nodeValue; 
+            if (!file_exists($location.$times)) continue;
+                            
+            $index[strtr($id,$replace)] = substr($location.$times,strlen(baseDir));
+        }
+    }
+
+    $main[webAlias] = $index;
+    $json = json_encode($main);    
+
+    file_put_contents("../GRANULES/allDatasets.json", $json);    
+    exit($json);
+?>
+
+
diff --git a/src/DDSERVICES/REST/getGranulesSize.php b/src/DDSERVICES/REST/getGranulesSize.php
new file mode 100644
index 0000000..2b81cc4
--- /dev/null
+++ b/src/DDSERVICES/REST/getGranulesSize.php
@@ -0,0 +1,41 @@
+<?php
+/** 
+*   @file getGranulesSize.php
+*   @brief
+*   @version $Id:  $ 
+*/
+
+       if (!$_GET['id']) exit('INPUT ERROR');
+       require_once './DDserverWeb_ini.php';
+
+       $alias = array(baseDir => webAlias);
+       $replace = array("-" => "_");
+
+      $dataSet = strtr($_GET['id'], $replace); 
+ 
+       if (file_exists("../GRANULES/$dataSet.json")) {
+           echo file_get_contents("../GRANULES/$dataSet.json");
+           exit();
+       }
+       $ddSys = new DOMDocument('1.0');
+       $ddSys->load(baseDir."DDsys.xml");
+       $xp = new DOMXpath($ddSys);
+
+       $VI = $xp->query("//NAME[.='".$dataSet."']"); 
+       if ( $VI->item(0)->nodeValue == NULL ) exit('NO SUCH DATASET');
+     
+       $main = array();
+       $index = array();  
+
+        $location = $VI->item(0)->parentNode->getElementsByTagName("LOCATION")->item(0)->nodeValue;                                            
+        foreach (glob($location."*.nc.gz") as $granule) {                  
+            $cmd = 'stat --printf="%s" '. $granule; 
+            $file = basename($granule,".nc.gz");            
+            $index[$file] = exec($cmd);
+        }
+        $main[substr($location,strlen(baseDir))] = $index;
+        
+        $json =  json_encode($main);        
+        file_put_contents("../GRANULES/$dataSet.json", $json);       
+        exit($json);
+?>
diff --git a/src/DDSERVICES/REST/get_cdf.php b/src/DDSERVICES/REST/get_cdf.php
new file mode 100755
index 0000000..b7b845f
--- /dev/null
+++ b/src/DDSERVICES/REST/get_cdf.php
@@ -0,0 +1,70 @@
+<?php
+
+/**
+* Look for a NetCDF file in the local base dir, then convert it using the NetCDF to CDF Python converter.
+*/
+
+$converterPath = './nc2cdf.py';
+$tmpDir = '/tmp/';
+$log_path = $tmpDir . 'get_cdf.log';
+
+if (!$_GET['id']) {
+	exit('INPUT ERROR');
+}
+
+require_once './DDserverWeb_ini.php';
+
+$name = preg_replace('/\..*/', '', $_GET['id']); // ie. ACE/SW/sw19980204
+$inputFilePath = baseDir . $name . '.nc.gz'; // ie. /data/DDBASE/DATA/ACE/SW/sw19980204.nc.gz
+$outputFilePath = $tmpDir . str_replace('/', '_', $name) . '.cdf'; // ie. /tmp/ACE_SW_sw19980204.cdf
+
+function send_file($mime_type, $send_file_path) {
+	header('Content-Description: File Transfer');
+	header('Content-Type: ' . $mime_type);
+	header('Content-Disposition: attachment; filename="' . basename($send_file_path) . '"');
+	header('Expires: 0');
+	header('Cache-Control: must-revalidate');
+	header('Pragma: public');
+	header('Content-Length: ' . filesize($send_file_path));
+	readfile($send_file_path);
+}
+
+function error($log_msg) {
+	global $inputFilePath, $log_path;
+	file_put_contents($log_path, date("Y-m-d H:i:s") . " with id='" . $_GET['id'] . "': $log_msg\n", FILE_APPEND);
+	// If the file can not be converted, return the NetCDF file.
+	send_file('application/x-gzip', basename($inputFilePath));
+	exit;
+}
+
+if (!file_exists($inputFilePath)) {
+	exit('NO SUCH FILE');
+}
+
+if (!is_dir(pathinfo($outputFilePath, PATHINFO_DIRNAME))) {
+	error("Can not create $outputFilePath because the folder does not exist.");
+}
+
+try {
+	$res = shell_exec("$converterPath $inputFilePath $outputFilePath");
+} catch (Exception $e) {
+	error("Error on shell_exec():\n$e");
+}
+
+
+// The converter is not supposed to output something if the file has been successfully converted
+if(trim($res) != '') {
+	error("The converter said:\n$res");
+}
+
+if(! file_exists($outputFilePath)) {
+	error("The output file $outputFilePath has not been created.");
+}
+
+send_file('application/x-cdf', $outputFilePath);
+
+sleep(600); // Wait 10 minutes before to delete the converted file.
+unlink($outputFilePath);
+
+exit;
+?>
diff --git a/src/DDSERVICES/REST/get_services.php b/src/DDSERVICES/REST/get_services.php
new file mode 100755
index 0000000..f29aed6
--- /dev/null
+++ b/src/DDSERVICES/REST/get_services.php
@@ -0,0 +1,47 @@
+<?php
+include(realpath(dirname(__FILE__) . "/../php/config.php"));
+include(BASE_PATH . "/php/classes/EpnTapMgr.php");
+
+$EpnTapMgr = new EpnTapMgr;
+$services = json_decode(file_get_contents(EpnTapDataPath . "/EpnTapServices.json"), TRUE);
+
+$services_content = Array();
+
+foreach($services as $s) {
+	//// -- To display columns names for each service --
+	// $query = "SELECT TOP 1 * FROM " . $s["schema"] . ".epn_core";
+	// $rows = $EpnTapMgr->request($s["accessurl"], $query);
+	// echo $s["schema"] . "\n\"columns\": \"" . join(',', array_keys($rows[0])) . "\"\n\n";
+
+	$query = "SELECT dataproduct_type as dp_type,
+		target_class as t_class,
+		target_name as t_name,
+		COUNT(granule_uid) as nb_res,
+		MIN(time_min) as time_min,
+		MAX(time_max) as time_max
+		FROM " . $s["schema"] . ".epn_core GROUP BY dp_type, t_class, t_name";
+
+	$rows = $EpnTapMgr->request($s["accessurl"], $query);
+	if($rows == NULL)
+		continue;
+
+	foreach ($rows as $r) {
+		$r['dp_type'] = $r['dp_type'];
+		$r['t_class'] = $r['t_class'];
+		$r['t_name'] = $r['t_name'];
+
+		if(!isset($services_content[$r['dp_type']]))
+			$services_content[$r['dp_type']] = Array();
+
+		if(!isset($services_content[$r['dp_type']][$r['t_class']]))
+			$services_content[$r['dp_type']][$r['t_class']] = Array();
+
+		if(!isset($services_content[$r['dp_type']][$r['t_class']][$r['t_name']]))
+			$services_content[$r['dp_type']][$r['t_class']][$r['t_name']] = Array();
+
+		$services_content[$r['dp_type']][$r['t_class']][$r['t_name']][$s["schema"]] = [$r['nb_res'], $r['time_min'], $r['time_max']];
+	}
+}
+
+fwrite(fopen(EpnTapDataPath . "metadata.json", "w+"), json_encode($services_content));
+?>
diff --git a/src/DDSERVICES/REST/nc2cdf.py b/src/DDSERVICES/REST/nc2cdf.py
new file mode 100755
index 0000000..a92c5b7
--- /dev/null
+++ b/src/DDSERVICES/REST/nc2cdf.py
@@ -0,0 +1,210 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*
+
+# Resources:
+# - http://pythonhosted.org/SpacePy/pycdf.html
+# - http://unidata.github.io/netcdf4-python/
+
+import os
+import os.path as op
+from datetime import datetime
+
+os.environ['SPACEPY'] = '/tmp'
+
+import netCDF4
+from spacepy import pycdf
+
+AMDA_DICT_PATH = './amda.json'
+TEMP_FILE = '/tmp'
+
+
+def error(error_message, e=None):
+    """ Display an `error_message` and exit the program. """
+
+    import sys
+
+    with open(op.join(TEMP_FILE, 'converter.log'), 'a') as f_log:
+        f_log.write('With arguments ' + ', '.join(sys.argv))
+        f_log.write(error_message)
+
+    sys.stderr.write(error_message + ((':\n  %s\n' % e) if e else '\n'))
+    sys.exit(1)
+
+
+class NetCdf:
+    SPASE_DATE_FORMAT = '%Y%j%H%M%S'  # ex: 2016238000000
+
+    def __init__(self, input_path):
+        """Constructor. Load a NetCDF file from `self.netcdf_path`, return a NetCDF4 object."""
+
+        self.cdf_path = None
+        self.cdf = None
+        self.temp_nc = None
+
+        extension = input_path.split('/')[-1].split('.', 1)[1]
+        if extension == 'nc.gz':
+            self.unzip(input_path)
+        elif extension == 'nc':
+            self.netcdf_path = input_path
+        else:
+            error('Unknown file extension "%s".' % extension)
+
+        try:
+            self.netcdf = netCDF4.Dataset(self.netcdf_path)
+        except Exception as e:
+            error('Can not open netCDF file %s' % self.netcdf_path, e)
+
+        if self.temp_nc:
+            os.remove(self.temp_nc)
+
+    def unzip(self, ncgz_input_path):
+        import gzip
+        from shutil import copyfileobj
+
+        netcdf_temp_path = self.build_temp_path(ncgz_input_path, '.nc')
+
+        if not op.exists(ncgz_input_path):
+            error('Compressed Net-CDF file is not found in "%s".' % ncgz_input_path)
+
+        try:
+            with gzip.open(ncgz_input_path, 'rb') as f_in, open(netcdf_temp_path, 'wb') as f_out:
+                copyfileobj(f_in, f_out)
+        except Exception as e:
+            error('Can not unzip compressed Net-CDF from %s to %s' % (ncgz_input_path, netcdf_temp_path), e)
+
+        self.temp_nc = netcdf_temp_path
+        self.netcdf_path = netcdf_temp_path
+
+    def parse_date(self, str_date):
+        """ Parse the string `str_date` and return the date."""
+
+        return datetime.strptime(str_date[:4] + str(int(str_date[4:7]) + 1) + str_date[7:13], self.SPASE_DATE_FORMAT)
+
+    # NetCDF methods
+
+    def get_netcdf_path(self):
+        """Return the NetCDF path."""
+
+        return self.netcdf_path
+
+    def get_netcdf(self):
+        """Return the NetCDF object."""
+
+        return self.netcdf
+
+    def describe(self):
+        """Display all NetCDF variables of the NetCF file"""
+
+        def describe_var(var):
+            """Describe an net-cdf variable."""
+
+            print('== %s ==' % var.name)
+            print('  - numpy type: %s ^ %s ' % (str(var.dtype), str(var.ndim)))
+            print('  - dimension(s): %s' % ', '.join(list(var.dimensions)))
+            print('  - size: %s = %d' % ('x'.join([str(n) for n in var.shape]), var.size))
+            if var.ndim == 1 and str(var.dtype) == '|S1':
+                print('  - values: \'%s\', ...' % ''.join([c.decode('utf-8') for c in var[:]]))
+
+            if var.ncattrs():
+                print('  - Attributes:')
+                for var_attr_name in var.ncattrs():
+                    print('      - %s: %s' % (var_attr_name, getattr(var, var_attr_name)))
+
+        for (key, value) in self.netcdf.variables.items():
+            describe_var(value)
+
+        print('== Global attributes ==')
+        for global_attr_name in self.netcdf.ncattrs():
+            print('  - %s: %s' % (global_attr_name, getattr(self.netcdf, global_attr_name)))
+
+    # CDF methods
+
+    @staticmethod
+    def create_new_cdf(cdf_path):
+        """
+        Create a new empty CDF file in `self.cdf_path`, return a pyCDF object.
+        """
+
+        # Create and clean a new directory for the CDF file.
+        cdf_dir = op.dirname(cdf_path)
+        if not op.exists(cdf_dir):
+            try:
+                os.makedirs(cdf_dir)
+            except IOError as e:
+                error('Can not create directory %s' % cdf_dir, e)
+        if op.exists(cdf_path):
+            try:
+                os.remove(cdf_path)
+            except IOError as e:
+                error('A CDF file already exist in %s and it can not be removed' % cdf_path, e)
+
+        # Make the pyCDF object
+        try:
+            return pycdf.CDF(cdf_path, '')
+        except pycdf.CDFError as e:
+            error('Can not create CDF file on %s, check that the directory exists and its writing access' % cdf_path, e)
+
+    @staticmethod
+    def build_temp_path(path, extension):
+        return op.abspath(op.join(TEMP_FILE, op.basename(path).split('.')[0] + extension))
+
+    def get_cdf(self, cdf_path=None):
+        """
+        Convert and return the CDF object (only return it if it's already converted)
+        - `cdf_path`: The path of the CDF file (needed for CDF creation), or a temp path if not specified.
+        """
+
+        if self.cdf:
+            return self.cdf
+
+        self.cdf_path = op.abspath(cdf_path) if cdf_path else self.build_temp_path(self.netcdf_path, '.cdf')
+        self.cdf = self.create_new_cdf(self.cdf_path)
+
+        for global_attr_name in self.netcdf.ncattrs():
+            self.cdf.attrs[global_attr_name] = getattr(self.netcdf, global_attr_name)
+
+        for key, var in self.netcdf.variables.items():
+            dimensions = list(var.dimensions)
+
+            if str(var.dtype) == '|S1':
+                if len(dimensions) == 1:
+                    var_str = str(netCDF4.chartostring(var[:]).astype(str, copy=False))
+                    self.cdf.attrs[key] = self.parse_date(var_str) if dimensions[0] == 'TimeLength' else var_str
+                elif len(dimensions) == 2:
+                    var_strs = map(str, netCDF4.chartostring(var[:]).astype(str, copy=False))
+                    self.cdf[key] = list(map(self.parse_date, var_strs) if dimensions[1] == 'TimeLength' else var_strs)
+            else:
+                self.cdf[key] = var[:]
+                for var_attr_name in var.ncattrs():
+                    self.cdf[key].attrs[var_attr_name] = getattr(var, var_attr_name)
+
+        return self.cdf
+
+    def get_cdf_path(self):
+        return self.cdf_path
+
+
+if __name__ == '__main__':
+    import sys
+
+    if len(sys.argv) not in (2, 3):
+        print('usage:')
+        print('- `%s path/to/file.nc.gz` # Convert a Net-CDF file, '
+              'save it in a temp directory, then display its path.' % sys.argv[0])
+        print('- `%s -i path/to/file.nc.gz` # Display information about a Net-CDF file.' % sys.argv[0])
+        print('- `%s path/to/file.nc.gz path/to/file.cdf` # Convert a Net-CDF file.'
+              'and save it in the specified path.' % sys.argv[0])
+        print('This script can also be used as a Python library.')
+        exit(1)
+
+    if len(sys.argv) == 2:
+        netcdf = NetCdf(sys.argv[1])
+        netcdf.get_cdf()
+        print('File stored in "%s".' % netcdf.get_cdf_path())
+    elif len(sys.argv) == 3:
+        if sys.argv[1] == '-i':
+            netcdf = NetCdf(sys.argv[2])
+            netcdf.describe()
+        else:
+            netcdf = NetCdf(sys.argv[1])
+            netcdf.get_cdf(sys.argv[2])
diff --git a/src/DDSERVICES/REST/utils/generateGranulesIndex.php b/src/DDSERVICES/REST/utils/generateGranulesIndex.php
new file mode 100644
index 0000000..52e2e0e
--- /dev/null
+++ b/src/DDSERVICES/REST/utils/generateGranulesIndex.php
@@ -0,0 +1,42 @@
+<?php
+/** 
+*   @file generateGranulesIndex.php
+*   @brief
+*   @version $Id:  $ 
+*/
+       
+       define('BASE','/data/DDBASE/');
+
+       require_once BASE.'DDService/DDserverWeb_ini.php';
+
+        if (!getenv('DDBASE')) 
+            define('DDBASE', BASE.'DATA');
+        else
+            define('DDBASE', getenv('DDBASE'));
+
+        $ddSys = new DOMDocument('1.0');
+        $ddSys->load(DDBASE.'/DDsys.xml');
+        $dataSets = $ddSys->getElementsByTagName('VI');
+      
+        foreach ($dataSets as $VI) 
+        {
+            $vi_ = $VI->getElementsByTagName("NAME")->item(0);
+            // only local bases
+            if ($vi_->getAttribute("base") != "LOCAL") continue;
+            $id = $vi_->nodeValue;
+
+            $main = array();
+            $index = array();  
+            $location = $VI->getElementsByTagName("LOCATION")->item(0)->nodeValue;  
+                                          
+            foreach (glob($location."*.nc.gz") as $granule) 
+            {                  
+                $cmd = 'stat --printf="%s" '. $granule; 
+                $file = basename($granule,".nc.gz");         
+                $index[$file] = exec($cmd);
+            }
+
+            $main[substr($location,strlen(DDBASE))] = $index;
+            file_put_contents(BASE."GRANULES/$id.json", json_encode($main));
+        } 
+?>
diff --git a/src/DDSERVICES/SOAP/DDserverWeb.php b/src/DDSERVICES/SOAP/DDserverWeb.php
new file mode 100644
index 0000000..20c4caf
--- /dev/null
+++ b/src/DDSERVICES/SOAP/DDserverWeb.php
@@ -0,0 +1,453 @@
+<?php
+
+/** 
+*   @file DDserverWeb.php
+*   @brief PHP SoapServer for DD WebServices
+*
+*   @date 27.05.2008
+*   @version  $Id: DDserverWeb.php,v 1.11 2013/04/18 06:54:39 benjamin Exp $
+*/
+
+ 
+ class DDService 
+ 
+ { 
+     private $alias = array(baseDir => webAlias); 
+     private $extAlias = array(extBaseDir => extWebAlias);
+
+/**     
+*  Checks if Remote Data Set has been already added
+*/
+
+    function isRemoteViAdded($baseId, $viId) 
+    {                 
+        $referXML = baseDir."DDsys.xml";
+        $DDsys = new DOMDocument("1.0");
+       
+        $DDsys->load($referXML);       
+        $xp = new domxpath($DDsys);
+        $VI = $xp->query("//NAME[.='".$viId."']");
+        
+        if ($VI->item(0)->nodeValue != NULL)
+        {
+            $base = $VI->item(0)->getAttribute("base");
+            if ($base != $baseId) return false;
+
+            return true;
+        }
+        return false;
+    }
+
+/**     
+*  Returns contents of 'Version' file from VI Location dir
+*/
+
+        function getVersion($dataSet) 
+         {                 
+            $referXML = baseDir."DDsys.xml";
+            $DDsys = new DOMDocument("1.0");
+            $DDsys->load($referXML);
+            $xp = new domxpath($DDsys);
+            $VI = $xp->query("//NAME[.='".$dataSet."']");  
+            if ($VI->item(0)->nodeValue != NULL)
+            {
+                $location = $VI->item(0)->parentNode->getElementsByTagName("LOCATION")->item(0)->nodeValue;
+            }  
+            if (file_exists($location."Version"))  return  file_get_contents($location."Version");
+            return null;     
+          }
+
+/**     
+*  Returns restricted TimeRestriction and GlobalStop in case of time restriction
+*/
+
+        function getTimeRestriction($dataSet) 
+         {                 
+            $referXML = baseDir."DDsys.xml";
+            $DDsys = new DOMDocument("1.0");
+            $DDsys->load($referXML);
+            $xp = new domxpath($DDsys);
+            $VI = $xp->query("//NAME[.='".$dataSet."']"); 
+ 
+            if ($VI->item(0)->nodeValue != NULL)
+            {
+                $location = $VI->item(0)->parentNode->getElementsByTagName("LOCATION")->item(0)->nodeValue;
+            }  else {
+                return  array("success" => FALSE,
+                               "days" => "NOSUCHVI",
+                               "globalstop" => NULL
+                            );    
+            }
+            if (file_exists($location."TimeRestriction"))  {
+                  $restr = file($location."TimeRestriction", FILE_IGNORE_NEW_LINES);                
+                  $infoXmlRestr = $location.$restr[1].".xml";
+                  if (file_exists($infoXmlRestr)) {
+
+                                if (!$DDsys->load($infoXmlRestr)) {
+                                        $currDir = getcwd();
+                                        chdir($location);
+                                        $DDsys->loadXML(file_get_contents($restr[1].".xml"));  // NFS connection doesn't load                               
+                                        chdir($currDir);                                      
+                                }
+
+                                $globalStop = $DDsys->getElementsByTagName("GlobalStop")->item(0)->nodeValue;                                                   
+                    }
+                  else {
+                        $globalStop = NULL;
+                    }
+                  return  array("success" => TRUE,
+                                "days" =>  $restr[0],
+                                "globalstop" => $globalStop
+                            );
+
+            }
+            return  array("success" => FALSE,
+                        "days" => "NORESTRICTIONFILE",
+                        "globalstop" => NULL
+                    );     
+          }
+
+
+/**     Just returns URL addres of AMDA_Users.xml - 
+*                            droits d'access
+*/
+
+        function getUserGroups() 
+         {                 
+              if (file_exists(extBaseDir."AMDA_Users.xml"))  return extWebAlias."AMDA_Users.xml";
+              else return NOUSERGROUPSSPECIFIED;     
+          }
+
+/*
+*       Return info about a user
+*/
+
+	function getUserInfo($login,$hash)
+	{
+	  if (md5(PRIVATEKEY.$login.__FUNCTION__) != $hash)
+	    return array("success"     => FALSE,
+			 "login"       => $login,
+			 "name"        => "undefined",
+			 "first_name"  => "undefined",
+			 "group"       => "undefined",
+			 "email"       => "undefined",
+			 "date"        => "undefined",
+			 "news"        => "0");
+
+	  $UsrDom = new DomDocument("1.0");
+	  $UsrDom->load(extWebAlias."AMDA_Users_Info.xml");
+	  $xp = new domxpath($UsrDom);                                                                             
+	  $theUser = $xp->query("//user[@login='".$login."']");
+	  
+	  return array("success"     => TRUE,
+		       "login"       => $login,
+		       "name"        => ($theUser->length > 0) ? $theUser->item(0)->getAttribute("name") : "undefined",
+		       "first_name"  => ($theUser->length > 0) ? $theUser->item(0)->getAttribute("first_name") : "undefined",
+		       "group"       => $this->getUserMemberGroups($login),
+		       "email"       => ($theUser->length > 0) ? $theUser->item(0)->getAttribute("email") : "undefined",
+		       "date"        => ($theUser->length > 0) ? $theUser->item(0)->getAttribute("date")  : "undefined",
+		       "news"        => ($theUser->length > 0) ? $theUser->item(0)->getAttribute("news")  : "0");
+	}
+
+/*
+*       Return a list of group for which a user is a member
+*/
+
+	function getUserMemberGroups($user)
+	{
+          //get user
+          $user_dom = new DomDocument("1.0");
+          if (!file_exists(extBaseDir."AMDA_Users.xml"))
+            return  array();
+          $user_dom->load(extBaseDir."AMDA_Users.xml");
+
+          $user_nodes = $user_dom->getElementsByTagName('user');
+
+          foreach ($user_nodes as $user_node)
+          {
+            if ($user_node->nodeValue == $user)
+              return $user_node->getAttribute('group');
+          }
+
+          return "";
+	}
+
+/**     Return the list of available local missions for 
+*                            a given user
+*/
+
+	function getUserAvailableLocalMissions($user)
+	{
+	  //get user groups
+          $user_groups = explode(",",preg_replace('/\s+/', '',$this->getUserMemberGroups($user)));
+
+	  //get local missions
+	  $mis_dom = new DomDocument("1.0");
+	  if (!file_exists(extBaseDir."Missions.xml"))
+	    return array();
+	  $mis_dom->load(extBaseDir."Missions.xml");
+	  
+	  $local_nodes = $mis_dom->getElementsByTagName('Local');
+	  if ($local_nodes->length < 1)
+	    return array();
+
+	  $mis_nodes = $local_nodes->item(0)->getElementsByTagName("MissionID");
+
+	  $user_missions = array();
+
+	  foreach ($mis_nodes as $mis_node)
+	    {
+	      if (!$mis_node->hasAttribute('group') || ($mis_node->getAttribute('group') == ''))
+		{
+		  //public mission
+		  array_push($user_missions,$mis_node->nodeValue);
+		}
+	      else
+		{
+		  // private mission
+		  $mis_group = $mis_node->getAttribute('group');
+                  if (array_search($mis_group,$user_groups) === FALSE)
+                    continue;
+		  array_push($user_missions,$mis_node->nodeValue);
+		}
+	    }
+
+	  return $user_missions;
+	}
+
+/**     Return the list of available external missions for 
+*                            a given user
+*/
+
+        function getUserAvailableExternalMissions($user)
+        {
+          //get user groups
+          $user_groups = explode(",",$this->getUserMemberGroups($user));
+
+          //get external missions
+          $mis_dom = new DomDocument("1.0");
+          if (!file_exists(extBaseDir.extBaseXml))
+	    return array();
+          $mis_dom->load(extBaseDir.extBaseXml);
+
+          $external_nodes = $mis_dom->getElementsByTagName('External');
+          if ($external_nodes->length < 1)
+            return array();
+
+          $mis_nodes = $external_nodes->item(0)->getElementsByTagName("CenterID");
+
+          $user_missions = array();
+
+	  foreach ($mis_nodes as $mis_node)
+            {
+              if (!$mis_node->hasAttribute('group') || ($mis_node->getAttribute('group') == ''))
+                {
+                  //public mission
+                  array_push($user_missions,$mis_node->nodeValue);
+                }
+              else
+                {
+                  // private mission
+                  $mis_group = $mis_node->getAttribute('group');
+                  if (array_search($mis_group,$user_groups) === FALSE)
+                    continue;
+                  array_push($user_missions,$mis_node->nodeValue);
+                }
+            }
+
+          return $user_missions;
+        }
+
+/**     Just returns URL addres of Missions.xml  - 
+*                            description of AMDA local data
+*/
+
+        function getAvailableMissions() 
+         {                 
+              if (file_exists(extBaseDir."Missions.xml"))  return extWebAlias."Missions.xml";
+              else return NOLOCALDATA;     
+          }
+
+/**     Just returns URL addres of Bases.xml - 
+*               description of available external bases 
+*/
+
+        function getAvailableExternalBases() 
+         {                 
+              if (file_exists(extBaseDir.extBaseXml))  return extWebAlias.extBaseXml;
+              else return NOEXTERNALBASES;     
+          }
+
+/**      Just returns URL addres of base.xml - 
+*                  description of available data for particular External Base
+*                  produced by DataCenterMgr
+*/
+ 
+        function getAvailableExternalData($baseID) 
+         {                 
+              if (file_exists(extBaseDir.$baseID."/base.xml"))  
+                          return extWebAlias.$baseID."/base.xml";
+              else return NOEXTERNALDATA;     
+          }
+
+/**    Returns URL addres of dataSet.xml - 
+*                  description of  particular external DataSet
+*                  if there is no such a description 
+*                  contacts External Base and gets it
+*/ 
+
+    function getDataSetDescription($baseID, $remDataSetID) 
+    {                 
+        if (file_exists(extBaseDir.$baseID."/".$remDataSetID.".xml"))  
+                    return extWebAlias.$baseID."/".$remDataSetID.".xml";
+        else 
+        {
+           
+
+        }
+    }
+
+
+/**     
+*       Returns String Start-Stop for local DataSet  in DD Base 
+*/ 
+
+        function getStartStop($dataSet) 
+          {                  
+            if ($dataSet != "compound") {  
+                      $referFile = baseDir."refer.nc";          
+                      $cmd = DDBASEBIN."/StartStop ".$referFile." ".$dataSet;  
+                      $res = system($cmd);
+                        
+                      return $res;
+              }
+          }
+
+/**     
+*       Returns String INFO for local DataSet  in DD Base 
+*/ 
+
+    function getInfo($dataSet, $infoID) 
+    {                          
+        $referFile = baseDir."refer.nc";          
+        $cmd = DDBASEBIN."/GetInfo ".$referFile." ".$dataSet." ".$infoID;  
+        $res = system($cmd);
+        
+        return $res;        
+    }
+
+/**     
+*       Returns Desc attribute for Remote DataSet   in DD Base 
+*/ 
+
+    function getRemoteStartStop($baseID, $dataSet) 
+    {                              
+        $domName = extBaseDir.$baseID."/base.xml";   
+        if (!file_exists($domName))
+                return NOEXTERNALDATA;
+
+        $dom = new DomDocument("1.0");
+        $dom->load($domName);
+        $vi = $dom->getElementById($dataSet);
+        if (!$vi)
+                return NODATASET;
+
+        $res = $vi->getAttribute('desc'); 
+        return $res;              
+    }
+
+/**     
+*       Check Remote Connection
+*/ 
+
+	  function checkRemoteConnection($extBaseID){
+
+		switch ($extBaseID) {
+		    case "THEMIS" :  return is_dir(THEMIS_DIR);	
+			    
+		    case "MAPSKP" :  if (fsockopen(MAPSKP_HTTP_SERVER, 80, $errno, $errstr, 30)) return true;
+				     else return false;
+
+		    case "CDAWEB" : if (ftp_connect(CDAWEB_FTP_SERVER)) return true;
+				    else return false;
+
+		    case "VEXGRAZ" : if (fsockopen(VEXGRAZ_HTTP_SERVER, 80, $errno, $errstr, 30)) return true;
+				     else return false;
+
+                    case "LATMOS" : if (fsockopen(LATMOS_HTTP_SERVER, 80, $errno, $errstr, 30)) return true;
+                                     else return false;
+
+                    case "LESIA" : if (fsockopen(LESIA_HTTP_SERVER, 80, $errno, $errstr, 30)) return true;
+                                     else return false;
+
+                    case "SINP" : if (fsockopen(SINP_HTTP_SERVER, 80, $errno, $errstr, 30)) return true;
+                                     else return false;
+
+                    case "FMI_HYBRID" : if (fsockopen(FMI_HYBRID_HTTP_SERVER, 80, $errno, $errstr, 30)) return true;
+                                     else return false;
+
+                    case "FMI_GUMICS" : if (fsockopen(FMI_GUMICS_HTTP_SERVER, 80, $errno, $errstr, 30)) return true;
+                                     else return false;
+
+                    case "CCMC" : if (fsockopen(CCMC_HTTP_SERVER, 80, $errno, $errstr, 30)) return true;
+                                     else return false;
+
+		    case "CLWeb" : if (fsockopen(CLWeb_HTTP_SERVER, 80, $errno, $errstr, 30)) return true;
+                                     else return false;
+
+		    default:   return false;             
+	        }		
+	    }
+/**     
+*       Returns Array of Data Urls for a given DataSet 
+*                     in StartTime - StopTime interval 
+*/ 
+
+    function getDataUrl($dataSet, $StartTime, $StopTime) 
+    {  
+            $tempFile = uniqid("temp");
+            if (file_exists($tempFile)) unlink($tempFile);
+                            
+            $referXML = baseDir."DDsys.xml";
+            $DDsys = new DOMDocument("1.0");
+            $DDsys->load($referXML);
+            $xp = new domxpath($DDsys);
+            $VI = $xp->query("//NAME[.='".$dataSet."']");  
+            if ($VI->item(0)->nodeValue != NULL)
+            {
+                $location = $VI->item(0)->parentNode->getElementsByTagName("LOCATION")->item(0)->nodeValue;
+                $times = $VI->item(0)->parentNode->getElementsByTagName("TIMES")->item(0)->nodeValue;
+                $timesFile = $location.$times;
+                $cmd = DDBASEBIN."/GetFileNames ".$timesFile." ".strtotime($StartTime)." ".strtotime($StopTime)." > $tempFile"; 
+                system($cmd);
+                if (!file_exists($tempFile)) return 'ERROR';
+
+                $res = file($tempFile);                      
+                if ($res[0] == OUTOFTIME) {
+                unlink($tempFile);
+                return $res;
+                }
+
+                $urls = explode(";",$res[0]);
+                $url_location = strtr($location, $this->alias); 
+                if (count($urls) > 0) {
+                unset($urls[count($urls)-1]);
+                for ($i = 0; $i < count($urls); $i++) $urls[$i] = $url_location.$urls[$i].".gz";
+                }
+                unlink($tempFile);
+
+                return $urls; 
+            }
+        return NODATASET;               
+    }
+ } 
+
+
+  require_once 'DDserverWeb_ini.php';
+
+  ini_set("soap.wsdl_cache_enabled", "0");
+ // use_soap_error_handler(false);
+  $server = new SoapServer("./dd.wsdl");
+  $server->setClass("DDService");
+  $server->handle();
+?>
diff --git a/src/DDSERVICES/SOAP/DDserverWeb_ini.php b/src/DDSERVICES/SOAP/DDserverWeb_ini.php
new file mode 100644
index 0000000..cb97e6c
--- /dev/null
+++ b/src/DDSERVICES/SOAP/DDserverWeb_ini.php
@@ -0,0 +1,40 @@
+<?php
+/**
+*  @file DDserverWeb_ini.php
+*  @version $Id: DDserverWeb_ini.php,v 1.4 2013/04/09 09:07:39 benjamin Exp $
+*  @brief All necessary SETUP for DD WebServices
+*
+*/
+
+/* MAIN DEFINITIONS SHOULD BE MODIFIED!!!!!! */
+
+  define("rootDir", "/home/budnik/DDBASE");
+  define("rootAlias", "http://apus.irap.omp.eu/NEWAMDA/DDService");
+ // define("DDLIBHOME","/home/budnik/AMDANEW/DDLIB");
+  define("DDLIB", "/opt/local/lib/");
+   
+  putenv("LD_LIBRARY_PATH=/usr/lib:/usr/local/lib:".DDLIB);
+ 
+/* Compound Definitions: Nothing to modify */
+
+   define("baseDir", rootDir."/DATA/");
+//   define("extBaseDir",rootDir."/INFO/");
+//   define("extBaseXml", "Bases.xml");
+     
+  define("webAlias", rootAlias."/DATA/");
+  define("extWebAlias", rootAlias."/INFO/");
+  define("DDBASEBIN", "/opt/local/bin");
+
+// Errors 
+  define("UNKNOWNBASEID","UNKNOWNBASEID");
+  define("OUTOFTIME","OUTOFTIME");
+  define("NODATASET","NODATASET");
+  define("NOEXTERNALBASES","NOEXTERNALBASES");
+  define("NOEXTERNALDATA","NOEXTERNALDATA");
+  define("NOLOCALDATA","NOLOCALDATA");
+  define("NOUSERGROUPSSPECIFIED","NOUSERGROUPSSPECIFIED");
+
+// A private key use to check if a request comes from a trust client
+  define("PRIVATEKEY","!%p856Dc");
+
+?>
diff --git a/src/DDSERVICES/SOAP/dd.wsdl b/src/DDSERVICES/SOAP/dd.wsdl
new file mode 100644
index 0000000..116890f
--- /dev/null
+++ b/src/DDSERVICES/SOAP/dd.wsdl
@@ -0,0 +1,372 @@
+<?xml version ='1.0' encoding ='UTF-8' ?>
+<definitions name='amda'
+  targetNamespace='http://amda.cdpp.irap.omp.eu'
+  xmlns:tns='http://amda.cdpp.irap.omp.eu'
+  xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/'
+  xmlns:xsd='http://www.w3.org/2001/XMLSchema'
+  xmlns:soapenc='http://schemas.xmlsoap.org/soap/encoding/'
+  xmlns:wsdl='http://schemas.xmlsoap.org/wsdl/'
+  xmlns='http://schemas.xmlsoap.org/wsdl/'>
+
+<types> 
+  <tns:complexType name="UserInfoData">
+    <tns:sequence>
+      <tns:element minOccurs="1" maxOccurs="1" name="success" type="xsd:boolean"/>
+      <tns:element minOccurs="1" maxOccurs="1" name="login" type="xsd:string"/>
+      <tns:element minOccurs="1" maxOccurs="1" name="name" type="xsd:string"/>
+      <tns:element minOccurs="1" maxOccurs="1" name="first_name" type="xsd:string"/>
+      <tns:element minOccurs="1" maxOccurs="1" name="group" type="xsd:string"/>
+      <tns:element minOccurs="1" maxOccurs="1" name="email" type="xsd:string"/>
+      <tns:element minOccurs="1" maxOccurs="1" name="date" type="xsd:string"/>
+      <tns:element minOccurs="1" maxOccurs="1" name="news" type="xsd:string"/>
+    </tns:sequence>
+  </tns:complexType>
+  <tns:complexType name="TimeRestrictionData">
+    <tns:sequence>
+      <tns:element minOccurs="1" maxOccurs="1" name="success" type="xsd:boolean"/>
+      <tns:element minOccurs="1" maxOccurs="1" name="days" type="xsd:string"/>
+      <tns:element minOccurs="1" maxOccurs="1" name="globalstop" type="xsd:string"/> 
+    </tns:sequence>
+  </tns:complexType>
+  <tns:complexType name="ArrayOfStrings">
+    <complexContent>
+      <restriction base="soap11-enc:Array">
+        <attribute ref="soap11-enc:arrayType" wsdl:arrayType="string[]"/>
+      </restriction>
+    </complexContent>
+  </tns:complexType> 
+</types>
+
+<message name='isRemoteViAddedRequest'>
+  <part name='baseId' type='xsd:string'/>
+  <part name='viId' type='xsd:string'/>
+</message>
+<message name='isRemoteViAddedResponse'>
+ <part name='Result' type='xsd:boolean'/>
+</message>
+<message name='getVersionRequest'>
+  <part name='dataSet' type='xsd:string'/>
+</message>
+<message name='getVersionResponse'>
+ <part name='Result' type='xsd:string'/>
+</message>
+<message name='checkRemoteConnectionRequest'>
+  <part name='dataSet' type='xsd:string'/>
+</message>
+<message name='checkRemoteConnectionResponse'>
+ <part name='Result' type='xsd:boolean'/>
+</message>
+<message name='getStartStopRequest'>
+  <part name='dataSet' type='xsd:string'/>
+</message>
+<message name='getStartStopResponse'>
+ <part name='Result' type='xsd:string'/>
+</message>
+<message name='getInfoRequest'>
+  <part name='dataSet' type='xsd:string'/>
+  <part name='infoName' type='xsd:string'/>
+</message>
+<message name='getInfoResponse'>
+ <part name='Result' type='xsd:string'/>
+</message>
+<message name='getRemoteStartStopRequest'>
+  <part name='baseID' type='xsd:string'/>
+  <part name='dataSet' type='xsd:string'/>
+</message>
+<message name='getRemoteStartStopResponse'>
+ <part name='Result' type='xsd:string'/>
+</message>
+<message name='getDataUrlRequest'>
+  <part name='dataSet' type='xsd:string'/>
+  <part name="startDate" type="xsd:dateTime"/>
+  <part name="stopDate" type="xsd:dateTime"/> 
+</message>
+<message name='getDataUrlResponse'>
+ <part name='Result' type='tns:ArrayOfStrings'/>
+</message>
+<message name='getAvailableExternalBasesRequest'>
+</message>
+<message name='getAvailableExternalBasesResponse'>
+ <part name='Result' type='xsd:string'/>
+</message>
+<message name='getUserGroupsRequest'>
+</message>
+<message name='getUserGroupsResponse'>
+ <part name='Result' type='xsd:string'/>
+</message>
+<message name='getUserAvailableLocalMissionsRequest'>
+  <part name='user' type='xsd:string'/>
+</message>
+<message name='getUserAvailableLocalMissionsResponse'>
+ <part name='Result' type='tns:ArrayOfStrings'/>
+</message>
+<message name='getUserAvailableExternalMissionsRequest'>
+  <part name='user' type='xsd:string'/>
+</message>
+<message name='getUserAvailableExternalMissionsResponse'>
+  <part name='Result' type='tns:ArrayOfStrings'/>
+</message>
+<message name='getAvailableMissionsRequest'>
+</message>
+<message name='getAvailableMissionsResponse'>
+ <part name='Result' type='xsd:string'/>
+</message>
+<message name='getAvailableExternalDataRequest'>
+  <part name='daseID' type='xsd:string'/>
+</message>
+<message name='getAvailableExternalDataResponse'>
+ <part name='Result' type='xsd:string'/>
+</message>
+<message name='getUserInfoRequest'>
+  <part name='login' type='xsd:string'/>
+  <part name='hash' type='xsd:string'/>
+</message>
+<message name='getUserInfoResponse'>
+ <part name='Result' type='tns:UserInfoData'/>
+</message>
+<message name='getTimeRestrictionRequest'>
+  <part name='dataSet' type='xsd:string'/>  
+</message>
+<message name='getTimeRestrictionResponse'>
+ <part name='Result' type='tns:TimeRestrictionData'/>
+</message>
+
+<portType name='AmdaPortType'>
+    <operation name='isRemoteViAdded'>
+    <input message='tns:isRemoteViAddedRequest'/>
+    <output message='tns:isRemoteViAddedResponse'/>
+  </operation>  
+   <operation name='getVersion'>
+    <input message='tns:getVersionRequest'/>
+    <output message='tns:getVersionResponse'/>
+  </operation>    
+  <operation name='checkRemoteConnection'>
+    <input message='tns:checkRemoteConnectionRequest'/>
+    <output message='tns:checkRemoteConnectionResponse'/>
+  </operation>
+   <operation name='getStartStop'>
+    <input message='tns:getStartStopRequest'/>
+    <output message='tns:getStartStopResponse'/>
+  </operation>   
+  <operation name='getInfo'>
+    <input message='tns:getInfoRequest'/>
+    <output message='tns:getInfoResponse'/>
+  </operation>
+  <operation name='getRemoteStartStop'>
+    <input message='tns:getRemoteStartStopRequest'/>
+    <output message='tns:getRemoteStartStopResponse'/>
+  </operation>
+  <operation name='getDataUrl'>
+    <input message='tns:getDataUrlRequest'/>
+    <output message='tns:getDataUrlResponse'/>
+  </operation>
+  <operation name='getAvailableExternalBases'>
+    <input message='tns:getAvailableExternalBasesRequest'/>
+    <output message='tns:getAvailableExternalBasesResponse'/>
+  </operation>
+   <operation name='getUserGroups'>
+    <input message='tns:getUserGroupsRequest'/>
+    <output message='tns:getUserGroupsResponse'/>
+  </operation>
+  <operation name='getUserAvailableLocalMissions'>
+    <input message='tns:getUserAvailableLocalMissionsRequest'/>
+    <output message='tns:getUserAvailableLocalMissionsResponse'/>
+  </operation>
+  <operation name='getUserAvailableExternalMissions'>
+    <input message='tns:getUserAvailableExternalMissionsRequest'/>
+    <output message='tns:getUserAvailableExternalMissionsResponse'/>
+  </operation>
+  <operation name='getAvailableMissions'>
+    <input message='tns:getAvailableMissionsRequest'/>
+    <output message='tns:getAvailableMissionsResponse'/>
+  </operation>
+ <operation name='getAvailableExternalData'>
+    <input message='tns:getAvailableExternalDataRequest'/>
+    <output message='tns:getAvailableExternalDataResponse'/>
+  </operation>
+  <operation name='getUserInfo'>
+    <input message='tns:getUserInfoRequest'/>
+    <output message='tns:getUserInfoResponse'/>
+  </operation> 
+  <operation name='getTimeRestriction'>
+    <input message='tns:getTimeRestrictionRequest'/>
+    <output message='tns:getTimeRestrictionResponse'/>
+  </operation>
+</portType>
+
+<binding name='AmdaBinding' type='tns:AmdaPortType'>
+  <soap:binding style='rpc'
+    transport='http://schemas.xmlsoap.org/soap/http'/>
+    <operation name='isRemoteViAdded'>
+     <soap:operation soapAction='isRemoteViAdded'/>
+        <input>
+        <soap:body use='encoded'
+            encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>
+        </input>
+        <output>
+      <soap:body use='encoded'
+        encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>
+    </output>
+   </operation> 
+   <operation name='getVersion'>
+    <soap:operation soapAction='getVersion'/>
+    <input>
+      <soap:body use='encoded'
+        encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>
+    </input>
+    <output>
+      <soap:body use='encoded'
+        encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>
+    </output>
+  </operation>  
+  <operation name='checkRemoteConnection'>
+    <soap:operation soapAction='checkRemoteConnection'/>
+    <input>
+      <soap:body use='encoded'
+        encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>
+    </input>
+    <output>
+      <soap:body use='encoded'
+        encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>
+    </output>
+  </operation>   
+   <operation name='getStartStop'>
+    <soap:operation soapAction='getStartStop'/>
+    <input>
+      <soap:body use='encoded'
+        encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>
+    </input>
+    <output>
+      <soap:body use='encoded'
+        encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>
+    </output>
+  </operation>    
+  <operation name='getInfo'>
+    <soap:operation soapAction='getSInfo'/>
+    <input>
+      <soap:body use='encoded'
+        encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>
+    </input>
+    <output>
+      <soap:body use='encoded'
+        encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>
+    </output>
+  </operation>  
+  <operation name='getRemoteStartStop'>
+    <soap:operation soapAction='getRemoteStartStop'/>
+    <input>
+      <soap:body use='encoded'
+        encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>
+    </input>
+    <output>
+      <soap:body use='encoded'
+        encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>
+    </output>
+  </operation>  
+  <operation name='getDataUrl'>
+    <soap:operation soapAction='getDataUrl'/>
+    <input>
+      <soap:body use='encoded'
+        encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>
+    </input>
+    <output>
+      <soap:body use='encoded'
+        encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>
+    </output>
+  </operation>
+  <operation name='getAvailableExternalBases'>
+    <soap:operation soapAction='getAvailableExternalBases'/>
+    <input>
+      <soap:body use='encoded'
+        encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>
+    </input>
+    <output>
+      <soap:body use='encoded'
+        encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>
+    </output>
+  </operation>
+  <operation name='getAvailableExternalData'>
+    <soap:operation soapAction='getAvailableExternalData'/>
+    <input>
+      <soap:body use='encoded'
+        encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>
+    </input>
+    <output>
+      <soap:body use='encoded'
+        encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>
+    </output>
+  </operation>
+  <operation name='getUserGroups'>
+    <soap:operation soapAction='getUserGroups'/>
+    <input>
+      <soap:body use='encoded'
+        encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>
+    </input>
+    <output>
+      <soap:body use='encoded'
+        encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>
+    </output>
+  </operation>
+  <operation name='getUserAvailableLocalMissions'>
+    <soap:operation soapAction='getUserAvailableLocalMissions'/>
+    <input>
+      <soap:body use='encoded'
+        encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>
+    </input>
+    <output>
+      <soap:body use='encoded'
+        encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>
+    </output>
+  </operation>
+  <operation name='getUserAvailableExternalMissions'>
+    <soap:operation soapAction='getUserAvailableExternalMissions'/>
+    <input>
+      <soap:body use='encoded'
+        encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>
+    </input>
+    <output>
+      <soap:body use='encoded'
+        encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>
+    </output>
+  </operation>
+  <operation name='getAvailableMissions'>
+    <soap:operation soapAction='getAvailableMissions'/>
+    <input>
+      <soap:body use='encoded'
+        encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>
+    </input>
+    <output>
+      <soap:body use='encoded'
+        encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>
+    </output>
+  </operation>
+  <operation name='getUserInfo'>
+    <soap:operation soapAction='getUserInfo'/>
+    <input>
+      <soap:body use='encoded'
+        encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>
+    </input>
+    <output>
+      <soap:body use='encoded'
+        encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>
+    </output>
+  </operation>
+    <operation name='getTimeRestriction'>
+    <soap:operation soapAction='getTimeRestriction'/>
+    <input>
+      <soap:body use='encoded'
+        encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>
+    </input>
+    <output>
+      <soap:body use='encoded'
+        encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>
+    </output>
+  </operation>
+</binding>
+
+<service name='AmdaService'>
+  <port name='AmdaPort' binding='AmdaBinding'>
+      <soap:address location='http://apus.irap.omp.eu/NEWAMDA/DDService/DDserverWeb.php'/>
+  </port>
+</service>
+</definitions>
diff --git a/src/DDSERVICES/SOAP/src/GetFileNames.c b/src/DDSERVICES/SOAP/src/GetFileNames.c
new file mode 100644
index 0000000..f8075b8
--- /dev/null
+++ b/src/DDSERVICES/SOAP/src/GetFileNames.c
@@ -0,0 +1,127 @@
+/* $Id: GetFileNames.c,v 1.2 2008/06/16 12:11:58 elena Exp $ */
+
+/**
+*   @file GetFileNames.c
+*   @brief Print File names
+*   @arg dataSetID, StartTime, StopTime
+*
+*
+*/
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <time.h>
+#include <math.h>
+#include <netcdf.h>
+#include <DD.h>
+
+
+#define NAME_LENGTH 100
+#define NAME_DIM 32L
+
+int DataID, RecID,  StartID, StopID, NameID;;
+size_t RecNum;
+char StartT[TIMELENGTH], StopT[TIMELENGTH];
+size_t count[2] = {1L,TIMELENGTH};
+size_t start[2] = {0L,0L};
+size_t NameCount[2] = {1, NAME_DIM};
+double StartTime, StopTime;
+char Name[NAME_LENGTH];
+
+/*---------------- NC ERROR --------------------------------------*/
+void nc_handle_error(int status)
+{
+  fprintf(stderr, "%s\n", nc_strerror(status));
+  exit(1);
+}
+
+/* ----------------------- MAIN ------------------------------------*/
+  int main(int argc, char *argv[])
+{
+    
+    int status, len, StartRecord, StopRecord;
+    int i, hi, lo = 0;
+    double StartD0, StartD1 = 0.0, StopD0, StopD1;
+ 
+   if (argc < 4)
+    {
+       fprintf(stderr,"Usage: GetFileNames ViId StartTime StopTime\n");
+       exit(0);
+    }
+
+/* find VI in reference file */
+     
+     
+     StartTime = atof(argv[2]);
+     StopTime = atof(argv[3]);
+        
+/* Open VI_times.nc */
+      
+       if ((status = nc_open(argv[1], NC_NOWRITE, &DataID)) != NC_NOERR)
+                                                nc_handle_error(status);
+
+       if ((status = nc_inq_dimid(DataID, "record", &RecID)) != NC_NOERR)
+                                          nc_handle_error(status);
+     
+/*   Get Number of Records */
+   
+      if ((status = nc_inq_dimlen(DataID, RecID, &RecNum)) != NC_NOERR)
+                                          nc_handle_error(status);
+
+      if ((status = nc_inq_varid(DataID, "StartTime", &StartID)) != NC_NOERR)
+                                          nc_handle_error(status);
+      if ((status = nc_inq_varid(DataID, "StopTime", &StopID)) != NC_NOERR)
+                                          nc_handle_error(status);
+
+     if ((status = nc_inq_varid(DataID, "FileName", &NameID)) != NC_NOERR)
+                                          nc_handle_error(status);
+/* Get The First Start and The Last Stop Times */      
+      start[0] = 0;     
+
+     if((status = nc_get_vara_text(DataID, StartID, start, count, StartT)) != NC_NOERR)
+                                          nc_handle_error(status);
+
+      start[0] = RecNum-1; 
+      if((status = nc_get_vara_text(DataID, StopID, start, count, StopT)) != NC_NOERR)
+                                          nc_handle_error(status);
+   
+      if (StartTime > DD_Time2Double(StopT) || StopTime < DD_Time2Double(StartT)) 
+       {
+          fprintf(stdout, "OUTOFTIME\0"); 
+          nc_close(DataID);
+          exit(0);
+        }
+
+      hi = RecNum; 
+
+ /* Find Start Record */
+      while (lo <  hi)
+       {               
+               i = (lo+hi)/2; 
+               start[0] = i + 1;
+               status = nc_get_vara_text(DataID,StartID,start,count,(char *)StartT);
+               StartD1 = DD_Time2Double(StartT);
+               if (StartD1 > StartTime) hi--;  
+               start[0] = i;
+               status = nc_get_vara_text(DataID,StartID,start,count,(char *)StartT);
+               StartD0 = DD_Time2Double(StartT);                
+               if (StartD0 < StartTime) lo++;              
+               if (StartD1 <=  StartTime && StartD0 >= StartTime) break;
+       }        
+       status = nc_get_vara_text(DataID, NameID, start, NameCount,(char *)Name);
+       fprintf(stdout, "%s;",Name);
+       status = nc_get_vara_text(DataID,StopID,start,count,(char *)StopT);
+       StopD0 = DD_Time2Double(StopT);
+ 
+       while (StopTime > StopD0  &&  start[0] <= RecNum) {
+              status = nc_get_vara_text(DataID,StopID,start,count,(char *)StopT); 
+              status = nc_get_vara_text(DataID, NameID, start, NameCount,(char *)Name);
+              if (start[0] > i) fprintf(stdout, "%s;", Name); 
+              StopD0 = DD_Time2Double(StopT);
+              start[0]++;
+        }
+ 
+      nc_close(DataID);
+    
+}
diff --git a/src/DDSERVICES/SOAP/src/GetInfo.c b/src/DDSERVICES/SOAP/src/GetInfo.c
new file mode 100644
index 0000000..cc6676a
--- /dev/null
+++ b/src/DDSERVICES/SOAP/src/GetInfo.c
@@ -0,0 +1,102 @@
+ 
+/** @file GetInfo.c
+*   @version $Id: GetInfo.c,v 1.1 2013/05/22 13:33:52 budnik Exp $
+*/
+
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <time.h>
+#include <math.h>
+#include <netcdf.h>
+#include <DD.h>
+
+
+int DataID, RecID, VarID;
+size_t RecNum;
+char Var[128];
+size_t count[2] = {1L,TIMELENGTH};
+size_t start[2] = {0L,0L};
+size_t countVar[2] = {1L,128L};
+
+/*---------------- NC ERROR --------------------------------------*/
+void nc_handle_error(int status)
+{
+  fprintf(stderr, "%s\n", nc_strerror(status));
+  exit(1);
+}
+
+/* ----------------------- MAIN ------------------------------------*/
+  int main(int argc, char *argv[])
+{
+    
+    int status, len, infoID, i;
+ 
+    char Project[50],Instrument[50],Mode[50], RInstrName[100], INFO_ID[50];
+    int dims[10];
+    size_t lenp, total_length;
+    float *value;
+    int ndimsp;
+    
+    if (argc < 4)
+    {
+       fprintf(stderr,"Usage: GetInfo reference_file_name  VI_ID INFO_ID\n");
+       exit(0);
+    }
+
+     
+    if ((status = nc_open(argv[1], NC_NOWRITE, &DataID)) != NC_NOERR)
+                                            nc_handle_error(status);
+    
+     sscanf(argv[2], "%[^:]%*c%[^:]%*c%[^:]%*c",Project,
+                                                Instrument,
+                                                Mode);
+     
+     sprintf(RInstrName,"%s_%s_%s\0",Project,Instrument,Mode);
+     sprintf(INFO_ID,"%s\0",argv[3]);
+    
+     if ((status = nc_inq_varid(DataID,RInstrName,&VarID)) != NC_NOERR)
+                                            nc_handle_error(status);
+    
+      start[0] = 2;
+      if((status = nc_get_vara_text(DataID, VarID, start, countVar, Var)) != NC_NOERR)
+                                          nc_handle_error(status);
+       
+       len = strcspn(Var," "); Var[len] = '\0';
+
+       if ((status = nc_close(DataID)) != NC_NOERR) nc_handle_error(status);
+
+// Open VI_info.nc
+      
+       if ((status = nc_open(Var, NC_NOWRITE, &DataID)) != NC_NOERR)
+                                                nc_handle_error(status);
+ 
+     
+//   Get Number of Records
+ 
+
+       if ((status = nc_inq_varid(DataID, INFO_ID, &infoID)) != NC_NOERR)
+                                          nc_handle_error(status);
+      
+       if ((status = nc_inq_varndims(DataID, infoID, &ndimsp)) != NC_NOERR)
+                                          nc_handle_error(status);
+      
+       if ((status = nc_inq_vardimid(DataID, infoID, &dims)) != NC_NOERR)
+                                          nc_handle_error(status); 
+       total_length = 0;
+       for ( i = 0; i < ndimsp; i++) {
+            if ((status = nc_inq_dimlen (DataID, dims[i], &lenp))!= NC_NOERR)
+                                                      nc_handle_error(status);
+            total_length += lenp;
+       }
+       value = malloc(total_length*sizeof(float));
+       
+       if ((status =nc_get_var_float(DataID, infoID, value)) != NC_NOERR)
+                                          nc_handle_error(status);
+        printf("%f", value[0]);
+        for (i = 1; i < lenp; i++) printf(";%f", value[i]);
+ 
+        if ((status = nc_close(DataID)) != NC_NOERR) nc_handle_error(status);
+    
+}
diff --git a/src/DDSERVICES/SOAP/src/Makefile b/src/DDSERVICES/SOAP/src/Makefile
new file mode 100755
index 0000000..754b434
--- /dev/null
+++ b/src/DDSERVICES/SOAP/src/Makefile
@@ -0,0 +1,30 @@
+#-----------------------------------------------------
+#  MAKEFILE for  DD SERVER Services
+#---------------------------------------------------------
+
+EXE = StartStop GetFileNames GetInfo
+
+lib: $(EXE)
+	 
+install:
+	install -d -m a+rx,ug+w ../bin
+	cp $(EXE) ../bin
+		
+clean:	
+	tag="*.o" ${EXE};\
+        for file in $$tag; do \
+	echo $$file; rm -f $$file;\
+	done
+	find -name \*~ -delete
+	
+deinstall:
+	echo "Do nothing"
+
+StartStop: StartStop.c
+	${CC} ${CFLAGS} -o StartStop StartStop.c ${INC} ${LIB} -lnetcdf
+
+GetInfo: GetInfo.c
+	${CC} ${CFLAGS} -o GetInfo GetInfo.c ${INC} ${LIB} -lnetcdf
+
+GetFileNames: GetFileNames.c
+	${CC} ${CFLAGS} -o GetFileNames GetFileNames.c ${INC} ${LIB} -lnetcdf -lDD
diff --git a/src/DDSERVICES/SOAP/src/StartStop.c b/src/DDSERVICES/SOAP/src/StartStop.c
new file mode 100644
index 0000000..d58a329
--- /dev/null
+++ b/src/DDSERVICES/SOAP/src/StartStop.c
@@ -0,0 +1,104 @@
+ 
+/** @file  StartStop.c
+*   @brief Stand-alone executable <br> Returns real Start-Stop for VI in DDBase <br>
+*          Is used in DD Server WebServices <br>
+*    @details StartStop(string *, string *)  <br>
+*        @arg \c argv[1] Full name of DDBase reference file  <br>
+*        @arg \c argv[2] Virtual Instrument ID (DD notation) <br>
+*     Output: YYYYDDdayHHMMSSMLS-YYYYDDdayHHMMSSMLS       
+*                 
+*   @date 10.10.2007
+*   @version $Id: StartStop.c,v 1.3 2011/09/05 11:27:34 budnik Exp $
+*/
+
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <time.h>
+#include <math.h>
+#include <netcdf.h>
+#include <DD.h>
+
+
+int DataID, RecID, VarID, StartID, StopID;
+size_t RecNum;
+char StartT[TIMELENGTH], StopT[TIMELENGTH], Var[128];
+size_t count[2] = {1L,TIMELENGTH};
+size_t start[2] = {0L,0L};
+size_t countVar[2] = {1L,128L};
+
+/*---------------- NC ERROR --------------------------------------*/
+void nc_handle_error(int status)
+{
+  fprintf(stderr, "%s\n", nc_strerror(status));
+  exit(1);
+}
+
+/* ----------------------- MAIN ------------------------------------*/
+  int main(int argc, char *argv[])
+{
+    
+    int status, len;
+ 
+    char Project[50],Instrument[50],Mode[50], RInstrName[100];
+
+
+    if (argc < 3)
+    {
+       fprintf(stderr,"Usage: StartStop reference_file_name DD_VI_ID\n");
+       exit(0);
+    }
+
+     
+    if ((status = nc_open(argv[1], NC_NOWRITE, &DataID)) != NC_NOERR)
+                                            nc_handle_error(status);
+    
+     sscanf(argv[2], "%[^:]%*c%[^:]%*c%[^:]%*c",Project,
+                                                  Instrument,
+                                                   Mode);
+     sprintf(RInstrName,"%s_%s_%s\0",Project,Instrument,Mode);
+
+      if ((status = nc_inq_varid(DataID,RInstrName,&VarID)) != NC_NOERR)
+                                            nc_handle_error(status);
+    
+      start[0] = 1;
+      if((status = nc_get_vara_text(DataID, VarID, start, countVar, Var)) != NC_NOERR)
+                                          nc_handle_error(status);
+       
+       len = strcspn(Var," "); Var[len] = '\0';
+
+       if ((status = nc_close(DataID)) != NC_NOERR) nc_handle_error(status);
+
+// Open VI_times.nc
+      
+       if ((status = nc_open(Var, NC_NOWRITE, &DataID)) != NC_NOERR)
+                                                nc_handle_error(status);
+
+       if ((status = nc_inq_dimid(DataID, "record", &RecID)) != NC_NOERR)
+                                          nc_handle_error(status);
+     
+//   Get Number of Records
+   
+      if ((status = nc_inq_dimlen(DataID, RecID, &RecNum)) != NC_NOERR)
+                                          nc_handle_error(status);
+
+      if ((status = nc_inq_varid(DataID, "StartTime", &StartID)) != NC_NOERR)
+                                          nc_handle_error(status);
+      if ((status = nc_inq_varid(DataID, "StopTime", &StopID)) != NC_NOERR)
+                                          nc_handle_error(status);
+
+// Get The First Start and The Last Stop Times      
+      start[0] = 0;     
+
+     if((status = nc_get_vara_text(DataID, StartID, start, count, StartT)) != NC_NOERR)
+                                          nc_handle_error(status);
+
+      start[0] = RecNum-1; 
+      if((status = nc_get_vara_text(DataID, StopID, start, count, StopT)) != NC_NOERR)
+                                          nc_handle_error(status);
+ 
+      printf("%s-%s\n",  StartT, StopT);
+      if ((status = nc_close(DataID)) != NC_NOERR) nc_handle_error(status);
+    
+}
diff --git a/src/DECODERS/cdf2nc/cdf2nc.c b/src/DECODERS/cdf2nc/cdf2nc.c
index 4b4aa24..3deb3b3 100755
--- a/src/DECODERS/cdf2nc/cdf2nc.c
+++ b/src/DECODERS/cdf2nc/cdf2nc.c
@@ -503,6 +503,7 @@ void get_cdf_attr_data (char *attrName,    /* in - attribute name          */
 
     switch (datatype) {
     case CDF_CHAR:
+	 case CDF_UCHAR:	 
         cPtr = (char *) malloc(numElements * sizeof(char) + 1);
         if (cPtr == NULL) memory_error("get_cdf_attr_data", "NC_CHAR");
         status = CDFlib (GET_, entryData, cPtr, NULL_);
@@ -534,7 +535,6 @@ void get_cdf_attr_data (char *attrName,    /* in - attribute name          */
         break;
 
     case CDF_INT2:
-    case CDF_UCHAR:
     case CDF_UINT1:
         sPtr = (short *) malloc (sizeof(short) * numElements);
         if (sPtr == NULL) memory_error("get_cdf_attr_data", "NC_SHORT");
diff --git a/src/REMOTEDATA/CDAWEB.php b/src/REMOTEDATA/CDAWEB.php
index d002087..397605d 100644
--- a/src/REMOTEDATA/CDAWEB.php
+++ b/src/REMOTEDATA/CDAWEB.php
@@ -449,7 +449,7 @@ class CDAWEB extends RemoteDataCenterClass
 		if (file_exists("NumericalData.html")) rename("NumericalData.html","NumericalData.html.bak");
 	//	exec("wget -O NumericalData.html ".CDAWebConfigClass::$spaseRegistry);
 		//TODO errors
-		copy("NumericalData.html", CDAWebConfigClass::$spaseRegistry);
+		copy(CDAWebConfigClass::$spaseRegistry, "NumericalData.html");
 		
 		$html = file_get_html('NumericalData.html');
 		$ids = $html->find('td[class="Spase.URL.ProductID"]');
@@ -583,13 +583,23 @@ class CDAWEB extends RemoteDataCenterClass
 		system("cdf2nc $file");		 
 		$ncFile = str_replace(".cdf", ".nc", $file);
 		
-// 		if (!file_exists($ncFile))
-// 			exit(" NO nc file $ncFile");
+ 		if (!file_exists($ncFile)) return false; 
 		unlink($file);	
 		
 		return $ncFile;
 	}
 	
+	public function getDatasetInfo($ds)
+	{
+		$masterCdf = strtolower($ds)."_00000000_v01.cdf";	
+		$localCdf = strtolower($ds).".cdf";
+		
+		if (!copy(CDAWebConfigClass::$masterUrl."/".$masterCdf,  strtolower($ds).".cdf")) return false;
+	 
+		$infoFile = $this->convert2nc($localCdf);
+	  
+		return $infoFile;
+	}
 	protected function setDataCenterAttributes(){}
 	protected function makeArgumentsList(){}
 } 
diff --git a/src/REMOTEDATA/RemoteDataCenterClass.php b/src/REMOTEDATA/RemoteDataCenterClass.php
index b017792..7584e52 100644
--- a/src/REMOTEDATA/RemoteDataCenterClass.php
+++ b/src/REMOTEDATA/RemoteDataCenterClass.php
@@ -16,7 +16,7 @@ abstract class RemoteDataCenterClass
 	public $additionalArgs = null;
 	public $templateFile, $plotSettings;
 	public $baseID = null;
-
+	
 	public $tree = null;
 	
    public static $MAX_NAME_LENGTH = 31;
@@ -48,7 +48,7 @@ abstract class RemoteDataCenterClass
 	abstract protected function setDataCenterAttributes();
 	abstract protected function createMissionNodes();
 	abstract protected function makeArgumentsList();
-		
+//	abstract public function getDatasetInfo($ds);	
 //	abstract public function getData($ds, $start, $stop);
 //	abstract protected function convert2nc();
 // 	abstract protected function createDatasetNodes();
--
libgit2 0.21.2