Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Achim Morschhauser
OBS_MAT
Commits
e49759b6
Commit
e49759b6
authored
May 17, 2018
by
Achim Morschhauser
Browse files
Path included in ppmsec2cdf, station format update
parent
c3248c5a
Changes
3
Hide whitespace changes
Inline
Side-by-side
calculate_baselines_environment.m
View file @
e49759b6
...
...
@@ -97,27 +97,6 @@ end
% specified in parameter file, it is required at command-line.
% =========================================================================
% -------------------------------------------------------------------------
% Specify required arguments
% -------------------------------------------------------------------------
% Station name
arg_specs
.
station
.
required
=
1
;
arg_specs
.
station
.
type
=
'char'
;
arg_specs
.
station
.
dim1
=
1
;
arg_specs
.
station
.
dim2
=
5
;
% Number of DI measurements to be read for given year
arg_specs
.
number_DI
.
required
=
1
;
arg_specs
.
number_DI
.
type
=
'numeric'
;
arg_specs
.
number_DI
.
dim1
=
1
;
arg_specs
.
number_DI
.
dim2
=
1
;
arg_specs
.
startdate
.
required
=
1
;
arg_specs
.
startdate
.
type
=
'char'
;
arg_specs
.
startdate
.
dim1
=
1
;
arg_specs
.
startdate
.
dim2
=
10
;
% -------------------------------------------------------------------------
% Try to read default values from parameter file
% -------------------------------------------------------------------------
...
...
@@ -131,26 +110,56 @@ arg_specs.parfile.dim1=1;
[
arg_parsed
state
]
=
parse_arg
(
arg_specs
,
varargin
);
% Check if parameter file exists
if
~
exist
(
arg_parsed
.
parfile
,
'file'
)
if
~
exist
(
arg_parsed
.
parfile
,
'file'
)
warning
([
'Specified parameter file '
arg_parsed
.
parfile
...
'does not exist. I will try to get all parameters from command-line.'
]);
end
% Set default values from parameter file
else
[
arg_specs
.
path
.
default
,
...
arg_specs
.
station
.
default
,
...
arg_specs
.
startdate
.
default
]
=
...
read_parameters
(
arg_parsed
.
parfile
,
'PATH'
,
'STATION'
,
'DATE'
,
...
{
0
,
0
,
0
});
[
arg_specs
.
path
.
default
,
...
arg_specs
.
station
.
default
,
...
arg_specs
.
startdate
.
default
]
=
...
read_parameters
(
arg_parsed
.
parfile
,
'PATH'
,
'STATION'
,
'DATE'
,
...
{
0
,
0
,
0
});
% Remove NaNs (no value specified in parfile) and set to required if no
% default was specified
for
field
=
fields
(
arg_specs
)
'
if
isnan
(
arg_specs
.
(
field
{
1
})
.
default
)
arg_specs
.
(
field
{
1
})
=
rmfield
(
arg_specs
.
(
field
{
1
}),
'default'
);
arg_specs
.
(
field
{
1
})
.
required
=
1
;
end
end
% -------------------------------------------------------------------------
%
Specify optional argument
s
%
Build struct of command-line specification
s
% -------------------------------------------------------------------------
%
% Specify required arguments
% Station name
arg_specs
.
station
.
required
=
1
;
arg_specs
.
station
.
type
=
'char'
;
arg_specs
.
station
.
dim1
=
1
;
arg_specs
.
station
.
dim2
=
5
;
% Number of DI measurements to be read for given year
arg_specs
.
number_DI
.
required
=
1
;
arg_specs
.
number_DI
.
type
=
'numeric'
;
arg_specs
.
number_DI
.
dim1
=
1
;
arg_specs
.
number_DI
.
dim2
=
1
;
arg_specs
.
startdate
.
required
=
1
;
arg_specs
.
startdate
.
type
=
'char'
;
arg_specs
.
startdate
.
dim1
=
1
;
arg_specs
.
startdate
.
dim2
=
10
;
%
% Specify optional arguments
% Source for temperature readings
% 'c' for cdf
arg_specs
.
tempsource
.
default
=
'c'
;
...
...
@@ -176,14 +185,13 @@ arg_specs.stopdate.dim1=1;
arg_specs
.
stopdate
.
dim2
=
10
;
% -------------------------------------------------------------------------
% Parse arguments
% Parse arguments
from command-line
% -------------------------------------------------------------------------
[
arg_parsed
,
state
]
=
parse_arg
(
arg_specs
,
varargin
);
%
-------------------------------------------------------------------------
%
% Error treatment
% -------------------------------------------------------------------------
% if ~isempty(arg_parsed.number_DI) && isempty(arg_parsed.year)
% error('Year must be specified if number_DI is given');
...
...
@@ -203,8 +211,12 @@ elseif (state.err == 2) % error occured, stop execution
error
(
state
.
errmsg
);
end
% =========================================================================
% Assign all the parameters
% =========================================================================
% -------------------------------------------------------------------------
%
Assign input argument
s
%
General parameter
s
% -------------------------------------------------------------------------
% This was removed as option here !
...
...
@@ -233,9 +245,9 @@ if ~strcmp(arg_parsed.stopdate(1:4),arg_parsed.startdate(1:4))
'allowed! \n Startyear is used: '
num2str
(
year
)]);
end
%
=========================================================================
% G
ENERATE PATHS
%
=========================================================================
%
-------------------------------------------------------------------------
% G
enerate paths
%
-------------------------------------------------------------------------
return_array
=
[];
%returnes baseliens etc from function
...
...
ppmsec2cdf.m
View file @
e49759b6
...
...
@@ -235,8 +235,51 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function
ppmsec2cdf
(
varargin
)
% =========================================================================
% Get parameters from input file and command-line arguments:
%
% First, read from parameter file. The default parameter file is
% 'parameters_win.txt', and is overwritten by command-line passed
% parameter file.
% Then overwrite with command-line arguments. If a parameter is not
% specified in parameter file, it is required at command-line.
% =========================================================================
% -------------------------------------------------------------------------
% Parse input arguments
% Try to read default values from parameter file
% -------------------------------------------------------------------------
% First try to get parameter file
arg_specs
.
parfile
.
default
=
'parameters_win.txt'
;
arg_specs
.
parfile
.
type
=
'char'
;
arg_specs
.
parfile
.
dim1
=
1
;
% Parse arguments for parameter file
[
arg_parsed
state
]
=
parse_arg
(
arg_specs
,
varargin
);
% Check if parameter file exists
if
~
exist
(
arg_parsed
.
parfile
,
'file'
)
warning
([
'Specified parameter file '
arg_parsed
.
parfile
...
'does not exist. I will try to get all parameters from command-line.'
]);
end
[
arg_specs
.
path
.
default
,
...
arg_specs
.
station
.
default
,
...
arg_specs
.
starttime
.
default
]
=
...
read_parameters
(
arg_parsed
.
parfile
,
'PATH'
,
'STATION'
,
'DATE'
,
...
{
0
,
0
,
0
});
% Remove NaNs (no value specified in parfile) and set to required if no
% default was specified
for
field
=
fields
(
arg_specs
)
'
if
isnan
(
arg_specs
.
(
field
{
1
})
.
default
)
arg_specs
.
(
field
{
1
})
=
rmfield
(
arg_specs
.
(
field
{
1
}),
'default'
);
arg_specs
.
(
field
{
1
})
.
required
=
1
;
end
end
% -------------------------------------------------------------------------
% Build struct of command-line specifications
% -------------------------------------------------------------------------
%
...
...
@@ -256,20 +299,6 @@ arg_specs.station.required=1;
arg_specs
.
station
.
dim2
=
5
;
arg_specs
.
station
.
type
=
'char'
;
%arg_specs.valid = {'BFO1s';'MSN0g';'NGK0g';'NGK1g';'NGK2g'; 'NGK3g';'NGK6g';'NGK7g';'NGK8g';'WNG0g';'WNG1g';'WNG2g';'WNG3g';'VNA1s';'SHE0g';'VSS0g';'TTB0g';'TTB1l';'PUL0g';'TEL0g';'VNA1s';'VSS0g'};
% station_array = ['SMA0g'];
%station_array = ['MSN0g'];
%station_array = ['WNG1g'];
%station_array = ['LRV1a'];
%station_array = ['SMA0g'];
%station_array = ['PUL0g'; 'TEL0g'];
%station_array = ['TDC1d'];
%station_array = ['NGK0g'];
% station_array = ['BFO1s'];
%station_array = ['VSS0g'];
%station_array = ['TDC1d'];
%station_array = ['VSS1g'];
%station_array = ['VNA1s'];
% station_array = ['MAR1l'];
%
% Specify optional arguments
...
...
@@ -283,8 +312,9 @@ arg_specs.DontWriteFTPDownload.valid={0,1};
arg_specs
.
MakeTromsoFile
.
default
=
0
;
arg_specs
.
MakeTromsoFile
.
valid
=
{
0
,
1
};
%
% Parse arguments
% -------------------------------------------------------------------------
% Parse arguments from command-line
% -------------------------------------------------------------------------
[
arg_parsed
state
]
=
parse_arg
(
arg_specs
,
varargin
);
...
...
@@ -297,9 +327,9 @@ elseif (state.err == 2) % error occured, stop execution
end
%
-------------------------------------------------------------------------
% Assign
input argument
s
%
-------------------------------------------------------------------------
%
=========================================================================
% Assign
all the parameter
s
%
=========================================================================
DontWriteFTPDownload
=
arg_parsed
.
DontWriteFTPDownload
;
...
...
@@ -323,27 +353,14 @@ station_array=arg_parsed.station;
% PATHS, depending on OS
%
opsys
=
computer
;
if
strcmp
(
opsys
(
1
:
2
),
'GL'
)
==
1
% root path
path1
=
'/nfs/magobs/magdata/data'
;
path1
=
'/home/variomet/jmat'
bs
=
'/'
;
% slash
elseif
strcmp
(
opsys
(
1
:
2
),
'PC'
)
==
1
path1
=
'Y:\laptop_data'
;
if
strcmp
(
pwd
,
'O:\jmat\0programme_win'
)
% ERKENNT KATRINS RECHNER
path1
=
'O:\jmat'
;
end
bs
=
'\'
;
% backslash
else
diplay
(
'operating system not recognised'
);
end
path1
=
arg_parsed
.
path
;
%
-------------------------------------------------------------------------
% S
TART WITH PROCESSING
%
-------------------------------------------------------------------------
%
=========================================================================
% S
tart with processing
%
=========================================================================
bs
=
backslash
;
opsys
=
computer
;
array_size
=
86400
;
timestamp_check_vs_GPS_list
=
[];
%introduced 2014-01-26
...
...
varlab_01.m
View file @
e49759b6
...
...
@@ -218,6 +218,8 @@ end
1
,
1
,
1
,
...
1
,
1
,
1
,
...
1
});
% Remove NaNs (no value specified in parfile) and set to required if no
% default was specified
...
...
@@ -250,7 +252,7 @@ arg_specs.time.dim2=4;
% Neighbour station 1
arg_specs
.
neighbour1
.
type
=
'char'
;
arg_specs
.
neighbour1
.
dim1
=
1
;
arg_specs
.
neighbour1
.
dim2
=
4
;
arg_specs
.
neighbour1
.
dim2
=
5
;
% NOT YET USED
arg_specs
.
first_diff_active
.
valid
=
{
0
,
1
};
% NOT YET USED
...
...
@@ -312,7 +314,7 @@ end
% Assign general parameters
showdate
=
strrep
(
arg_parsed
.
date
,
'-'
,
''
);
hhmm
=
arg_parsed
.
time
;
STATION
=
arg_parsed
.
station
;
% Station name
STATION
=
arg_parsed
.
station
(
1
:
4
);
% Station name
NEIGHBOUR1
=
arg_parsed
.
neighbour1
;
% Neighbour 1 station name
NEIGHBOUR2
=
arg_parsed
.
neighbour2
;
% Neighbour 2 station name
LENGTH
=
arg_parsed
.
length
;
% Length of observation interval in minutes
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment