Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
ESA webmust RestAPI libraries
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Carmelo Magnafico
ESA webmust RestAPI libraries
Commits
a2e3e2f5
Commit
a2e3e2f5
authored
5 years ago
by
Browse files
Options
Downloads
Patches
Plain Diff
matmust bug fix for matlab 2019b
parent
d8a65630
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
matlab/src/classes/@MatMust/MatMust.m
+1
-1
1 addition, 1 deletion
matlab/src/classes/@MatMust/MatMust.m
matlab/test/classes/@MatMust/MatMust.m
+54
-16
54 additions, 16 deletions
matlab/test/classes/@MatMust/MatMust.m
with
55 additions
and
17 deletions
matlab/src/classes/@MatMust/MatMust.m
+
1
−
1
View file @
a2e3e2f5
...
...
@@ -56,7 +56,7 @@ classdef MatMust < handle
% check if user is already logged in
if
f
>
0
raw
=
fread
(
f
,
inf
);
tockenfilejson
=
jsondecode
(
char
(
raw
));
tockenfilejson
=
jsondecode
(
char
(
raw
)
'
);
if
isfield
(
tockenfilejson
,
'token'
)
&
isfield
(
tockenfilejson
,
'expiresAt'
)
if
length
(
split
(
tockenfilejson
.
token
,
'.'
))
==
3
&
datetime
(
datenum
(
tockenfilejson
.
expiresAt
,
'yyyy-mm-dd HH:MM:SS'
),
'ConvertFrom'
,
'datenum'
,
'TimeZone'
,
'utc'
)
>
datetime
(
datetime
(
now
,
'ConvertFrom'
,
'datenum'
,
'TimeZone'
,
'local'
),
'TimeZone'
,
'utc'
)
obj
.
loginstatus
=
true
;
...
...
This diff is collapsed.
Click to expand it.
matlab/test/classes/@MatMust/MatMust.m
+
54
−
16
View file @
a2e3e2f5
classdef
MatMust
<
handle
%MATMUST A library to get deal with ESA webmust REST API
% Follow indication in methods help.
%
% +++++++++++++++++++++++++++++++++++++
% Creator: Carmelo Magnafico IAPS/INAF
% date: 20/06/2019
%
% +++++++++++++++++++++++++++++++++++++
% MATMUST embed the first
properties
POSToptions
...
...
@@ -62,7 +56,7 @@ classdef MatMust < handle
% check if user is already logged in
if
f
>
0
raw
=
fread
(
f
,
inf
);
tockenfilejson
=
jsondecode
(
char
(
raw
));
tockenfilejson
=
jsondecode
(
char
(
raw
)
'
);
if
isfield
(
tockenfilejson
,
'token'
)
&
isfield
(
tockenfilejson
,
'expiresAt'
)
if
length
(
split
(
tockenfilejson
.
token
,
'.'
))
==
3
&
datetime
(
datenum
(
tockenfilejson
.
expiresAt
,
'yyyy-mm-dd HH:MM:SS'
),
'ConvertFrom'
,
'datenum'
,
'TimeZone'
,
'utc'
)
>
datetime
(
datetime
(
now
,
'ConvertFrom'
,
'datenum'
,
'TimeZone'
,
'local'
),
'TimeZone'
,
'utc'
)
obj
.
loginstatus
=
true
;
...
...
@@ -139,6 +133,8 @@ classdef MatMust < handle
% dateStart = 'yyyy-mm-dd HH:MM:SS' format date UTC time
% dateStop = 'yyyy-mm-dd HH:MM:SS' format date UTC time
% 'dump','plot' optional parameter to dump and plot the data
% 'calibrated' optional parameter that specify that you want
% calibrated data
% intialize data output
data
=
[];
...
...
@@ -155,6 +151,7 @@ classdef MatMust < handle
end
end
if
any
(
ismember
(
varargin
,
'calibrated'
))
calibrate
=
'true'
;
else
calibrate
=
'false'
;
end
query
=
[
'dataproviders/'
,
ds
,
'/parameters/data'
];
obj
.
GEToptions
.
HeaderFields
=
{
'Authorization'
,
obj
.
tockenstruct
.
token
};
...
...
@@ -167,7 +164,7 @@ classdef MatMust < handle
'values'
,
(
parname
),
...
'from'
,
(
dateStart
),
...
'to'
,
(
dateStop
),
...
'calibrate'
,
'false'
,
...
'calibrate'
,
calibrate
,
...
'mode'
,
'SIMPLE'
};
try
...
...
@@ -215,9 +212,29 @@ classdef MatMust < handle
data_par
=
data
(
i
)
.
data
;
figure
title
(
sprintf
(
'%s-%s: %s -> %s\n'
,
data
(
i
)
.
subsystem
,
data
(
i
)
.
type
,
data
(
i
)
.
name
,
data
(
i
)
.
description
))
if
strcmp
(
calibrate
,
'true'
)
switch
class
(
data_par
(
1
)
.
calibratedValue
)
case
'char'
indx
=
[
1
,
find
(
diff
([
data_par
.
value
])
~=
0
)]
+
1
;
ylabels
=
string
;
ylabels
([
unique
([
data_par
.
value
],
'stable'
)])
=
replace
({
data_par
(
indx
)
.
calibratedValue
},
'_'
,
' '
);
plot
([
data_par
.
dateMAT
],
[
data_par
.
value
],
'-x'
);
set
(
gca
,
'ytick'
,
unique
([
data_par
.
value
],
'sorted'
))
set
(
gca
,
'yticklabel'
,
ylabels
)
if
exist
(
'dataFigShowUpdatefcn'
)
==
2
set
(
datacursormode
(
gcf
),
'UpdateFcn'
,
@
dataFigShowUpdatefcn
)
end
otherwise
plot
([
data_par
.
dateMAT
],
[
data_par
.
calibratedValue
],
'-x'
);
end
else
plot
([
data_par
.
dateMAT
],
[
data_par
.
value
],
'-x'
);
end
xlabel
(
'time'
);
if
isfield
(
data
(
i
),
'unit'
)
ylabel
(
data
(
i
)
.
unit
);
end
title
([
data
(
i
)
.
description
,
' - '
,
data
(
i
)
.
name
]);
datetick
(
'x'
);
grid
on
end
...
...
@@ -226,6 +243,21 @@ classdef MatMust < handle
end
function
t
=
MatMust_searchTMparFromName
(
obj
,
namequery
,
dataproviders
,
varargin
)
% +++
% MatMust_searchTMparFromName
% Search a parameter into the requested dataprovider (es. BEPICRUISE)
% MatMust_searchTMparFromName(obj, namequery, dataproviders, varargin)
%
% dataproviders = dataprovider IdName.
% namequery = The query to perform (ex. '*HGA' )
% varargin = You can specify several options in varagin:
% ex: 'dump' -> print to screen the parameters found
% 'Description' -> Extend search in Parameters Descriptions
% 'Id' -> Extend Search in Parameter Id
% 'Unit' -> Extend Search in Unit name space
%
if
obj
.
loginstatus
query
=
'metadata/treesearch'
;
obj
.
GEToptions
.
HeaderFields
=
{
'Authorization'
,
obj
.
tockenstruct
.
token
};
...
...
@@ -233,13 +265,20 @@ classdef MatMust < handle
dataproviders
=
char
(
join
(
dataproviders
,
','
));
end
try
optindx
=
strcmp
(
varargin
,
'Description'
)
+
strcmp
(
varargin
,
'Unit'
)
+
strcmp
(
varargin
,
'Id'
);
if
any
(
find
(
optindx
))
field
=
join
(
varargin
(
find
(
optindx
)),
','
);
response
=
webread
([
obj
.
url
,
obj
.
urlsub
,
query
],
'field'
,[
'name,'
,
char
(
field
)],
'text'
,
namequery
,
'dataproviders'
,
dataproviders
,
obj
.
GEToptions
);
else
response
=
webread
([
obj
.
url
,
obj
.
urlsub
,
query
],
'field'
,
'name'
,
'text'
,
namequery
,
'dataproviders'
,
dataproviders
,
obj
.
GEToptions
);
end
t
=
response
;
catch
ME
fprintf
(
'+++ WARNING\n%s - %s\n'
,
ME
.
identifier
,
ME
.
message
)
end
if
nargin
>
3
if
strcmp
(
varargin
{
1
}
,
'dump'
)
if
any
(
find
(
strcmp
(
varargin
,
'dump'
)
))
fprintf
(
'+++++++++++++ PARAMETERS QUERY RESULT LIST +++++++++++++\n'
);
found
=
false
;
for
i
=
1
:
numel
(
t
)
...
...
@@ -259,7 +298,7 @@ classdef MatMust < handle
end
end
end
function
[
exit
]
=
MatMust_login
(
obj
,
varargin
)
function
MatMust_login
(
obj
,
varargin
)
% login
% https://bepicolombo.esac.esa.int/webclient-must/mustlink/api-docs/index.html#/Authentication/login
% input:
...
...
@@ -317,7 +356,6 @@ classdef MatMust < handle
MatMust_getUserLinkedProjects
(
obj
);
else
exit
=
true
;
disp
(
'user already loggen in'
)
end
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment