%
% DESCRIPTION: Program to create the gravity monitoring GDF file in the Matlab format.
%
% [TimeZone] and [Description] have text format so the values give in ''


clear;clc;
[FormatName] = 'GDF';
[FormatVersion] = 2.1;
[CRS] = 'EPSG:4326';%['EPSG:' num2str(input('[CRS] EPSG code (just number) = '))];
[TimeZone] = 'UTC' %input('TimeZone (char) = ');
[Description] = 'Description of dataset'; %input('Description of data (char) = ');

[FieldDescription] = {
    'Name','Profile name of gravity measurement'
    'Lat','Latitude of station/measurement point'
    'Long','Longitude of station/measurement point'
    'Residual_gravity_anomaly','Residual gravity anomaly'
    'Bouger_gravity','Bouger gravity'
    'Station_codename','Code name of the station/measurement point'

    };
[FieldType] = {
    'Name',3
    'Lat',124
    'Long',134
    'Residual_gravity_anomaly',13
    'Bouger_gravity',13
    'Station_codename',3

    };
[FieldUnit] = {
    'Name','char'
    'Lat','deg'
    'Long','deg'
    'Residual_gravity_anomaly','mGal'
    'Bouger_gravity','mGal'
    'Station_codename','char'

    };
[d] = struct();



k=1
d(k).Name='2002';
d(k).Lat=[53.2758;53.2760;53.2762;53.2764;53.2766];
d(k).Long=[-2.4951;-2.4957;-2.4962;-2.4967;-2.4972];
d(k).Residual_gravity_anomaly=[0.0629;0.0208;0.0242;-0.0055;0.0042];
d(k).Bouger_gravity=[1;2;3;4;5];
d(k).Station_codename={'codename1';'codename2';'codename3';'codename4';'codename5'};


k=2
d(k).Name='2003';
d(k).Lat=[53.2758;53.2759;53.2759;53.2760;53.2760];
d(k).Long=[-2.4952;-2.4953;-2.4955;-2.4956;-2.4957];
d(k).Residual_gravity_anomaly=[0.1493;0.1363;0.1129;0.1132;0.0937];
d(k).Bouger_gravity=[1;2;3;4;5];
d(k).Station_codename={'codename1';'codename2';'codename3';'codename4';'codename5'};


k=3
d(k).Name='2004';
d(k).Lat=[53.2757;53.2757;53.2758;53.2758;53.2758];
d(k).Long=[-2.4947;-2.4948;-2.4950;-2.4951;-2.4952];
d(k).Residual_gravity_anomaly=[0.0798;0.0791;0.0660;0.0573;0.0448];
d(k).Bouger_gravity=[1;2;3;4;5];
d(k).Station_codename={'codename1';'codename2';'codename3';'codename4';'codename5'};


k=4
d(k).Name='2006';
d(k).Lat=[53.2760;53.2762;53.2764;53.2766;53.2768];
d(k).Long=[-2.4957;-2.4962;-2.4967;-2.4972;-2.4976];
d(k).Residual_gravity_anomaly=[-0.0498;-0.0372;-0.0435;-0.0168;-0.0107];
d(k).Bouger_gravity=[1;2;3;4;5];
d(k).Station_codename={'codename1';'codename2';'codename3';'codename4';'codename5'};

clear k 
save('GDF_EpisodeName_Gravity_monitoring_example.mat')
