%
% DESCRIPTION: Program to create the Water Stations Position 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] = 'n/a'%['EPSG:' num2str(input('[CRS] EPSG code (just number) = '))];
[TimeZone] = 'UTC' %input('TimeZone (char) = ');
[Description] = 'Description of the dataset' %input('Description of data (char) = ');

[FieldDescription] = {
    'Station_codename','Code name of the station'
    'Lat','Latitude of the station'
    'Long','Longitude of the station'
    'Depth','Depth of the station'
    
    'Description','Description of the station'
    'Elevation','Elevation of the station'
    'Sensor_type','Type of the sensor'
    'Sample_rate','Sample rate'
    'Parameter_unit','Unit of the parameter'
    'Start','Start time of data recording'
    'End','End time of data recording'
    };
[FieldType] = {
    'Station_codename',3
    'Lat',124
    'Long',134
    'Depth',114
    
    'Description',3
    'Elevation',4
    'Sensor_type',3
    'Sample_rate',3
    'Parameter_unit',3
    'Start',5
    'End',5
    };
[FieldUnit] = {
    'Station_codename','char'
    'Lat','deg'
    'Long','deg'
    'Depth','km'
    
    'Description','char'
    'Elevation','m'
    'Sensor_type','char'
    'Sample_rate','char'
    'Parameter_unit','char'
    'Start','datenum'
    'End','datenum'
    };
[d] = struct();



k=1
d(k).Station_codename=[];
d(k).Lat=[];
d(k).Long=[];
d(k).Depth=[];

d(k).Description=[];
d(k).Elevation=[];
d(k).Sensor_type=[];
d(k).Sample_rate=[];
d(k).Parameter_unit=[];
d(k).Start=[];
d(k).End=[];


k=2
d(k).Station_codename=[];
d(k).Lat=[];
d(k).Long=[];
d(k).Depth=[];

d(k).Description=[];
d(k).Elevation=[];
d(k).Sensor_type=[];
d(k).Sample_rate=[];
d(k).Parameter_unit=[];
d(k).Start=[];
d(k).End=[];

k=3
d(k).Station_codename=[];
d(k).Lat=[];
d(k).Long=[];
d(k).Depth=[];

d(k).Description=[];
d(k).Elevation=[];
d(k).Sensor_type=[];
d(k).Sample_rate=[];
d(k).Parameter_unit=[];
d(k).Start=[];
d(k).End=[];


k=4
d(k).Station_codename=[];
d(k).Lat=[];
d(k).Long=[];
d(k).Depth=[];

d(k).Description=[];
d(k).Elevation=[];
d(k).Sensor_type=[];
d(k).Sample_rate=[];
d(k).Parameter_unit=[];
d(k).Start=[];
d(k).End=[];

clear k 
save('GDF_EpisodeName_Water_Stations_example.mat')
