%
% ver 1  05/2016 within SHEER project.
%
% DESCRIPTION: Program to create the empty MDDF file in the Matlab format.
% 
% [TimeZone] and [Description] have text format so the values give in ''


clear;clc;
[FormatName] = 'MDDF';
[FormatVersion] = 1.0;
[CRS] = ['EPSG:' num2str(input('[CRS] EPSG code = '))];
[TimeZone] = input('TimeZone (char) = ');
[Description] = input('Description of data (char) = ');
         
[dDescription] = {
             'Station_codename', 'Code name of the station'
             'Mesurements', ['Number of measurements or sample collection ', ...
              'in the field. Structure containinng the following fields:', ...
              ' Date,',...
              ' Tests,',...
              %' Stage',...
              %' Measurement_method',...
              ]
              
                'Measurements.Date', 'Time of sample collection'    % sample collection/measured parameter
                'Measurements.Tests', ['Number of test performed. ', ... % test performed/measured parameter
                'Structure containing the following fields: ', ...
                ' Test_name_id,',...
                ' Result,',...
                %' Result_duplicate', 'Quality assurance check'
              ] 
                          
                    'Measurements.Tests.Test_name_id', 'Id of test' % test/measured parameter
                    'Measurements.Tests.Result', 'Result of test' % test/measured parameter
                    %'Measurements.Tests.Result_duplicate', 'Quality assurance check'
             
                %'Measurements.Stage', 'Stage of monitoring'
                %'Measurements.Measurement_method', 'Method of measurement'
             };
         
[TestParametersDescription] = {
             'Test_name', 'Name of test' % test/measured parameter
             'Unit', 'Unit of test' % test/measured parameter
             'Type', 'Data type number'
             
             %'Technique', 'Technique'
             %'LOD', 'Limit of detection'
             %'LODType', 'Data type number of LOD'
             %'Accreditation', 'Accreditation body'
             };

[d] = struct();
    d.Station_codename = char;
    d.Measurements = struct();
        d.Measurements.Date = [];
        d.Measurements.Tests = struct();
            d.Measurements.Tests.Test_name_id = [];
            d.Measurements.Tests.Result = [];
            %d.Measurements.Tests.Result_duplicate = [];
        %d.Measurements.Stage = char;
        %d.Measurements.Measurement_method = char;
         
[TestParameters] = struct();  
    TestParameters.Test_name = char;
    TestParameters.Unit = char;
    TestParameters.Type = [];
    %TestParameters.Technique = char;
    %TestParameters.LOD = [];
    %TestParameters.LODType = [];
    %TestParameters.Accreditation = char;
         
         
save('-v6','MDDF_empty.mat')