diff --git a/README.md b/README.md
new file mode 100644
index 0000000..882f33b
--- /dev/null
+++ b/README.md
@@ -0,0 +1,7 @@
+In order to use the footprints code:
+
+1) At the footprints project root (PATH-TO-PROJECT/FOOTPRINTS), set the environment variables: '. env.sh'
+
+2) Go back to the projects directory (/usr/local/soft) and set the PY3 python virtual environment: '. PY3/bin/activate'
+
+3) Finally, go to the footprints project and to the bin directory (/usr/local/soft/FOOTPRINTS/BIN) and run the code: 'python runFootprints.py (XML mission file)' or 'python runAll.py' (to run all missions described into the missions directory (/usr/local/soft/FOOTPRINTS/MISSIONS))
diff --git a/env.sh b/env.sh
new file mode 100644
index 0000000..df82260
--- /dev/null
+++ b/env.sh
@@ -0,0 +1,21 @@
+#!/bin/bash
+
+# SOFT ROOT
+export FOOTPRINTSROOT=/home/budnik/FOOTPRINTS
+# LIBS
+# TSYGANENKO lib
+export GEOPACKDIR=${FOOTPRINTSROOT}/geopack
+# DDClient to access to DD Server 
+export DDDIR=/usr/local/DDClient
+export TINYDIR=/usr/local/tinyxml
+export BOOSTDIR=/usr/local/boost
+
+#------- DO NOT EDIT BELOW --------
+export FOOTPRINTSMISSIONS=$FOOTPRINTSROOT/MISSIONS
+export FOOTPRINTSCONFIG=$FOOTPRINTSROOT/CONFIG
+export LD_LIBRARY_PATH=$GEOPACKDIR/lib:$BOOSTDIR/stage/lib:$DDDIR/lib:$TINYDIR/lib
+export PATH=/bin:/usr/bin:/usr/local/bin:./:$FOOTPRINTSROOT/BIN:$DDDIR/bin
+
+# DATA ROOT
+export FOOTPRINTSDATA=$FOOTPRINTSROOT/DATA
+export FOOTPRINTSFILES=$FOOTPRINTSDATA/FOOTPRINTS
\ No newline at end of file
diff --git a/src/Makefile b/src/Makefile
new file mode 100644
index 0000000..0827680
--- /dev/null
+++ b/src/Makefile
@@ -0,0 +1,73 @@
+.PHONY: clean, geopack, tinyxml
+
+include ../env.sh
+ 
+# *************************** COMPILER SETTINGS *****************************
+CXX        = g++ 
+CXXFLAGS   = -std=c++11 -pedantic -fPIC -Wall -Wextra
+INCLUDE    = -I${BOOSTDIR} -I${DDDIR}/include/DDClientLibC -I${TINYDIR}/include
+LIB        = -L${GEOPACKDIR}/lib -L${BOOSTDIR}/stage/lib -L${DDDIR}/lib -L${TINYDIR}/lib
+LKLIBS     = -lboost_date_time -lboost_regex -lDDClientLibC -ltinyxml -lnetcdf -lm
+LDFLAGS    = -fPIC
+CC 	   = gcc
+EXE        = GetData Footprints NC
+# ********************* END OF COMPILER SETTINGS *****************************
+
+# ******************************** LINKING *********************************
+all: $(EXE)
+	install -d -m a+rx,ug+w ../bin
+	# mv Inputs ../bin
+	mv Footprints ../bin
+	mv NC ../bin
+
+NC: makeNcFile.o ctools.o
+	gcc -o $@ $^ -lnetcdf -lm
+
+# Footprints: makeFootprints.o geopack.o T96.o
+# 	gcc -o $@ $^ -lgfortran -lm
+
+Footprints: makeFootprints.o
+	gcc -o $@ $^ ${LIB} -lgeopack -lgfortran -lm
+
+GetData: getInputs.o
+	${CXX} -o $@ $^ ${LDFLAGS} ${LIB} ${LKLIBS}
+	
+# Inputs: makeInputs.o tools.o
+# 	${CXX} -o $@ $^ ${LDFLAGS} ${LIB} ${LKLIBS}
+
+# ************************** END OF LINKING *********************************
+
+# ******************************** COMPILING ********************************
+# %.o: %.cpp
+# 	${CXX} -c $< -o $@ ${INCLUDE} ${CXXFLAGS}
+
+getInputs.o: getInputs.cpp
+	${CXX} -c $< -o $@ ${INCLUDE} ${CXXFLAGS}
+
+makeFootprints.o: makeFootprints.c
+	gcc -O3 -c makeFootprints.c
+
+makeNcFile.o: makeNcFile.c
+	gcc -c makeNcFile.c
+
+ctools.o: ctools.c 
+	gcc -c ctools.c
+
+# ************************* END OF COMPILING ********************************
+
+
+# ***************************** BUILDING LIBS *******************************
+# GEOPACK
+# geopack:
+# 	cd ../LIB/GEOPACK/ && make T96.o
+# 	cd ../LIB/GEOPACK/ && make geopack.o
+
+# TINYXML
+# tinyxml:
+# 	cd ../LIB/TINYXML/ && make
+# ********************** END OF BUILDING LIBS *******************************
+
+# CLEAN
+clean: 
+	rm -rf *.o
+	rm -rf ${EXE}
diff --git a/src/ctools.c b/src/ctools.c
new file mode 100644
index 0000000..9937619
--- /dev/null
+++ b/src/ctools.c
@@ -0,0 +1,196 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include <time.h>
+
+#include "ctools.h"
+
+
+/***************************************************************************
+							getError
+
+	Name 	: 	getError
+	Brief 	: 	Writes error into the error file
+	Arg 	: 	String error message to put into the log file
+*****************************************************************************/
+int getError(char *errorMsg) {
+
+	FILE* error_file  = NULL;
+	time_t timer;
+	char dateBuffer[256];
+
+	time(&timer); 
+  		
+	error_file = fopen("LOG/error.txt", "a");
+
+	strftime(dateBuffer, sizeof(dateBuffer), "%a %b %d %X", localtime(&timer)); 
+
+	fprintf(error_file, "%s %s\n", dateBuffer, errorMsg);
+
+	fclose(error_file);
+
+	return 0;
+}
+
+/*****************************************************************************
+							setDateStr
+
+	Name : 	setDateStr
+	Brief : Creates a string date (yyyydddHHMMSS###) from integer values
+	Arg1 : Integer year (yyy)
+	Arg2 : Integer day of year (ddd) --> 000, 001, ... 364
+	Arg3 : Integer hours (HH)
+	Arg4 : Integer minutes (MM)
+	Arg5 : Integer seconds (SS)
+******************************************************************************/
+int setDateStr(int year, int doy, int hour, int minutes, int seconds, int mls,
+				char ncYear[4], char ncDay[3], char ncHour[2], char ncMin[2],
+				char ncSec[2], char ncMls[2], char ncDate[17])  
+				
+{
+	// LOCAL VARIABLE
+	char errMsg[256];
+
+	// BUILD DATE
+	if ( year >= 1000 && year < 10000 )
+	{
+		sprintf(ncYear, "%d", year);
+
+	} else {
+
+		sprintf(ncYear, "%d", year);
+
+    	strcpy(errMsg, "[ERROR] : NC file --> Bad year : ");
+		
+		strcat(errMsg, ncYear);
+
+		getError(errMsg);
+
+		exit(EXIT_FAILURE);
+	}
+		
+		
+    if ( doy >= 0 && doy < 10)
+    {
+ 		sprintf(ncDay, "00%d", doy);
+
+    } else if ( doy >= 10 && doy < 100 ) {
+
+    	sprintf(ncDay, "0%d", doy);
+
+    } else if ( doy >= 100 && doy <= 366 ) {
+
+    	sprintf(ncDay, "%d", doy);
+
+    } else {
+
+    	sprintf(ncDay, "%d", ncDay);
+
+    	strcpy(errMsg, "[ERROR] : NC file --> Bad day : ");
+		
+		strcat(errMsg, ncDay);
+
+		getError(errMsg);
+
+		exit(EXIT_FAILURE);
+    }
+
+    if ( hour >= 0 && hour < 10 )
+    {
+    	sprintf(ncHour, "0%d", hour);
+
+    } else if ( hour >= 10 && hour < 24 ) {
+
+    	sprintf(ncHour, "%d", hour);
+
+    } else {
+
+    	sprintf(ncHour, "%d", hour);
+
+    	strcpy(errMsg, "[ERROR] : NC file --> Bad hour : ");
+		
+		strcat(errMsg, ncHour);
+
+		getError(errMsg);
+
+		exit(EXIT_FAILURE);
+    }
+
+    if ( minutes >= 0 && minutes < 10 )
+    {
+    	sprintf(ncMin, "0%d", minutes);
+
+    } else if ( minutes >= 10 && minutes < 60 ) {
+    	
+    	sprintf(ncMin, "%d", minutes);
+
+    } else {
+
+    	sprintf(ncMin, "%d", minutes);
+
+    	strcpy(errMsg, "[ERROR] : NC file --> Bad minute : ");
+		
+		strcat(errMsg, ncMin);
+
+		getError(errMsg);
+
+		exit(EXIT_FAILURE);
+    }
+
+    if ( seconds >= 0 && seconds < 10 )
+    {
+    	sprintf(ncSec, "0%d", seconds);
+
+    } else if ( seconds >= 10 && seconds < 60 ) {
+    	
+    	sprintf(ncSec, "%d", seconds);
+
+    } else {
+
+    	sprintf(ncSec, "%d", seconds);
+
+    	strcpy(errMsg, "[ERROR] : NC file --> Bad minute : ");
+		
+		strcat(errMsg, ncSec);
+
+		getError(errMsg);
+
+		exit(EXIT_FAILURE);
+    }
+
+    if ( mls >= 0 && mls < 10 )
+    {
+    	sprintf(ncMls, "00%d", mls);
+
+    } else if ( mls >= 10 && mls < 100 ) {
+    	
+    	sprintf(ncMls, "0%d", mls);
+
+    } else if ( mls >= 100 && mls < 1000 ) {
+
+    	sprintf(ncMls, "%d", mls);
+
+    } else {
+
+    	sprintf(ncMls, "%d", mls);
+
+    	strcpy(errMsg, "[ERROR] : NC file --> Bad minute : ");
+		
+		strcat(errMsg, ncMls);
+
+		getError(errMsg);
+
+		exit(EXIT_FAILURE);
+    }
+
+    // SET DATE
+	strcpy(ncDate, ncYear);
+	strcat(ncDate, ncDay);
+	strcat(ncDate, ncHour);
+	strcat(ncDate, ncMin);
+	strcat(ncDate, ncSec);
+	strcat(ncDate, ncMls);
+
+	return 0;
+}
\ No newline at end of file
diff --git a/src/ctools.h b/src/ctools.h
new file mode 100644
index 0000000..5af075b
--- /dev/null
+++ b/src/ctools.h
@@ -0,0 +1,24 @@
+typedef struct Date Date;
+
+struct Date
+{
+
+    char strDate[17];
+};
+
+typedef struct Footprint Footprint;
+
+struct Footprint
+{
+ 	float geoCoordN[2];
+ 	float geoCoordS[2];
+
+ 	float distmgnp;
+
+ 	int SWFLAG;
+}; 
+
+int getError(char *errorMsg);
+int setDateStr(int year, int doy, int hour, int minutes, int seconds, int mls,
+				char ncYear[4], char ncDay[3], char ncHour[2], char ncMin[2],
+				char ncSec[2], char ncMls[2], char ncDate[17]);
diff --git a/src/getInputs.cpp b/src/getInputs.cpp
new file mode 100644
index 0000000..101f775
--- /dev/null
+++ b/src/getInputs.cpp
@@ -0,0 +1,366 @@
+////////////////
+// CPP HEADER //
+////////////////
+#include <iostream>
+#include <string>
+#include <vector>
+#include <fstream>
+
+////////////
+/// DDLIB //
+////////////
+#include "DD.h"
+
+using namespace std;
+
+///////////////////////////
+/// FUNCTIONS PROTOTYPES //
+//////////////////////////
+void getPlasmaData(string plasmaVi, string ddStart, string ddInterval,
+	string timeParameter, string vnormParameter, string rampParameter,
+	string velParameter, string magParameter,
+	vector<string>& plasmaTimeArray, vector<float>& vnormArray,
+	vector<float>& rampArray, 
+	vector<float>& vxArray, vector<float>& vyArray, vector<float>& vzArray,
+	vector<float>& bxArray, vector<float>& byArray, vector<float>& bzArray);
+
+
+void getOrbitData(string satelliteVi, string ddStart, string ddInterval,
+	string timeParameter, string orbitParameter, 
+	vector<string>& satelliteTimeArray,
+	vector<float>& x, vector<float>& y, vector<float>& z);
+
+
+void getSymIndexData(string symIndexVi, string ddStart, string ddInterval,
+	string timeParameter, string symIndexParameter, 
+	vector<string>& symIndexTimeArray, vector<float>& symIndexArray);
+
+
+///////////
+/// MAIN //
+///////////
+int main(int argc, char const *argv[])
+{
+	// CHECK ARGS
+	if (argc != 11)
+	{
+		cerr << "[ERROR] Usage : GetData (Plasma VI) (Plasma DD Start) (Plasma DD Interval) (Satellite VI) (Satellite Orbit parameter) (Satellite DD Start) (Satellite DD Interval) (Sym Index VI) (Sym Index DD Start) (Sym Index DD Interval)" << endl;
+		exit(EXIT_FAILURE);
+	}
+
+	// CONSTANTS
+	string timeParameter  = "Time";
+	string plasmaVNorm    = "V";
+	string plasmaRamP     = "RamP";
+	string plasmaVel      = "Vel";
+	string plasmaMag      = "B";
+	string indexSym       = "SYM";
+
+	// GET PLASMA DATA
+	string plasmaVi      = argv[1];
+	string pddStart      = argv[2];
+	string pddInterval   = argv[3];
+
+	vector<string> plasmaTimeArray; 
+	vector<float> vnormArray,rampArray, vx, vy, vz, bx, by, bz;
+
+	getPlasmaData(plasmaVi, pddStart, pddInterval,
+	timeParameter, plasmaVNorm, plasmaRamP, plasmaVel, plasmaMag,
+	plasmaTimeArray, vnormArray, rampArray, vx, vy, vz, bx, by, bz);
+
+	ofstream plasmaData("plasma.txt", ios::out | ios::trunc);
+	
+	int plasmaSize = plasmaTimeArray.size();
+
+	plasmaData << "Time,V,ramP,vx,vy,vz,bx,by,bz" << endl; 
+
+	for (int i = 0; i < plasmaSize; ++i)
+	{
+		plasmaData << plasmaTimeArray[i] << "," 
+					<< vnormArray[i] << "," 
+					<< rampArray[i] << "," 
+					<< vx[i] << "," << vy[i] << "," << vz[i] << "," 
+					<< bx[i] << "," << by[i] << "," << bz[i] << endl;
+	}
+
+	plasmaData.close();
+
+	cout << "getPlasmaData ok"<< endl;
+
+	// GET SATELLITE DATA
+	string satelliteVi       = argv[4];
+	string satelliteOrbParam = argv[5];
+	string satddStart        = argv[6];
+	string satddInterval     = argv[7];
+	
+	vector<string> satelliteTimeArray;
+	vector<float> x, y, z;
+
+	getOrbitData(satelliteVi, satddStart, satddInterval,
+	timeParameter, satelliteOrbParam, satelliteTimeArray, 
+	x, y, z);
+
+	ofstream satelliteData("orbit.txt", ios::out | ios::trunc);
+	
+	int satelliteSize = satelliteTimeArray.size();
+
+	satelliteData << "Time,x,y,z" << endl;
+
+	for (int i = 0; i < satelliteSize; ++i)
+	{
+		satelliteData << satelliteTimeArray[i] << "," 
+					<< x[i] << "," << y[i] << "," << z[i] << endl;
+	}
+
+	satelliteData.close();
+
+	cout << "getOrbitData ok"<< endl;
+
+	// GET SYM H DATA
+	string indexVi       = argv[8];
+	string symddStart    = argv[9];
+	string symddInterval = argv[10];
+
+	vector<string> symIndexTimeArray;
+	vector<float> symIndexArray;
+
+	getSymIndexData(indexVi, symddStart, symddInterval, 
+	timeParameter, indexSym, 
+	symIndexTimeArray, symIndexArray);
+
+	cout << "getSymIndexData ok"<< endl;
+	
+	ofstream symData("sym.txt", ios::out | ios::trunc);
+	
+	int symSize = symIndexTimeArray.size();
+
+	symData << "Time,symIndex" << endl;
+
+	for (int i = 0; i < symSize; ++i)
+	{
+		symData << symIndexTimeArray[i] << "," << symIndexArray[i] << endl;
+	}
+
+	symData.close();
+
+	return 0;
+}
+
+
+
+////////////////////////////
+/// FUNCTIONS DEFINITIONS //
+////////////////////////////
+void getPlasmaData(string plasmaVi, string ddStart, string ddInterval,
+	string timeParameter, string vnormParameter, string rampParameter,
+	string velParameter, string magParameter,
+	vector<string>& plasmaTimeArray, vector<float>& vnormArray,
+	vector<float>& rampArray, 
+	vector<float>& vxArray, vector<float>& vyArray, vector<float>& vzArray,
+	vector<float>& bxArray, vector<float>& byArray, vector<float>& bzArray)
+{
+	int id = DD_SetVariable( const_cast<char*>( plasmaVi.c_str() ) );
+
+	cout << "getPlasmaData id : "<< id << endl;
+
+	char *st = const_cast<char*>( ddStart.c_str() );
+
+	cout << "getPlasmaData st : "<< st << endl;
+
+	int error = DD_SetTime(id, st);
+
+	cout << "getPlasmaData error : "<< error << endl;
+
+	if (error < 0)
+	{
+		std::string ddSetTimeErr = "[ERROR] getPlasmaData : bad time pointer init in DD_SetTime -> err value : " +  error;
+		throw std::string(ddSetTimeErr);
+	}
+
+	// GET DATA
+	char *params[5];
+	
+	params[0] = const_cast<char*>( timeParameter.c_str() );
+	params[1] = const_cast<char*>( vnormParameter.c_str() );
+	params[2] = const_cast<char*>( rampParameter.c_str() );
+	params[3] = const_cast<char*>( velParameter.c_str() );
+	params[4] = const_cast<char*>( magParameter.c_str() );
+	
+	char *timeIntervall = const_cast<char*>( ddInterval.c_str() );
+	
+	DD_data_t *data;
+
+	int status = 0;
+
+	do {
+
+		status = DD_GetMultiData(id, 5, static_cast<char**>(params), timeIntervall, &data, 1);
+		
+		if (status < 0)
+		{
+			std::string ddGetDataErr = "[ERROR] getPlasmaData : failed to get data -> status : " + status;
+			throw std::string(ddGetDataErr);
+		}
+
+		for (int j = 0; j < data->VarNumber; ++j)
+		{
+			plasmaTimeArray.push_back( static_cast<char*>(data[0].Variables[j]) );
+		  	vnormArray.push_back( *(static_cast<float*>(data[1].Variables[j])) );
+			rampArray.push_back( *(static_cast<float*>(data[2].Variables[j])) );
+			vxArray.push_back( static_cast<float*>(data[3].Variables[j])[0] );
+		  	vyArray.push_back( static_cast<float*>(data[3].Variables[j])[1] );
+		  	vzArray.push_back( static_cast<float*>(data[3].Variables[j])[2] );
+		  	bxArray.push_back( static_cast<float*>(data[4].Variables[j])[0] );
+		  	byArray.push_back( static_cast<float*>(data[4].Variables[j])[1] );
+		  	bzArray.push_back( static_cast<float*>(data[4].Variables[j])[2] );
+
+		}
+
+
+	} while (status == MOREDATA);
+	
+    DD_Close(id);
+}
+
+void getOrbitData(string satelliteVi, string ddStart, string ddInterval,
+				string timeParameter, string orbitParameter, 
+				vector<string>& satelliteTimeArray,
+				vector<float>& x, vector<float>& y, vector<float>& z)
+{
+	int id = DD_SetVariable( const_cast<char*>( satelliteVi.c_str() ) );
+
+	cout << "getOrbitData id : "<< id << endl;
+
+    char *st = const_cast<char*>( ddStart.c_str() );
+
+    cout << "getOrbitData st : " << st<< endl;
+
+	int error = DD_SetTime(id, st);
+
+	cout << "getOrbitData error: " << error<< endl;
+
+	if (error < 0)
+	{
+		std::string ddSetTimeErr = "[ERROR] getOrbitData : bad time pointer init in DD_SetTime -> err value : " +  error;
+		throw std::string(ddSetTimeErr);
+	}
+
+
+	char *params[2];
+	
+	params[0] = const_cast<char*>( timeParameter.c_str() );
+	params[1] = const_cast<char*>( orbitParameter.c_str() );
+
+	char *timeIntervall = const_cast<char*>( ddInterval.c_str() );
+
+	DD_data_t *data;
+
+	int status = 0;
+
+	do {
+
+		cout << "getOrbitData DD_GetMultiData ... " << endl;
+		cout << "getOrbitData id : "<< id << endl;
+		cout << "getOrbitData param 1 : " << params[0] << endl;
+		cout << "getOrbitData param 2 : " << params[1] << endl;
+		cout << "getOrbitData timeIntervall : " << timeIntervall << endl;
+
+		status = DD_GetMultiData(id, 2, static_cast<char**>(params), timeIntervall, &data, 1);
+		
+		cout << "getOrbitData DD_GetMultiData OK " << endl;
+
+		if (status < 0)
+		{
+			std::string ddGetDataErr = "[ERROR] getOrbitData : failed to get data -> status : " + status;
+			throw std::string(ddGetDataErr);
+		}
+
+		int dataType = data[1].type;
+		
+		for (int j = 0; j < data->VarNumber; j++)	
+		{
+			satelliteTimeArray.push_back( static_cast<char*>(data[0].Variables[j]) );
+		  	
+			if ( dataType == 3 ) // DOUBLE
+			{
+				x.push_back( static_cast<float>(static_cast<double*>(data[1].Variables[j])[0]) );
+		  		y.push_back( static_cast<float>(static_cast<double*>(data[1].Variables[j])[1]) );
+		  		z.push_back( static_cast<float>(static_cast<double*>(data[1].Variables[j])[2]) );
+
+			}
+			else if ( dataType == 2 ) // FLOAT
+			{
+				
+				x.push_back( static_cast<float*>(data[1].Variables[j])[0] );
+		  		y.push_back( static_cast<float*>(data[1].Variables[j])[1] );
+		  		z.push_back( static_cast<float*>(data[1].Variables[j])[2] );
+
+			}
+			else
+			{
+				std::string ddGetDataTypeErr = "[ERROR] getOrbitData : failed to get data -> Unknown data type (not double nor float)";
+				throw std::string(ddGetDataTypeErr);	
+			}
+		}
+
+
+	} while (status == MOREDATA);
+	
+    DD_Close(id);
+}
+
+void getSymIndexData(string symIndexVi, string ddStart, string ddInterval,
+	string timeParameter, string symIndexParameter, 
+	vector<string>& symIndexTimeArray, vector<float>& symIndexArray)
+{
+	int id = DD_SetVariable( const_cast<char*>( symIndexVi.c_str() ) );
+
+	cout << "getSymIndexData id : "<< id << endl;
+
+    char *st = const_cast<char*>( ddStart.c_str() );
+
+    cout << "getSymIndexData st : "<< st << endl;
+
+	int error = DD_SetTime(id, st);
+
+	cout << "getSymIndexData error : "<< error << endl;
+
+	if (error < 0)
+	{
+		std::string ddSetTimeErr = "[ERROR] getSymIndexData : bad time pointer init in DD_SetTime -> err value : " +  error;
+		throw std::string(ddSetTimeErr);
+	}
+
+	char *params[2];
+	
+	params[0] = const_cast<char*>( timeParameter.c_str() );
+	params[1] = const_cast<char*>( symIndexParameter.c_str() );
+	
+	char *timeIntervall = const_cast<char*>( ddInterval.c_str() );
+
+	DD_data_t *data;
+
+	int status = 0;
+
+	do {
+
+		status = DD_GetMultiData(id, 2, static_cast<char**>(params), timeIntervall, &data, 1);
+		
+		if (status < 0)
+		{
+			std::string ddGetDataErr = "[ERROR] getSymIndexData : failed to get data -> status : " + status;
+			throw std::string(ddGetDataErr);
+		}
+
+		// 5 min to 1 min resampling
+		for (int j = 0; j < data->VarNumber; j+=5)
+		{
+			symIndexTimeArray.push_back( static_cast<char*>(data[0].Variables[j]) );
+		  	symIndexArray.push_back( static_cast<float*>(data[1].Variables[j])[0] );
+		}
+
+
+	} while (status == MOREDATA);
+	
+    DD_Close(id);
+}
\ No newline at end of file
diff --git a/src/makeFootprints.c b/src/makeFootprints.c
new file mode 100644
index 0000000..4437b57
--- /dev/null
+++ b/src/makeFootprints.c
@@ -0,0 +1,272 @@
+/************************************************************************************************
+    Name    :   makeFootprints
+    Author  :   Arnaud BIEGUN
+    Version :   2.0 (10/07/2015)
+    Brief   :   Computes geomagnetic field lines feet on a 
+                specified spherical surface
+*************************************************************************************************/
+
+/**************** HEADERS ******************/
+// C LIB
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+
+// CONSTANTS
+// #define PLASMA_FILENAME    "inputs.txt" 
+
+// FORTRAN BINDING
+extern void recalc_08_();
+extern void trace_08_(); 
+extern void t96_01_();  
+extern void geogsw_08_();
+extern void gswgse_08_(); 
+/**********END OF HEADERS ******************/ 
+ 
+int main(int argc,char *argv[])
+{
+  /****************** LOCAL VARIABLES ******************/
+  // TIME
+  int iyr, iday, ihour, min__, isec;
+
+    // SATELLITE
+  float sat_pos_GSE_X_i, sat_pos_GSE_Y_i, sat_pos_GSE_Z_i;
+  float sat_pos_GSW_X_i, sat_pos_GSW_Y_i, sat_pos_GSW_Z_i;
+
+    // PLASMA
+  float Pdyn_i, sym_h_i;
+  float V_GSE_X_i, V_GSE_Y_i, V_GSE_Z_i; 
+  float B_GSE_X_i, B_GSE_Y_i, B_GSE_Z_i;
+  float B_GSW_X_i, B_GSW_Y_i, B_GSW_Z_i;
+
+  // TSYGANENKO MODEL
+  float DIR, R0, RLIM, DSMAX;
+  float PSI;
+  float BT96_GSW_X, BT96_GSW_Y, BT96_GSW_Z;
+  float BT96_GSE_X, BT96_GSE_Y, BT96_GSE_Z;
+  float x_mgnp, y_mgnp, z_mgnp, vel_mgnp;
+  float DIST_MGNP;
+  float XX[2000], YY[2000], ZZ[2000], PARMOD[10];
+  float FP_GSW_X_i, FP_GSW_Y_i, FP_GSW_Z_i;
+  float FP_GEO_X_i, FP_GEO_Y_i, FP_GEO_Z_i;
+  float ERR;
+  int L, LMAX, IOPT, IMAP, ISWq = 0;
+  int ID_MGNP; // +1 : inside; -1 : outside
+
+  // RADIANS TO DEGREES
+  float SQ, R, PHI, THETA;
+
+  // OTHERS
+  FILE *plasma_file = NULL;
+  // FILE *fp_file     = NULL;
+  char line[1000];
+  char errMsg[256];
+  int SWFLAG_i;
+  int transform_flag; 
+  int i;
+  /****************** END OF LOCAL VARIABLES ******************/
+ 
+  /*********************CHECK I/O FILES **********************/
+  char* plasmaFilename = argv[1];
+  plasma_file = fopen(plasmaFilename, "r");
+  
+  if(plasma_file == NULL) 
+  {
+    exit(EXIT_FAILURE); 
+  } 
+  /****************** END OF CHECK I/O FILES ********************/
+
+  /****************** FOOTPRINTS COMPUTING ******************/
+  // T96 MODEL CONFIGURATION
+  R0    = 1.02;    // ~ 120 km // Inner boundary radii     
+  RLIM  = 50.0;    // Outter boundary radii
+  DSMAX = 0.5;     // Upper limit of the stepsize
+  LMAX  = 2000;    // Max number of field line points
+  ERR   = 0.0001;  // Permissible step error
+  IOPT  = 0;       // Model index
+  PSI   = -0.47;
+
+  // MAIN LOOP
+  while ( fgets(line, 1000, plasma_file) != NULL )
+  {
+      // GET VALUES FROM INPUT FILE
+      sscanf(line, 
+      // "%4d %3d %2d %2d %f %f %f %f %f %f %f %f %f %f %f %d", 
+        "%d %d %d %d %f %f %f %f %f %f %f %f %f %f %f %d", 
+      &iyr, &iday, &ihour, &min__,
+      &sat_pos_GSE_X_i, &sat_pos_GSE_Y_i, &sat_pos_GSE_Z_i, 
+      &B_GSE_X_i, &B_GSE_Y_i, &B_GSE_Z_i,
+      &V_GSE_X_i, &V_GSE_Y_i, &V_GSE_Z_i,
+      &Pdyn_i, &sym_h_i, 
+      &SWFLAG_i
+      );
+
+
+      // CONFIGURATION OF GEOMAGNETIC FIELD MODELS
+      recalc_08_(&iyr, &iday, &ihour, &min__, &isec, 
+                  &V_GSE_X_i, &V_GSE_Y_i, &V_GSE_Z_i);
+
+      printf("%d %d %d %d ", iyr, iday, ihour, min__);
+      // fprintf(fp_file, "%d %d %d %d ", iyr, iday, ihour, min__);
+
+
+      // GSE --> GSW ( GSM )
+      transform_flag = -1;
+
+      gswgse_08_(&sat_pos_GSW_X_i, 
+                  &sat_pos_GSW_Y_i, 
+                  &sat_pos_GSW_Z_i, 
+                  &sat_pos_GSE_X_i, 
+                  &sat_pos_GSE_Y_i, 
+                  &sat_pos_GSE_Z_i, 
+                  &transform_flag);
+
+      gswgse_08_(&B_GSW_X_i, &B_GSW_Y_i, &B_GSW_Z_i,
+                  &B_GSE_X_i, &B_GSE_Y_i, &B_GSE_Z_i, 
+                  &transform_flag);
+
+
+      // COMPUTES T96 GEOMAGNETIC FIELD MODEL
+      PARMOD[0] = Pdyn_i;
+      PARMOD[1] = sym_h_i;
+      PARMOD[2] = B_GSW_Y_i;
+      PARMOD[3] = B_GSW_Z_i;
+
+      t96_01_(&IOPT, PARMOD, &PSI, 
+              &sat_pos_GSW_X_i, 
+              &sat_pos_GSW_Y_i, 
+              &sat_pos_GSW_Z_i,
+              &BT96_GSW_X, &BT96_GSW_Y, &BT96_GSW_Z);
+
+
+      transform_flag = 1;
+
+      gswgse_08_(&BT96_GSW_X, &BT96_GSW_Y, &BT96_GSW_Z,
+                  &BT96_GSE_X, &BT96_GSE_Y, &BT96_GSE_Z,
+                  &transform_flag);
+
+      // IS IN MAGNETOPAUSE ?
+      vel_mgnp = -1.0; // We use dynamic pressure Pdyn
+
+      // shuetal_mgnp_08__(&Pdyn_i, &vel_mgnp, 
+      //                   &B_GSW_Z_i,
+      //                   &sat_pos_GSW_X_i, 
+      //                   &sat_pos_GSW_Y_i, 
+      //                   &sat_pos_GSW_Z_i,
+      //                   &x_mgnp, &y_mgnp, &z_mgnp,
+      //                   &DIST_MGNP, &ID_MGNP);
+
+      t96_mgnp_08_(&Pdyn_i, &vel_mgnp,
+                    &sat_pos_GSW_X_i, 
+                    &sat_pos_GSW_Y_i, 
+                    &sat_pos_GSW_Z_i,
+                    &x_mgnp, &y_mgnp, &z_mgnp,
+                    &DIST_MGNP, &ID_MGNP);
+
+
+      
+      // FOOTPRINTS -> STEP 1 : NORTH
+      DIR = -1.0; // Parallel to the total field vector
+
+      trace_08_(&sat_pos_GSW_X_i, 
+                &sat_pos_GSW_Y_i, 
+                &sat_pos_GSW_Z_i, 
+                &DIR, &DSMAX, &ERR,
+                &RLIM, &R0, &IOPT, PARMOD, 
+                &FP_GSW_X_i, &FP_GSW_Y_i, &FP_GSW_Z_i, 
+                XX, YY, ZZ, 
+                &L, &LMAX);
+ 
+      transform_flag = -1;
+      geogsw_08_(&FP_GEO_X_i, &FP_GEO_Y_i, &FP_GEO_Z_i, 
+                  &FP_GSW_X_i, &FP_GSW_Y_i, &FP_GSW_Z_i, 
+                  &transform_flag);
+          
+      SQ=FP_GEO_X_i*FP_GEO_X_i + FP_GEO_Y_i*FP_GEO_Y_i;
+      R=sqrt(SQ+FP_GEO_Z_i*FP_GEO_Z_i);  
+      SQ=sqrt(SQ);
+      PHI=atan2(FP_GEO_Y_i, FP_GEO_X_i);
+      THETA=atan2(FP_GEO_Z_i, SQ);
+      
+      if (PHI < 0.) 
+      {
+      	PHI += 2.*M_PI;
+      }
+
+      if ( (ID_MGNP > 0) && (R <= R0) ) {
+
+        printf("%.2f %.2f %.2f ", R, THETA*(180./M_PI), PHI*(180./M_PI));
+        // fprintf(fp_file, "%.2f %.2f %.2f ", R, THETA*(180./M_PI), PHI*(180./M_PI));
+  
+      } else {
+
+        printf("%.2f %.2f %.2f ", nanf(" "), nanf(" "), nanf(" "));
+      }
+  
+      
+
+      // FOOTPRINTS -> STEP 2 : SOUTH
+      DIR = 1.0; // Antiparallel to the total field vector
+
+      trace_08_(&sat_pos_GSW_X_i,
+                &sat_pos_GSW_Y_i,
+                &sat_pos_GSW_Z_i,
+                &DIR, &DSMAX, &ERR,
+                &RLIM, &R0, &IOPT, PARMOD,
+                &FP_GSW_X_i, &FP_GSW_Y_i, &FP_GSW_Z_i,
+                XX, YY, ZZ,
+                &L, &LMAX);
+
+      transform_flag = -1;
+      geogsw_08_(&FP_GEO_X_i, &FP_GEO_Y_i, &FP_GEO_Z_i,
+                  &FP_GSW_X_i, &FP_GSW_Y_i, &FP_GSW_Z_i,
+                  &transform_flag);
+
+   
+
+      SQ=FP_GEO_X_i*FP_GEO_X_i + FP_GEO_Y_i*FP_GEO_Y_i;
+      R=sqrt(SQ+FP_GEO_Z_i*FP_GEO_Z_i);  
+      SQ=sqrt(SQ);
+      PHI=atan2(FP_GEO_Y_i, FP_GEO_X_i);
+      THETA=atan2(FP_GEO_Z_i, SQ);
+
+      if (PHI < 0.)
+      {
+        PHI += 2.*M_PI;
+      }
+
+      if ( (ID_MGNP > 0) && (R <= R0) ) {
+
+        printf("%.2f %.2f %.2f ", R, THETA*(180./M_PI), PHI*(180./M_PI));
+        // fprintf(fp_file, "%.2f %.2f %.2f ", R, THETA*(180./M_PI), PHI*(180./M_PI));
+
+      } else {
+
+        printf("%.2f %.2f %.2f ", nanf(" "), nanf(" "), nanf(" "));
+      }
+
+      // Print SW flag index
+      printf("%d ", SWFLAG_i);
+      // fprintf(fp_file, "%d ", SWFLAG_i);
+
+      // Print distance to magnetopause
+      printf("%.2f ", DIST_MGNP*ID_MGNP);
+      // fprintf(fp_file, "%f ", DIST_MGNP*ID_MGNP);
+
+      // Print positions (GSE) and T96 output (GSE)
+      printf("%.2f %.2f %.2f ", sat_pos_GSE_X_i, sat_pos_GSE_Y_i, sat_pos_GSE_Z_i);
+      printf("%.2f %.2f %.2f\n", BT96_GSE_X, BT96_GSE_Y, BT96_GSE_Z);
+      // fprintf(fp_file, "%.2f %.2f %.2f ", sat_pos_GSE_X_i, sat_pos_GSE_Y_i, sat_pos_GSE_Z_i);
+      // fprintf(fp_file, "%.2f %.2f %.2f\n", BT96_GSE_X, BT96_GSE_Y, BT96_GSE_Z);
+  }
+  /****************** END OF FOOTPRINTS COMPUTING ******************/
+
+
+  /************************** FREE I/O FILES ***********************/
+  // fclose(fp_file);
+  fclose(plasma_file);
+  /********************* END OF FREE I/O FILES *********************/
+
+  return 0;    
+}
diff --git a/src/makeInputs.cpp b/src/makeInputs.cpp
new file mode 100644
index 0000000..fbd33b6
--- /dev/null
+++ b/src/makeInputs.cpp
@@ -0,0 +1,116 @@
+/////////////////
+// CPP HEADERS //
+/////////////////
+#include <iostream>
+#include <math.h> // isnan
+
+////////////
+/// BOOST //
+////////////
+#include <boost/lexical_cast.hpp>
+
+///////////
+// DDLIB //
+///////////
+#include "DD.h"
+
+//////////////////////////
+// FUNCTIONS PROTOTYPES //
+//////////////////////////
+#include "tools.h"
+
+
+
+///////////////
+// NAMESPACE //
+///////////////
+using namespace std;
+
+
+
+//////////
+// MAIN //
+//////////
+int main(int argc, char* argv[])
+{
+	// LOAD MISSION
+	if ( argc != 2 )
+	{
+		cout << "[ERROR] Usage : ./Inputs (XML_mission_file)" << endl;
+		exit(EXIT_FAILURE);
+	}
+
+	string missionXMLName = argv[1];
+	string missionXML = "../MISSIONS/" + missionXMLName;
+	string satelliteName, satelliteVi, satelliteOrbit, satelliteRes;
+	string plasmaName, plasmaVi, plasmaVNorm, plasmaRamP, plasmaVel, plasmaMag;
+	string indexName, indexVi, indexSym;
+	string start, stop;
+
+	loadMission(missionXML, satelliteName, satelliteVi, 
+				satelliteOrbit, satelliteRes,
+				plasmaName, plasmaVi, plasmaVNorm,
+				plasmaRamP, plasmaVel, plasmaMag,
+				indexName, indexVi, indexSym,
+				start, stop);
+	
+	string ddStart = toDDTime(start);
+	string ddStop = toDDTime(stop);
+	string ddInterval = makeDDIntervall(start, stop);
+
+	printMission(satelliteName, satelliteVi, 
+				satelliteOrbit, satelliteRes,
+				plasmaName, plasmaVi, plasmaVNorm, 
+				plasmaRamP, plasmaVel, plasmaMag,
+				indexName, indexVi, indexSym, 
+				start, stop, ddStart, ddStop, ddInterval);
+
+
+	// GET DATA
+	string timeParameter = "Time";
+
+	vector<string> plasmaTimeArray; 
+	vector<float> vnormArray,rampArray, vx, vy, vz, bx, by, bz;
+
+	getPlasmaData(plasmaVi, ddStart, ddInterval,
+	timeParameter, plasmaVNorm, plasmaRamP, plasmaVel, plasmaMag,
+	plasmaTimeArray, vnormArray, rampArray, vx, vy, vz, bx, by, bz);
+
+ 
+	vector<string> satelliteTimeArray;
+	vector<float> x, y, z;
+
+	getOrbitData(satelliteVi, satelliteRes, 
+	ddStart, ddInterval, timeParameter, satelliteOrbit, satelliteTimeArray, 
+	x, y, z);
+
+	vector<string> symIndexTimeArray;
+	vector<float> symIndexArray;
+
+	getSymIndexData(indexVi, ddStart, ddInterval, timeParameter, indexSym, 
+	symIndexTimeArray, symIndexArray);
+
+	int res = boost::lexical_cast<int>(satelliteRes);
+
+	if ( res > 300 )
+	{
+		// linearInterpolation(satelliteTimeArray, x, y, z);
+		
+		GTL_interp(x, y, z);
+	}
+
+	int n = plasmaTimeArray.size();
+
+	vector<int> flag(n, 1);
+
+	cleanData(n, rampArray, vnormArray, vx, vy, vz, bx, by, bz, 
+				symIndexArray, flag);
+
+	string filename = missionXMLName.erase( missionXMLName.rfind('.') );
+	filename = filename + ".txt";
+
+	writeInputsFile(filename, n, plasmaTimeArray, rampArray, vnormArray,
+					vx, vy, vz, bx, by, bz, x, y, z, symIndexArray, flag);
+
+	return 0;
+}
diff --git a/src/makeNcFile.c b/src/makeNcFile.c
new file mode 100644
index 0000000..f3ebb66
--- /dev/null
+++ b/src/makeNcFile.c
@@ -0,0 +1,443 @@
+/**********************************************************************************************
+    Name    :		makeNcFile.c
+    Author  :     	Arnaud BIEGUN
+    Version :     	1.0 (30/06/2015)
+    Brief   :    	Creates the NetCDF file from ASCII footprints file
+*************************************************************************************************/
+/**************** HEADERS ******************/
+// C lib
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include <time.h>
+
+// NETCDF lib
+#include <netcdf.h>
+
+// Other functions
+#include "ctools.h"  
+
+// CONSTANTS
+#define SAT_TIME_RES	 	 60
+#define PLASMA_TIME_RES	 	 300
+#define INDEX_TIME_RES	 	 60
+#define RE              	 6371.0
+#define TIME_DIM            "Time"
+#define TIMELEN_DIM         "TimeLength"
+#define VECTOR_DIM          "Vector"
+#define TIME_VAR            "Time"
+#define FPN_VAR       		"North"
+#define FPS_VAR       		"South"
+#define DISTMGNP_VAR 		"Dist_mgnp"
+#define SWFLAG_VAR 			"SW_flag"
+#define START_VAR           "StartTime"
+#define STOP_VAR            "StopTime"
+#define SOURCE              "T96 geomagnetic field model"
+#define FOOTPRINT_UNIT      "degrees, degrees"
+#define DISTMGNP_UNIT       "Re"
+#define TIME_STR_LEN        17
+/**********END OF HEADERS ******************/
+
+int main(int argc, char const *argv[])
+{
+	/**************** LOCAL VARIABLES ***********************/
+	// DATA
+	int iyr, iday, ihour, min__, isec;
+	float fpn_r_i, fpn_lat_i, fpn_lon_i;
+	float fps_r_i, fps_lat_i, fps_lon_i;
+	float satX_i, satY_i, satZ_i;
+	float BT96X_i, BT96Y_i, BT96Z_i;
+	float dist_mgnp_i;
+	int SWFLAG_i;
+	Footprint *fpArray = NULL;
+
+	// ID
+	int ncid, time_dimid, timelength_dimid, dataId;
+	int time_varid, fpn_varid, fps_varid, SWFLAG_varid, startTime_varid, stopTime_varid;
+	// int distmgnp_varid;
+	int time_tab_dimid[2], data_tab_dimid[2];
+
+	// BUFFERS
+	size_t start[2], timeCount[2], dataCount[2];
+
+	// TIME
+	char ncYear[4], ncDay[3], ncHour[2], ncMin[2], ncSec[2], ncMls[2];
+	char ncDate[17];
+	Date *dateArray  = NULL;
+	time_t p;
+	char *s;
+
+	// OTHERS
+	FILE *dataFile = NULL;
+	char line[1000], errMsg[256];
+	int retval, off, count, i;
+	/*************** END OF LOCAL VARIABLES ********************/
+
+
+	/*************** GET DATA FROM OUTPUT FILE *****************/
+	// Date dateArray[500];
+	count = 0;
+
+	const char* footprintsFilename = argv[1];
+
+	dataFile = fopen(footprintsFilename, "r");
+
+  	if ( dataFile != NULL )
+  	{
+  		
+	  	while ( fgets(line, 1000, dataFile) != NULL )
+	    {
+	        // GET VALUES FROM INPUT FILE
+	        sscanf(line, 
+					"%4d %3d %2d %2d %f %f %f %f %f %f %d %f %f %f %f %f %f %f", 
+					&iyr, &iday, &ihour, &min__,
+					&fpn_r_i, &fpn_lat_i, &fpn_lon_i, 
+					&fps_r_i, &fps_lat_i, &fps_lon_i,
+					&SWFLAG_i,
+					&dist_mgnp_i,
+					&satX_i, &satY_i, &satZ_i,
+					&BT96X_i, &BT96Y_i, &BT96Z_i
+					);
+
+	        fpArray = (Footprint*) realloc( fpArray, (count+1)*sizeof(Footprint) );
+
+			fpArray[count].geoCoordN[0] = fpn_lat_i;
+			fpArray[count].geoCoordN[1] = fpn_lon_i;
+			fpArray[count].geoCoordS[0] = fps_lat_i;
+			fpArray[count].geoCoordS[1] = fps_lon_i;
+			
+			fpArray[count].distmgnp     = dist_mgnp_i;
+
+			fpArray[count].SWFLAG       = SWFLAG_i;
+			    
+			// DATE : INT --> STR 
+			setDateStr(iyr, iday-1, ihour, min__, 0, 0,
+						ncYear, ncDay, ncHour, ncMin, ncSec, ncMls, ncDate); 
+
+			dateArray = (Date*) realloc( dateArray, (count+1)*sizeof(Date) );
+			
+			strcpy(dateArray[count].strDate, ncDate);
+
+
+			// printf("%s %f %f %f %f %f %f %f %f %f %f %f %f %f %d\n", 
+   //    		dateArray[count].strDate,
+   //    		fpn_r_i, fpArray[count].geoCoordN[0], fpArray[count].geoCoordN[1], 
+			// fps_r_i, fpArray[count].geoCoordS[0], fpArray[count].geoCoordS[1],
+			// fpArray[count].distmgnp,
+			// satX_i, satY_i, satZ_i,
+			// BT96X_i, BT96Y_i, BT96Z_i,
+			// SWFLAG_i);
+
+			count++;
+	        
+	    }
+
+	} else {
+
+		strcpy(errMsg, "[ERROR] : NC file --> Unable to read ");
+	  		
+	  	strcat(errMsg, footprintsFilename);
+
+		getError(errMsg);
+
+	    exit(EXIT_FAILURE);
+	}
+	/*************** END OF GET DATA FROM OUTPUT FILE *****************/
+
+
+	/************************  OPEN NC FILE *****************************/
+	const char* ncFilename = argv[2];
+
+	retval = nc_create(ncFilename, NC_CLOBBER, &ncid);
+
+	if (retval != NC_NOERR)
+	{
+		strcpy(errMsg, "[ERROR] : NC file --> Failed to create NC file ");
+		  		
+		strcat(errMsg, ncFilename);
+
+		getError(errMsg);
+
+		exit(EXIT_FAILURE);
+	} 
+	/************************** END OF OPEN NC FILE *********************/
+
+
+
+	/*************************** DEFINE MODE ****************************/
+	// DIMENSIONS
+	retval = nc_def_dim(ncid, TIME_DIM, NC_UNLIMITED, &time_dimid);
+	
+	if (retval != NC_NOERR)
+	{
+		getError("[ERROR] : NC file --> Failed to define time dimension");
+
+		exit(EXIT_FAILURE);
+	} 
+
+	retval = nc_def_dim(ncid, TIMELEN_DIM, TIME_STR_LEN, &timelength_dimid);
+	
+	if (retval != NC_NOERR)
+	{
+		getError("[ERROR] : NC file --> Failed to define time length dimension");
+
+		exit(EXIT_FAILURE);
+	} 
+	
+	retval = nc_def_dim(ncid, VECTOR_DIM, 2, &dataId);
+	
+	if (retval != NC_NOERR)
+	{
+		getError("[ERROR] : NC file --> Failed to define vector dimension");
+
+		exit(EXIT_FAILURE);
+	} 
+
+
+	// NETCDF VARIABLES
+	time_tab_dimid[0] = time_dimid;
+	time_tab_dimid[1] = timelength_dimid;
+	data_tab_dimid[0] = time_dimid;
+	data_tab_dimid[1] = dataId;
+
+	retval = nc_def_var(ncid, TIME_VAR, NC_CHAR, 2, time_tab_dimid, &time_varid);
+	
+	if (retval != NC_NOERR)
+	{
+		getError("[ERROR] : NC file --> Failed to define time variable");
+
+		exit(EXIT_FAILURE);
+	}
+	
+	retval = nc_def_var(ncid, FPN_VAR, NC_FLOAT, 2, data_tab_dimid, &fpn_varid);
+	
+	if (retval != NC_NOERR)
+	{
+		getError("[ERROR] : NC file --> Failed to define north footprints variable");
+
+		exit(EXIT_FAILURE);
+	} 
+
+	retval = nc_def_var(ncid, FPS_VAR, NC_FLOAT, 2, data_tab_dimid, &fps_varid);
+	
+	if (retval != NC_NOERR)
+	{
+		getError("[ERROR] : NC file --> Failed to define south footprints variable");
+
+		exit(EXIT_FAILURE);
+	} 
+
+	// retval = nc_def_var(ncid, DISTMGNP_VAR, NC_FLOAT, 1, &time_dimid, &distmgnp_varid);
+
+	// if (retval != NC_NOERR)
+	// {
+	// 	getError("[ERROR] : NC file --> Failed to define dist mgnp variable");
+
+	// 	exit(EXIT_FAILURE);
+	// }
+
+	retval = nc_def_var(ncid, SWFLAG_VAR, NC_INT, 1, &time_dimid, &SWFLAG_varid);
+
+	if (retval != NC_NOERR)
+	{
+		getError("[ERROR] : NC file --> Failed to define solar wind quality flag variable");
+
+		exit(EXIT_FAILURE);
+	}
+
+	retval = nc_def_var(ncid, START_VAR, NC_CHAR, 1, &timelength_dimid, &startTime_varid);
+	
+	if (retval != NC_NOERR)
+	{
+		getError("[ERROR] : NC file --> Failed to define start time variable");
+
+		exit(EXIT_FAILURE);
+	}
+	
+	retval = nc_def_var(ncid, STOP_VAR, NC_CHAR, 1, &timelength_dimid, &stopTime_varid);
+	
+	if (retval != NC_NOERR)
+	{
+		getError("[ERROR] : NC file --> Failed to define stop time variable");
+
+		exit(EXIT_FAILURE);
+	}
+
+	// UNITS
+	retval = nc_put_att_text(ncid, fpn_varid, "units", strlen(FOOTPRINT_UNIT), FOOTPRINT_UNIT);
+	
+	if (retval != NC_NOERR)
+	{
+		getError("[ERROR] : NC file --> Failed to define footprints unit attribute");
+
+		exit(EXIT_FAILURE);
+	}
+
+	retval = nc_put_att_text(ncid, fps_varid, "units", strlen(FOOTPRINT_UNIT), FOOTPRINT_UNIT);
+	
+	if (retval != NC_NOERR)
+	{
+		getError("[ERROR] : NC file --> Failed to define footprints unit attribute");
+
+		exit(EXIT_FAILURE);
+	}
+
+	// retval = nc_put_att_text(ncid, distmgnp_varid, "units", strlen(DISTMGNP_UNIT), DISTMGNP_UNIT);	
+
+	// if (retval != NC_NOERR)
+	// {
+	// 	getError("[ERROR] : NC file --> Failed to define dist mgnp unit attribute");
+
+	// 	exit(EXIT_FAILURE);
+	// }
+
+	// DATA SOURCE
+	retval = nc_put_att_text(ncid, NC_GLOBAL, "Source", strlen(SOURCE), SOURCE);
+	
+	if (retval != NC_NOERR)
+	{
+		getError("[ERROR] : NC file --> Failed to define data source attribute");
+
+		exit(EXIT_FAILURE);
+	}
+
+	// NC FILE CREATION DATE
+	time(&p);
+	s = ctime(&p);
+
+	retval = nc_put_att_text(ncid, NC_GLOBAL, "Created", 24, s);
+	
+	if (retval != NC_NOERR)
+	{
+		getError("[ERROR] : NC file --> Failed to define NC file creation date attribute");
+
+		exit(EXIT_FAILURE);
+	}
+
+
+	// CLOSE DEFINE MODE
+	retval = nc_enddef(ncid);
+	
+	if (retval != NC_NOERR)
+	{
+		getError("[ERROR] : NC file --> Failed to close define mode");
+
+		exit(EXIT_FAILURE);
+	}
+  	/*********************** END OF DEFINE MODE ****************************/
+
+
+	/************************ WRITING MODE ********************************/
+    // BUFFERS CONFIGURATION
+	timeCount[0] = 1;
+	timeCount[1] = TIME_STR_LEN;
+	dataCount[0] = 1;
+	dataCount[1] = 2;
+	start[1]     = 0;
+
+
+  	// WRITE DATA
+  	off = 0;
+
+	for (i = 0; i < count; i++)
+	{
+
+		start[0] = off;
+
+		retval = nc_put_vara_text(ncid, time_varid, 
+				 start, timeCount, dateArray[i].strDate);
+		
+		if (retval != NC_NOERR)
+		{
+		  	getError("[ERROR] : NC file --> Failed to write time variable");
+
+			exit(EXIT_FAILURE);
+		}
+
+		retval = nc_put_vara_float(ncid, fpn_varid, 
+				 start, dataCount, fpArray[i].geoCoordN);
+		
+		if (retval != NC_NOERR)
+		{
+		  	getError("[ERROR] : NC file --> Failed to write north footprints variable");
+
+			exit(EXIT_FAILURE);
+		}
+
+		retval = nc_put_vara_float(ncid, fps_varid, 
+				  start, dataCount, fpArray[i].geoCoordS);
+		
+		if (retval != NC_NOERR)
+		{
+		  	getError("[ERROR] : NC file --> Failed to write south footprints variable");
+
+			exit(EXIT_FAILURE);
+		}
+
+		// retval = nc_put_vara_float(ncid, distmgnp_varid, &start[0], 
+		// 		&dataCount[0], &fpArray[i].distmgnp);		 	
+
+		// if (retval != NC_NOERR)
+		// {
+		//   	getError("[ERROR] : NC file --> Failed to write dist mgnp variable");
+
+		// 	exit(EXIT_FAILURE);
+		// }
+
+		retval = nc_put_vara_int(ncid, SWFLAG_varid, &start[0], 
+				&dataCount[0], &fpArray[i].SWFLAG);		 	
+
+		if (retval != NC_NOERR)
+		{
+		  	getError("[ERROR] : NC file --> Failed to write solar wind variable");
+
+			exit(EXIT_FAILURE);
+		}
+
+		off++;
+	}
+
+
+	retval = nc_put_var_text(ncid, startTime_varid, dateArray[0].strDate);
+	
+	if (retval != NC_NOERR)
+	{
+		getError("[ERROR] : NC file --> Failed to write start time variable");
+
+		exit(EXIT_FAILURE);
+	}
+
+	retval = nc_put_var_text(ncid, stopTime_varid, dateArray[count-1].strDate);
+	
+	if (retval != NC_NOERR)
+	{
+		getError("[ERROR] : NC file --> Failed to write stop time variable");
+
+		exit(EXIT_FAILURE);
+	}
+  	/************************ END OF WRITING MODE ********************************/
+
+	/**************** CLOSE NC FILE ***********************/
+  	//Close the file
+	retval = nc_close(ncid);
+	
+	if (retval != NC_NOERR)
+	{
+		getError("[ERROR] : NC file --> Failed to close NC file");
+
+		exit(EXIT_FAILURE);
+	}
+  	/**************** END OF CLOSE NC FILE ***********************/
+
+	/*********************** FREE MEMORY ********************************/
+	free(dateArray);
+	free(fpArray);
+	/******************** END OF FREE MEMORY ****************************/
+
+	return 0;
+}
+
+
+
+
diff --git a/src/tools.cpp b/src/tools.cpp
new file mode 100644
index 0000000..829ca7d
--- /dev/null
+++ b/src/tools.cpp
@@ -0,0 +1,819 @@
+/////////////////
+// CPP HEADERS //
+/////////////////
+#include <iostream>
+#include <fstream>
+
+#include "math.h"
+
+////////////
+/// BOOST //
+////////////
+#include <boost/tokenizer.hpp>
+#include <boost/lexical_cast.hpp>
+#include <boost/regex.hpp>
+#include "boost/date_time/gregorian/gregorian.hpp"
+#include "boost/date_time/posix_time/posix_time.hpp"
+
+///////////////
+// TINYXML-2 //
+///////////////
+#include "tinyxml2.h"
+
+////////////
+/// DDLIB //
+////////////
+#include "DD.h"
+
+//////////
+/// GSL //
+//////////
+#include "gsl_spline.h"
+
+//////////////////////////
+// FUNCTIONS PROTOTYPES //
+//////////////////////////
+#include "tools.h"
+
+////////////////
+// NAMESPACES //
+///////////////
+using namespace std;
+using namespace tinyxml2;
+
+
+
+////////////////////////////
+/// FUNCTIONS DEFINITIONS //
+////////////////////////////
+
+/**
+ * @brief      Print mission features
+ *
+ * @param      satelliteName   Name of the satellite
+ * @param      satelliteVi     Virtual instrument's name of the satellite
+ * @param      satelliteOrbit  Name of the netCDF variable for the satellite
+ * @param 	   satelliteRes    Satellite orbit resolution
+ * @param      plasmaName      Name of the plasma dataset
+ * @param      plasmaVi        Virtual instrument's name of the plasma dataset
+ * @param      plasmaVNorm     Name of the netCDF variable for plasma dataset
+ * @param      plasmaRamP      Ram pressure parameter into the netCDF file
+ * @param      plasmaVel       Velocity parameter into the netCDF file
+ * @param      plasmaMag       Magnetic field parameter into the netCDF file
+ * @param      indexName       Name of the Sym H index
+ * @param      indexVi         Virtual instrument's name of the Sym H index
+ * @param      indexSym        Sym H index parameter into the netCDF file
+ * @param      start           Start time
+ * @param      stop            Stop time
+ * @param      ddStart         DD style start time
+ * @param      ddStop          DD style stop time
+ * @param      ddInterval      DD style time interval
+ */
+void printMission(string& satelliteName, string& satelliteVi, 
+				string& satelliteOrbit, string& satelliteRes,
+				string& plasmaName, string& plasmaVi, string& plasmaVNorm, 
+				string& plasmaRamP, string& plasmaVel, string& plasmaMag,
+				string& indexName, string& indexVi, string& indexSym, 
+				string& start, string& stop, string& ddStart, string& ddStop, string& ddInterval)
+{
+	cout << "********** MISSION ************" << endl;
+	cout << "Satellite name : " << satelliteName << endl;
+	cout << "Satellite VI : " << satelliteVi << endl;
+	cout << "Satellite orbit param : " << satelliteOrbit << endl;
+	cout << "Satellite orbit resolution : " << satelliteRes << endl;
+	cout << "Plasma name : " << plasmaName << endl;
+	cout << "Plasma VI : " << plasmaVi << endl;
+	cout << "Plasma V norm param : " << plasmaVNorm << endl;
+	cout << "Plasma ram pressure : " << plasmaRamP << endl;
+	cout << "Plasma velocity : " << plasmaVel << endl;
+	cout << "Plasma B mag : " << plasmaMag << endl;
+	cout << "Sym index name : " << indexName << endl;
+	cout << "Sym index VI : " << indexVi << endl;
+	cout << "Sym index param : " << indexSym << endl;
+	cout << "Start time : " << start << endl;
+	cout << "Stop time : " << stop << endl;
+	cout << "DD Start time : " << ddStart << endl;
+	cout << "DD Stop time : " << ddStop << endl;
+	cout << "DD Interval : " << ddInterval << endl;
+	cout << "********** END OF MISSION ************" << endl << endl;
+}
+
+
+
+/**
+ * @brief      Get mission parameters
+ *
+ * @param      filename        Name of the XML config file
+ * @param      satelliteName   Name of the satellite
+ * @param      satelliteVi     Virtual instrument's name for the satellite
+ * @param      satelliteOrbit  Name of the parameter into the netCDF file for the satellite's orbit
+ * @param      satelliteRes	   Time resolution for satellite orbit
+ * @param      plasmaName      Name of plasma dataset
+ * @param      plasmaVi        Virtual instrument's name for the plasma dataset
+ * @param      plasmaVNorm     Name of the parameter into the netCDF file for the plasma's velocity norm
+ * @param      plasmaRamP      Name of the parameter into the netCDF file for the plasma's ram pressure
+ * @param      plasmaVel       Name of the parameter into the netCDF file for the plasma's velocity vector
+ * @param      plasmaMag       Name of the parameter into the netCDF file for the plasma's magnetic field vector
+ * @param      indexName       Name of the Sym index
+ * @param      indexVi         Virtual instrument's name for the Sym index
+ * @param      indexSym        Name of the parameter into the netCDF file for the Sym index
+ * @param      start           Start time
+ * @param      stop            Stop time
+ */
+void loadMission(string& filename, 
+	string& satelliteName, string& satelliteVi, 
+	string& satelliteOrbit, string& satelliteRes,
+	string& plasmaName, string& plasmaVi, string& plasmaVNorm,
+	string& plasmaRamP, string& plasmaVel, string& plasmaMag,
+	string& indexName, string& indexVi, string& indexSym,
+	string& start, string& stop)
+{
+
+	// LOADING THE DOM
+	XMLDocument doc;
+	
+	if ( doc.LoadFile( filename.c_str() ) != 0 )
+	{
+		cout << "[ERROR] loadMission : Failed to load " << filename << endl;
+		
+		exit(EXIT_FAILURE);
+	}
+	
+
+	// GET PARAMETERS VALUES
+	XMLElement* pRoot = doc.FirstChildElement( "MISSION" );
+	
+	satelliteName              = pRoot->FirstChildElement( "SATELLITE" )->FirstChildElement( "NAME" )->GetText();
+	satelliteVi                = pRoot->FirstChildElement( "SATELLITE" )->FirstChildElement( "VI" )->GetText();
+	satelliteOrbit = pRoot->FirstChildElement( "SATELLITE" )->FirstChildElement( "ORBIT" )->GetText();
+	satelliteRes = pRoot->FirstChildElement( "SATELLITE" )->FirstChildElement( "RES" )->GetText();
+
+	plasmaName              = pRoot->FirstChildElement( "PLASMA" )->FirstChildElement( "NAME" )->GetText();
+	plasmaVi                = pRoot->FirstChildElement( "PLASMA" )->FirstChildElement( "VI" )->GetText();
+	plasmaVNorm = pRoot->FirstChildElement( "PLASMA" )->FirstChildElement( "VNORM" )->GetText();
+	plasmaRamP = pRoot->FirstChildElement( "PLASMA" )->FirstChildElement( "RAMP" )->GetText();
+	plasmaVel = pRoot->FirstChildElement( "PLASMA" )->FirstChildElement( "VEL" )->GetText();
+	plasmaMag = pRoot->FirstChildElement( "PLASMA" )->FirstChildElement( "MAG" )->GetText();
+
+	indexName = pRoot->FirstChildElement( "INDEX" )->FirstChildElement( "NAME" )->GetText();
+	indexVi = pRoot->FirstChildElement( "INDEX" )->FirstChildElement( "VI" )->GetText();
+	indexSym = pRoot->FirstChildElement( "INDEX" )->FirstChildElement( "SYM" )->GetText();
+
+	start             = pRoot->FirstChildElement( "START" )->GetText();
+	stop              = pRoot->FirstChildElement( "STOP" )->GetText();
+
+}
+
+
+/**
+ * @brief      Split date time into 2 parts : date and clock time
+ *
+ * @param[in]  strDate  Date to split
+ *
+ * @return     Array containing the splitted date : [0] -> Date / [1] -> Clock time
+ */
+vector<string> tokenizedDate(string strDate)
+{
+	vector<string> tDate;
+
+  	boost::char_separator<char> sep("T");
+	boost::tokenizer< boost::char_separator<char> > tok(strDate, sep); 
+  	boost::tokenizer< boost::char_separator<char> >::iterator tok_iter;
+  
+	for(tok_iter = tok.begin(); tok_iter != tok.end(); ++tok_iter)
+	{
+		tDate.push_back(*tok_iter);
+	}
+
+	// tDate[1] = tDate[1].substr(0, tDate[1].size()-1);
+
+  	return tDate;
+}
+
+
+/**
+ * @brief      Check if date is in good format : yyyy-mm-ddThh:mm:ss.mls (modify if a pattern is matched)
+ *
+ * @param      date  Date to check for
+ *
+ * @return     True : good format / False : bad format
+ */
+bool checkDateFormat(string& date)
+{
+	boost::regex regex0("^[0-9]{4}[-]{1}[0-9]{2}[-]{1}[0-9]{2}[T]{1}[0-9]{2}[:]{1}[0-9]{2}[:]{1}[0-9]{2}$");
+	boost::regex regex1("^[0-9]{4}[-]{1}[0-9]{2}[-]{1}[0-9]{2}[T]{1}[0-9]{2}[:]{1}[0-9]{2}[:]{1}[0-9]{2}[.]{1}[0-9]{3}$");
+    boost::regex regex2("^[0-9]{4}[-]{1}[0-9]{2}[-]{1}[0-9]{2}[T]{1}[0-9]{2}[:]{1}[0-9]{2}[:]{1}[0-9]{2}[.]{1}[0-9]{6}$");
+    boost::regex regex3("^[0-9]{4}[-]{1}[0-9]{2}[-]{1}[0-9]{2}[T]{1}[0-9]{2}[:]{1}[0-9]{2}[:]{1}[0-9]{2}[.]{1}[0-9]{9}$");
+    boost::regex regex4("^[0-9]{4}[-]{1}[0-9]{2}[-]{1}[0-9]{2}[T]{1}[0-9]{2}[:]{1}[0-9]{2}[:]{1}[0-9]{2}[.]{1}[0-9]{3}[Z]{1}$");
+    
+    bool match0 = boost::regex_match(date, regex0);
+    bool match1 = boost::regex_match(date, regex1);
+    bool match2 = boost::regex_match(date, regex2);
+    bool match3 = boost::regex_match(date, regex3);
+    bool match4 = boost::regex_match(date, regex4);
+
+    if (match0)
+    {
+    	date += ".000";
+    	return true; 
+    }
+    else if (match1)
+    {
+    	return true; 
+    }
+    else if (match2 || match3)
+    {
+    	date = date.substr(0, 23);
+    	return true; 
+    }
+    else if (match4)
+    {
+    	date = date.substr(0, date.size()-1);
+    	return true; 
+    }
+    else
+    {
+    	return false; 
+    }
+    
+}
+
+
+/**
+ * @brief      Date to DD date : yyyydoyhhmmssmls
+ *
+ * @param[in]  date  Date to transform
+ *
+ * @return     DD date
+ */
+string toDDTime(string date)
+{
+	if ( !checkDateFormat(date) )
+	{
+		string badDateFormatErr = "[ERROR] Tools::toDDTime -> Start time is bad formatted " + date + " : cannot build DD start time";
+      	throw std::string(badDateFormatErr);
+	} 
+
+	string dateTime  = (tokenizedDate(date))[0];
+	string clockTime = (tokenizedDate(date))[1];
+	string gregoDate = dateTime.substr(0, 4)+dateTime.substr(5, 2)+dateTime.substr(8, 2);
+    
+    boost::gregorian::date d( boost::gregorian::from_undelimited_string(gregoDate) );
+    string doy = boost::lexical_cast<std::string>( d.day_of_year()-1 ); 
+    
+    if ( doy.size() < 1 )
+    {
+    	throw std::string("[ERROR] Tools::toDDTime -> Failed to build day of year");
+    }
+    else if ( doy.size() < 2 )
+    {
+      doy = "00" + doy;
+    }
+    else if( doy.size() < 3 )
+    {
+      doy = "0" + doy;
+    }
+    else if ( doy.size() > 3 )
+    {
+    	throw std::string("[ERROR] Tools::toDDTime -> Failed to build day of year");
+    }
+    
+    string ddTime = dateTime.substr(0, 4)+doy+clockTime.substr(0, 2)+clockTime.substr(3, 2)+clockTime.substr(6, 2)+clockTime.substr(9);
+    
+	return ddTime;
+}
+
+
+/**
+ * @brief      Make DD style time intervall : yyyydoyhhmmssmls
+ *
+ * @param[in]  startTime  Start time
+ * @param[in]  stopTime   Stop time
+ *
+ * @return     DD style time intervall
+ */
+string makeDDIntervall(string startTime, string stopTime)
+{
+	if ( !(checkDateFormat(startTime) && checkDateFormat(stopTime)) )
+	{
+		string badBoundsErr = "[ERROR] makeDDIntervall -> Failed to build DD intervall because of bad time boundaries : " + startTime + " / " + stopTime;
+		throw std::string(badBoundsErr);
+	}
+
+	vector<string> startVec = tokenizedDate(startTime);
+	vector<string> stopVec = tokenizedDate(stopTime);
+
+	boost::posix_time::ptime ptStart(boost::posix_time::time_from_string(startVec[0]+ " " + startVec[1]));
+	boost::posix_time::ptime ptStop(boost::posix_time::time_from_string(stopVec[0]+ " " + stopVec[1]));
+	boost::posix_time::time_period tp(ptStart, ptStop);
+	
+	if ( tp.is_null() )
+	{
+		string badBoundsErr = "[ERROR] makeDDIntervall -> Failed to build DD intervall because of bad time boundaries : " + startTime + " / " + stopTime;
+		throw std::string(badBoundsErr);
+	}
+	
+	string days = boost::lexical_cast<string>( tp.length().hours()/24 );
+	string hours = boost::lexical_cast<string>( tp.length().hours()%24 );
+	string minutes = boost::lexical_cast<string>( tp.length().minutes() );
+	string seconds = boost::lexical_cast<string>( tp.length().seconds() );
+	string mls = boost::lexical_cast<string>( tp.length().fractional_seconds() );
+	
+	if ( days.size() < 2 )
+	{
+		days = "00" + days;
+	}
+	else if ( days.size() < 3 )
+	{
+		days = "0" + days;
+	}
+
+	if ( hours.size() < 2 )
+	{
+		hours = "0" + hours;
+	}
+
+	if ( minutes.size() < 2 )
+	{
+		minutes = "0" + minutes;
+	}
+
+	if ( seconds.size() < 2 )
+	{
+		seconds = "0" + seconds;
+	}
+
+	if ( mls.size() < 2 )
+	{
+		mls = "00" + mls;
+	}
+	else if ( mls.size() == 6 )
+	{
+		mls = mls.substr(0, 3);
+	}
+	else if ( mls.size() == 9 )
+	{
+		mls = mls.substr(0, 3);
+	}
+
+	string ddIntervall = "0000" + days + hours + minutes + seconds + mls;
+
+	return ddIntervall;
+}
+
+
+
+/**
+ * @brief      Get plasma data from DD base
+ *
+ * @param[in]  plasmaVi        Name of the VI into DD base
+ * @param[in]  ddStart         Start time DD time format
+ * @param[in]  ddInterval      Time interval DD time format
+ * @param[in]  timeParameter   Name of time parameter into NC file
+ * @param[in]  vnormParameter  Name of velocity norm parameter into NC file
+ * @param[in]  rampParameter   Name of ram pressure parameter into NC file
+ * @param[in]  velParameter    Name of velocity parameter into NC file
+ * @param[in]  magParameter    Name of magnetic field parameter into NC file
+ * @param      plasmaTimeArray Time array
+ * @param      vnormArray      Velocity norm array
+ * @param      rampArray       Ram pressure array
+ * @param      vxArray         Vx component of the velocity array
+ * @param      vyArray         Vy component of the velocity array
+ * @param      vzArray         Vz component of the velocity array
+ * @param      bxArray         Bx component of the velocity array
+ * @param      byArray         By component of the velocity array
+ * @param      bzArray         Bz component of the velocity array
+ */
+void getPlasmaData(string plasmaVi, string ddStart, string ddInterval,
+	string timeParameter, string vnormParameter, string rampParameter,
+	string velParameter, string magParameter,
+	vector<string>& plasmaTimeArray, vector<float>& vnormArray,
+	vector<float>& rampArray, 
+	vector<float>& vxArray, vector<float>& vyArray, vector<float>& vzArray,
+	vector<float>& bxArray, vector<float>& byArray, vector<float>& bzArray)
+{
+	int id = DD_SetVariable( const_cast<char*>( plasmaVi.c_str() ) );
+
+	char *st = const_cast<char*>( ddStart.c_str() );
+
+	int error = DD_SetTime(id, st);
+
+	if (error < 0)
+	{
+		std::string ddSetTimeErr = "[ERROR] getPlasmaData : bad time pointer init in DD_SetTime -> err value : " +  error;
+		throw std::string(ddSetTimeErr);
+	}
+
+	// GET DATA
+	char *params[5];
+	
+	params[0] = const_cast<char*>( timeParameter.c_str() );
+	params[1] = const_cast<char*>( vnormParameter.c_str() );
+	params[2] = const_cast<char*>( rampParameter.c_str() );
+	params[3] = const_cast<char*>( velParameter.c_str() );
+	params[4] = const_cast<char*>( magParameter.c_str() );
+	
+	char *timeIntervall = const_cast<char*>( ddInterval.c_str() );
+	
+	DD_data_t *data;
+
+	int status = 0;
+
+	do {
+
+		status = DD_GetMultiData(id, 5, static_cast<char**>(params), timeIntervall, &data, 1);
+		
+		if (status < 0)
+		{
+			std::string ddGetDataErr = "[ERROR] getPlasmaData : failed to get data -> status : " + status;
+			throw std::string(ddGetDataErr);
+		}
+
+		for (int j = 0; j < data->VarNumber; ++j)
+		{
+			plasmaTimeArray.push_back( static_cast<char*>(data[0].Variables[j]) );
+		  	vnormArray.push_back( *(static_cast<float*>(data[1].Variables[j])) );
+			rampArray.push_back( *(static_cast<float*>(data[2].Variables[j])) );
+			vxArray.push_back( static_cast<float*>(data[3].Variables[j])[0] );
+		  	vyArray.push_back( static_cast<float*>(data[3].Variables[j])[1] );
+		  	vzArray.push_back( static_cast<float*>(data[3].Variables[j])[2] );
+		  	bxArray.push_back( static_cast<float*>(data[4].Variables[j])[0] );
+		  	byArray.push_back( static_cast<float*>(data[4].Variables[j])[1] );
+		  	bzArray.push_back( static_cast<float*>(data[4].Variables[j])[2] );
+
+		}
+
+
+	} while (status == MOREDATA);
+	
+    DD_Close(id);
+}
+
+
+/**
+ * @brief      Get orbit data from DD base
+ *
+ * @param[in]  orbitVi         Name of the VI into DD base
+ * @param[in]  orbitRes        Resolution of the satellite orbit
+ * @param[in]  ddStart         Start time DD time format
+ * @param[in]  ddInterval      Time interval DD time format
+ * @param[in]  timeParameter   Name of time parameter into NC file
+ * @param[in]  orbitParameter  Name of orbit parameter into NC file
+ * @param      orbitArray      Time array
+ * @param      x               X component array
+ * @param      y               Y component array
+ * @param      z               Z component array
+ */
+void getOrbitData(string satelliteVi, string orbitRes,
+	string ddStart, string ddInterval,
+	string timeParameter, string orbitParameter, 
+	vector<string>& satelliteTimeArray,
+	vector<float>& x, vector<float>& y, vector<float>& z)
+{
+	int id = DD_SetVariable( const_cast<char*>( satelliteVi.c_str() ) );
+
+    char *st = const_cast<char*>( ddStart.c_str() );
+
+	int error = DD_SetTime(id, st);
+
+	if (error < 0)
+	{
+		std::string ddSetTimeErr = "[ERROR] getOrbitData : bad time pointer init in DD_SetTime -> err value : " +  error;
+		throw std::string(ddSetTimeErr);
+	}
+
+	char *params[2];
+	
+	params[0] = const_cast<char*>( timeParameter.c_str() );
+	params[1] = const_cast<char*>( orbitParameter.c_str() );
+	
+	char *timeIntervall = const_cast<char*>( ddInterval.c_str() );
+
+	DD_data_t *data;
+
+	int status = 0;
+
+	do {
+
+		status = DD_GetMultiData(id, 2, static_cast<char**>(params), timeIntervall, &data, 1);
+		
+		if (status < 0)
+		{
+			std::string ddGetDataErr = "[ERROR] getOrbitData : failed to get data -> status : " + status;
+			throw std::string(ddGetDataErr);
+		}
+
+		int intOrbitStep = static_cast<int>( boost::lexical_cast<int>(orbitRes) );
+		int samplingStep;
+
+		if ( intOrbitStep < 300 )
+		{	
+			// Resampling to 5min resolution for resolution strictly superior to 300s
+			// samplingStep = intOrbitStep/60;
+			samplingStep = static_cast<int>( 300/intOrbitStep );
+
+		} else {
+			// Else : interpolation to do ...
+			samplingStep = 1;
+		}
+
+		int dataType = data[1].type;
+		
+		for (int j = 0; j < data->VarNumber; j+=samplingStep)	
+		{
+			satelliteTimeArray.push_back( static_cast<char*>(data[0].Variables[j]) );
+		  	
+			if ( dataType == 3 ) // DOUBLE
+			{
+				x.push_back( static_cast<float>(static_cast<double*>(data[1].Variables[j])[0]) );
+		  		y.push_back( static_cast<float>(static_cast<double*>(data[1].Variables[j])[1]) );
+		  		z.push_back( static_cast<float>(static_cast<double*>(data[1].Variables[j])[2]) );
+
+			}
+			else if ( dataType == 2 ) // FLOAT
+			{
+				
+				x.push_back( static_cast<float*>(data[1].Variables[j])[0] );
+		  		y.push_back( static_cast<float*>(data[1].Variables[j])[1] );
+		  		z.push_back( static_cast<float*>(data[1].Variables[j])[2] );
+
+			}
+			else
+			{
+				std::string ddGetDataTypeErr = "[ERROR] getOrbitData : failed to get data -> Unknown data type (not double nor float)";
+				throw std::string(ddGetDataTypeErr);	
+			}
+		}
+
+
+	} while (status == MOREDATA);
+	
+    DD_Close(id);
+}
+
+
+/**
+ * @brief      Get Sym H index data from DD base
+ *
+ * @param[in]  symIndexVi         Name of the VI into DD base
+ * @param[in]  ddStart            Start time DD time format
+ * @param[in]  ddInterval         Time interval DD time format
+ * @param[in]  timeParameter      Name of time parameter into NC file
+ * @param[in]  symIndexParameter  Name of Sym H index parameter into NC file
+ * @param      symIndexTimeArray  Time array
+ * @param      symIndexArray      Sym H index array
+ */
+void getSymIndexData(string symIndexVi, string ddStart, string ddInterval,
+	string timeParameter, string symIndexParameter, 
+	vector<string>& symIndexTimeArray, vector<float>& symIndexArray)
+{
+	int id = DD_SetVariable( const_cast<char*>( symIndexVi.c_str() ) );
+
+    char *st = const_cast<char*>( ddStart.c_str() );
+
+	int error = DD_SetTime(id, st);
+
+	if (error < 0)
+	{
+		std::string ddSetTimeErr = "[ERROR] getSymIndexData : bad time pointer init in DD_SetTime -> err value : " +  error;
+		throw std::string(ddSetTimeErr);
+	}
+
+	char *params[2];
+	
+	params[0] = const_cast<char*>( timeParameter.c_str() );
+	params[1] = const_cast<char*>( symIndexParameter.c_str() );
+	
+	char *timeIntervall = const_cast<char*>( ddInterval.c_str() );
+
+	DD_data_t *data;
+
+	int status = 0;
+
+	do {
+
+		status = DD_GetMultiData(id, 2, static_cast<char**>(params), timeIntervall, &data, 1);
+		
+		if (status < 0)
+		{
+			std::string ddGetDataErr = "[ERROR] getSymIndexData : failed to get data -> status : " + status;
+			throw std::string(ddGetDataErr);
+		}
+
+		// 5 min to 1 min resampling
+		for (int j = 0; j < data->VarNumber; j+=5)
+		{
+			symIndexTimeArray.push_back( static_cast<char*>(data[0].Variables[j]) );
+		  	symIndexArray.push_back( static_cast<float*>(data[1].Variables[j])[0] );
+		}
+
+
+	} while (status == MOREDATA);
+	
+    DD_Close(id);
+}
+
+
+/**
+ * @brief      Remove NAN values
+ *
+ * @param      n              Size of arrays
+ * @param      rampArray      Ram pressure array
+ * @param      vnormArray     Velocity norm array
+ * @param      vx             Vx component array
+ * @param      vy             Vy component array
+ * @param      vz             Vz component array
+ * @param      bx             Bx component array
+ * @param      by             By component array
+ * @param      bz             Bz component array
+ * @param      symIndexArray  Sym H index array
+ * @param      flag           Quality flag array
+ */
+void cleanData(int& n, vector<float>& rampArray, vector<float>& vnormArray,
+				vector<float>& vx, vector<float>& vy, vector<float>& vz,
+				vector<float>& bx, vector<float>& by, vector<float>& bz,
+				vector<float>& symIndexArray, vector<int>& flag)		
+{
+	for (int i = 0; i < n; ++i)
+	{
+		// No value for plasma data
+		if ( isnan(rampArray[i]) )
+		{
+			rampArray[i] = 1.5;
+			vnormArray[i] = 500.0;
+			vx[i] = -500.0;
+			vy[i] = -29.78;
+			// vy[i] = 0.0;
+			vz[i] = 0.0;
+
+			flag[i] = -1;
+		}
+
+		// No value for magnetic field data
+		if ( isnan(by[i]) )
+		{
+			bx[i] = 0.0;
+	  		by[i] = 0.0;
+	  		bz[i] = 1.0;
+
+	  		flag[i] = -1;
+		}
+
+		// No value for Sym H index data
+		if ( isnan(symIndexArray[i]) )
+		{
+			symIndexArray[i] = -10.0;
+
+			flag[i] = -1;
+		}
+	}
+}
+
+void writeInputsFile(string& filename, int& size, 
+					vector<string>& plasmaTimeArray,
+					vector<float>& rampArray, vector<float>& vnormArray,
+					vector<float>& vx, vector<float>& vy, vector<float>& vz,
+					vector<float>& bx, vector<float>& by, vector<float>& bz,
+					vector<float>& x, vector<float>& y, vector<float>& z,
+					vector<float>& symIndexArray, 
+					vector<int>& flag)
+{
+	ofstream inFile(filename.c_str(), ios::out | ios::trunc);
+
+	string year, day, hour, minute;
+
+    if(inFile)
+    {
+    	for (int i = 0; i < size; ++i)
+		{
+			year = plasmaTimeArray[i].substr(0, 4);
+			day = plasmaTimeArray[i].substr(4, 3);
+			hour = plasmaTimeArray[i].substr(7, 2);
+			minute = plasmaTimeArray[i].substr(9, 2);
+			
+			int yearInt = boost::lexical_cast<int>(year);
+
+			int dayInt = boost::lexical_cast<int>(day);
+			dayInt++;
+
+			int hourInt = boost::lexical_cast<int>(hour);
+
+			int minuteInt = boost::lexical_cast<int>(minute);
+
+			inFile << yearInt << " " 
+					<< dayInt << " " 
+					<< hourInt << " " 
+					<< minuteInt << " "
+					<< x[i] << " " << y[i] << " " << z[i] << " "
+					<< bx[i] << " " << by[i] << " " << bz[i] << " "
+					<< vx[i] << " " << vy[i] + 29.78 << " " << vz[i] << " "
+					// << vx[i] << " " << vy[i] << " " << vz[i] << " "
+					<< rampArray[i] << " "
+					<< symIndexArray[i] << " "
+					<< flag[i]
+					<< endl;
+		}
+
+		inFile.close();
+    }
+}
+
+
+
+
+/**
+ * @brief      Linear interpolation for satellite orbit data
+ *
+ * @param[in]  satTime  Time array of the satellite
+ * @param      x        X component array
+ * @param      y        Y component array
+ * @param      z        Z component array
+ */
+void linearInterpolation(vector<string> satTime,  
+						vector<float>& x, vector<float>& y, vector<float>& z)
+{
+	int n = satTime.size();
+	double *p_t = new double[n];
+	double *p_x = new double[n];
+	double *p_y = new double[n];
+	double *p_z = new double[n];
+
+	for (int i = 0; i < n; ++i)
+	{
+		p_t[i] = boost::lexical_cast<double>(satTime[i]);
+		p_x[i] = boost::lexical_cast<double>(x[i]);
+		p_y[i] = boost::lexical_cast<double>(y[i]);
+		p_z[i] = boost::lexical_cast<double>(z[i]);
+	}
+
+    gsl_interp *interpolation = gsl_interp_alloc (gsl_interp_linear, n);
+
+   	gsl_interp_init(interpolation, p_t, p_x, n);
+    gsl_interp_init(interpolation, p_t, p_y, n);
+    gsl_interp_init(interpolation, p_t, p_z, n);
+
+    gsl_interp_accel * accelerator =  gsl_interp_accel_alloc();
+
+	double startTime = p_t[0];
+	double stopTime  = p_t[n-1];
+	double step      = 300;
+
+	vector<float> newX;
+	vector<float> newY;
+	vector<float> newZ;
+	double nx, ny, nz;
+
+    for (double ti = startTime; ti < stopTime; ti += step)
+    {
+    	nx = gsl_interp_eval(interpolation, p_t, p_x, ti, accelerator);
+    	ny = gsl_interp_eval(interpolation, p_t, p_y, ti, accelerator);
+    	nz = gsl_interp_eval(interpolation, p_t, p_z, ti, accelerator);
+    	
+    	newX.push_back( boost::lexical_cast<float>(nx) );
+    	newY.push_back( boost::lexical_cast<float>(ny) );
+    	newZ.push_back( boost::lexical_cast<float>(nz) );
+    }
+    
+	x = newX;
+	y = newY;
+	z = newZ;
+
+    delete p_t;
+    delete p_x;
+    delete p_y;
+    delete p_z;
+
+    gsl_interp_free(interpolation);
+    gsl_interp_accel_free(accelerator);
+    
+}
+
+
+/**
+ * @brief      Bad looking tool to add new data for Geotail orbit (x2)
+ *
+ * @param      x     X component array
+ * @param      y     Y component array
+ * @param      z     Z component array
+ */
+void GTL_interp(vector<float>& x, vector<float>& y, vector<float>& z)
+{
+	vector<float> newX, newY, newZ;
+	int size = x.size();
+
+	for (int i = 0; i < size; ++i)
+	{
+		newX.push_back(x[i]);
+		newX.push_back(x[i]);
+
+		newY.push_back(y[i]);
+		newY.push_back(y[i]);
+
+		newZ.push_back(z[i]);
+		newZ.push_back(z[i]);
+	}
+
+	x = newX;
+	y = newY;
+	z = newZ;
+}
\ No newline at end of file
diff --git a/src/tools.h b/src/tools.h
new file mode 100644
index 0000000..976514d
--- /dev/null
+++ b/src/tools.h
@@ -0,0 +1,66 @@
+#ifndef TOOLS_H_INCLUDED
+#define TOOLS_H_INCLUDED
+
+////////////////
+// CPP HEADER //
+////////////////
+#include <string>
+#include <vector>
+
+
+/////////////////////////
+// FUNCTION PROTOTYPES //
+/////////////////////////
+void printMission(std::string& satelliteName, std::string& satelliteVi, 
+std::string& satelliteOrbit, std::string& satelliteRes,
+std::string& plasmaName, std::string& plasmaVi, std::string& plasmaVNorm, 
+std::string& plasmaRamP, std::string& plasmaVel, std::string& plasmaMag,
+std::string& indexName, std::string& indexVi, std::string& indexSym, 
+std::string& start, std::string& stop, 
+std::string& ddStart, std::string& ddStop, std::string& ddInterval);
+void loadMission(std::string& filename, 
+	std::string& satelliteName, std::string& satelliteVi, 
+	std::string& satelliteOrbit, std::string& satelliteRes,
+	std::string& plasmaName, std::string& plasmaVi, std::string& plasmaVNorm,
+	std::string& plasmaRamP, std::string& plasmaVel, std::string& plasmaMag,
+	std::string& indexName, std::string& indexVi, std::string& indexSym,
+	std::string& start, std::string& stop);
+std::vector<std::string> tokenizedDate(std::string strDate);
+bool checkDateFormat(std::string& date);
+std::string toDDTime(std::string date);
+std::string makeDDIntervall(std::string startTime, std::string stopTime);
+void getPlasmaData(std::string plasmaVi, std::string ddStart, std::string ddInterval,
+	std::string timeParameter, std::string vnormParameter, std::string rampParameter,
+	std::string velParameter, std::string magParameter,
+	std::vector<std::string>& plasmaTimeArray, std::vector<float>& vnormArray, std::vector<float>& rampArray, 
+	std::vector<float>& vxArray, std::vector<float>& vyArray, std::vector<float>& vzArray,
+	std::vector<float>& bxArray, std::vector<float>& byArray, std::vector<float>& bzArray);
+void getOrbitData(std::string satelliteVi, std::string orbitRes,
+	std::string ddStart, std::string ddInterval,
+	std::string timeParameter, std::string orbitParameter, 
+	std::vector<std::string>& satelliteTimeArray,
+	std::vector<float>& x, std::vector<float>& y, std::vector<float>& z);
+void getSymIndexData(std::string symIndexVi, std::string ddStart, std::string ddInterval,
+	std::string timeParameter, std::string symIndexParameter, 
+	std::vector<std::string>& symIndexTimeArray, std::vector<float>& symIndexArray);
+void cleanData(int& n, std::vector<float>& rampArray, std::vector<float>& vnormArray,
+				std::vector<float>& vx, std::vector<float>& vy, std::vector<float>& vz,
+				std::vector<float>& bx, std::vector<float>& by, std::vector<float>& bz,
+				std::vector<float>& symIndexArray, std::vector<int>& flag);
+
+void writeInputsFile(std::string& filename, int& size, 
+					std::vector<std::string>& plasmaTimeArray, 
+					std::vector<float>& rampArray, std::vector<float>& vnormArray,
+					std::vector<float>& vx, std::vector<float>& vy, std::vector<float>& vz,
+					std::vector<float>& bx, std::vector<float>& by, std::vector<float>& bz,
+					std::vector<float>& x, std::vector<float>& y, std::vector<float>& z,
+					std::vector<float>& symIndexArray, 
+					std::vector<int>& flag);
+
+
+void linearInterpolation(std::vector<std::string> satTime,  
+						std::vector<float>& x, std::vector<float>& y, std::vector<float>& z);
+
+void GTL_interp(std::vector<float>& x, std::vector<float>& y, std::vector<float>& z);
+
+#endif
\ No newline at end of file
--
libgit2 0.21.2