Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
gdat
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
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
SPC
gdat
Commits
224e4721
Commit
224e4721
authored
2 years ago
by
Olivier Sauter
Browse files
Options
Downloads
Patches
Plain Diff
avoid mdsconnect if already connected to tunnel (localhost)
parent
c5146a94
No related branches found
No related tags found
1 merge request
!128
D3d addons
Pipeline
#143925
passed
2 years ago
Stage: test
Stage: post-test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
matlab/D3D/mdsplus_func/get_mds_tree_d3d.m
+61
-51
61 additions, 51 deletions
matlab/D3D/mdsplus_func/get_mds_tree_d3d.m
with
61 additions
and
51 deletions
matlab/D3D/mdsplus_func/get_mds_tree_d3d.m
+
61
−
51
View file @
224e4721
...
@@ -6,13 +6,13 @@ function [data,ier,varnames_all,varnames_dot_all] = get_mds_tree_d3d(shot, tree
...
@@ -6,13 +6,13 @@ function [data,ier,varnames_all,varnames_dot_all] = get_mds_tree_d3d(shot, tree
% data= get_mds_tree(shot, 'EFIT01', 'NSTX'); % for NSTX
% data= get_mds_tree(shot, 'EFIT01', 'NSTX'); % for NSTX
% data= get_mds_tree(shot, 'NB', 'DIII-D'); % example other tree
% data= get_mds_tree(shot, 'NB', 'DIII-D'); % example other tree
%
%
% PURPOSE: Get entire selected mds tree from mdsplus database.
% PURPOSE: Get entire selected mds tree from mdsplus database.
%
%
% INPUT: <default>
% INPUT: <default>
% shot = shot number
% shot = shot number
% tree = tree to use <'EFIT01'>
% tree = tree to use <'EFIT01'>
% server = MDS+ database to use: 'DIII-D'(default),'NSTX','EAST',
% server = MDS+ database to use: 'DIII-D'(default),'NSTX','EAST',
% 'THOR', 'OPEN'(assumes mdsconnect already called). Other
% 'THOR', 'OPEN'(assumes mdsconnect already called). Other
% inputs invoke mdsconnect(server) to connect to server.
% inputs invoke mdsconnect(server) to connect to server.
% toupper = 1= all variables made upper case, =-1 all var. made lower case
% toupper = 1= all variables made upper case, =-1 all var. made lower case
% [0]= no change, variables made depending on mds case (typical UC)
% [0]= no change, variables made depending on mds case (typical UC)
...
@@ -21,9 +21,9 @@ function [data,ier,varnames_all,varnames_dot_all] = get_mds_tree_d3d(shot, tree
...
@@ -21,9 +21,9 @@ function [data,ier,varnames_all,varnames_dot_all] = get_mds_tree_d3d(shot, tree
% <0> server= 'DIII-D' & all others;
% <0> server= 'DIII-D' & all others;
%
%
% OUTPUT:
% OUTPUT:
% data = structure containing all data in MDS+ tree, with same tree
% data = structure containing all data in MDS+ tree, with same tree
% structure except that 'TOP' replaced by 'tree'
% structure except that 'TOP' replaced by 'tree'
% See: data.allnames for list of all variables in full structure
% See: data.allnames for list of all variables in full structure
% Some Extra items added to structure (all lower case)
% Some Extra items added to structure (all lower case)
% data.id = sting array of important data identifyer enf
% data.id = sting array of important data identifyer enf
% data.shot = shot number
% data.shot = shot number
...
@@ -31,15 +31,15 @@ function [data,ier,varnames_all,varnames_dot_all] = get_mds_tree_d3d(shot, tree
...
@@ -31,15 +31,15 @@ function [data,ier,varnames_all,varnames_dot_all] = get_mds_tree_d3d(shot, tree
% data.allnames= list of variables in structure with path relative to "TOP"
% data.allnames= list of variables in structure with path relative to "TOP"
% data.mdsnames= list of variables in structure with full mds path
% data.mdsnames= list of variables in structure with full mds path
% ier = error code
% ier = error code
%
%
% WRITTEN BY: Jim Leuer ON 3/1/05 (original name get_mds_tree)
% WRITTEN BY: Jim Leuer ON 3/1/05 (original name get_mds_tree)
% taken from get_mds_tree.m uses sub-structure to store
% taken from get_mds_tree.m uses sub-structure to store
%
%
% USES: eq_mod
% USES: eq_mod
% To see MDS structure on HYDRA run traverser
% To see MDS structure on HYDRA run traverser
% tested on DIII-D and NSTX data and should work for JET data but not tested
% tested on DIII-D and NSTX data and should work for JET data but not tested
%
%
% CHANGE LOG: SMF 20140923 - Changed getnci call to use nid_numbers due to
% CHANGE LOG: SMF 20140923 - Changed getnci call to use nid_numbers due to
% fullpath not accepting wildcards.
% fullpath not accepting wildcards.
%
%
% ==========================================================================
% ==========================================================================
...
@@ -70,44 +70,55 @@ function [data,ier,varnames_all,varnames_dot_all] = get_mds_tree_d3d(shot, tree
...
@@ -70,44 +70,55 @@ function [data,ier,varnames_all,varnames_dot_all] = get_mds_tree_d3d(shot, tree
if
isempty
(
toupper
)
toupper
=
0
;
end
if
isempty
(
toupper
)
toupper
=
0
;
end
if
isempty
(
server
)
server
=
'DIII-D'
;
end
if
isempty
(
server
)
server
=
'DIII-D'
;
end
if
isempty
(
tree
)
tree
=
'EFIT01'
;
end
if
isempty
(
tree
)
tree
=
'EFIT01'
;
end
if
isempty
(
verbose
)
if
isempty
(
verbose
)
if
strcmp
(
server
,
'NSTX'
)
|
strcmp
(
server
,
'EAST'
)
if
strcmp
(
server
,
'NSTX'
)
|
strcmp
(
server
,
'EAST'
)
verbose
=
1
;
verbose
=
1
;
else
else
verbose
=
0
;
verbose
=
0
;
end
end
end
end
% -----------------------------------------------
% -----------------------------------------------
% Open and check conneciton to MDSPLUS data base:
% Open and check conneciton to MDSPLUS data base:
tic
tic
ier
=
0
;
status
=
1
;
ier
=
0
;
status
=
1
;
mdsisopen
=
0
;
mdsisopen
=
0
;
% [shoto,status]=mdsopen('atlas.gat.com::EFIT01',shot)
if
exist
(
'mdscurrent'
)
>
0
if
strcmp
(
server
,
'DIII-D'
)
|
strcmp
(
server
,
'DIIID'
)
|
strcmp
(
server
,
'D3D'
)
aa
=
mdscurrent
;
status
=
mdsconnect
(
'atlas.gat.com'
);
else
elseif
strcmp
(
server
,
'EAST'
)
aa
=
'will connect'
;
status
=
mdsconnect
(
'202.127.204.12'
);
% NOT SURE THIS WORKS
end
elseif
strcmp
(
server
,
'NSTX'
)
if
strmatch
(
'localhost'
,
aa
)
status
=
mdsconnect
(
'skylark.pppl.gov:8501'
);
% already connected to localhost
elseif
strcmp
(
server
,
'KSTAR'
)
if
(
strcmp
(
getenv
(
'HOST'
),
'datagrid'
)
|
strcmp
(
getenv
(
'HOST'
),
'ksim2'
))
% On site at NFRI
mds_server
=
'172.17.100.200:8300'
;
else
% Offsite
% mds_server = '203.230.125.212:8005'; % not able to connect to NFRI server directly
mds_server
=
'kd'
;
end
status
=
mdsconnect
(
mds_server
);
elseif
strcmp
(
server
,
'THOR'
)
status
=
mdsconnect
(
'thor'
);
elseif
strcmp
(
server
,
'VIDAR'
)
status
=
mdsconnect
(
'vidar'
);
elseif
strcmp
(
server
,
'OPEN'
)
disp
([
'get_mds_tree: Assuming MDSCONNECT already called and MDS is '
,
server
])
status
=
1
;
status
=
1
;
else
end
disp
([
'get_mds_tree: Attempting to connect to server = '
,
server
])
% [shoto,status]=mdsopen('atlas.gat.com::EFIT01',shot)
status
=
mdsconnect
(
server
);
if
strcmp
(
aa
,
'will connect'
)
||
isempty
(
aa
)
if
strcmp
(
server
,
'DIII-D'
)
|
strcmp
(
server
,
'DIIID'
)
|
strcmp
(
server
,
'D3D'
)
status
=
mdsconnect
(
'atlas.gat.com'
);
elseif
strcmp
(
server
,
'EAST'
)
status
=
mdsconnect
(
'202.127.204.12'
);
% NOT SURE THIS WORKS
elseif
strcmp
(
server
,
'NSTX'
)
status
=
mdsconnect
(
'skylark.pppl.gov:8501'
);
elseif
strcmp
(
server
,
'KSTAR'
)
if
(
strcmp
(
getenv
(
'HOST'
),
'datagrid'
)
|
strcmp
(
getenv
(
'HOST'
),
'ksim2'
))
% On site at NFRI
mds_server
=
'172.17.100.200:8300'
;
else
% Offsite
% mds_server = '203.230.125.212:8005'; % not able to connect to NFRI server directly
mds_server
=
'kd'
;
end
status
=
mdsconnect
(
mds_server
);
elseif
strcmp
(
server
,
'THOR'
)
status
=
mdsconnect
(
'thor'
);
elseif
strcmp
(
server
,
'VIDAR'
)
status
=
mdsconnect
(
'vidar'
);
elseif
strcmp
(
server
,
'OPEN'
)
disp
([
'get_mds_tree: Assuming MDSCONNECT already called and MDS is '
,
server
])
status
=
1
;
else
disp
([
'get_mds_tree: Attempting to connect to server = '
,
server
])
status
=
mdsconnect
(
server
);
end
end
end
if
~
mod
(
status
,
2
)
if
~
mod
(
status
,
2
)
...
@@ -131,7 +142,7 @@ function [data,ier,varnames_all,varnames_dot_all] = get_mds_tree_d3d(shot, tree
...
@@ -131,7 +142,7 @@ function [data,ier,varnames_all,varnames_dot_all] = get_mds_tree_d3d(shot, tree
return
;
return
;
else
else
if
(
verbose
)
if
(
verbose
)
disp
([
'% get_mds_tree opened tree, shot: '
tree
' '
int2str
(
shot
)])
disp
([
'% get_mds_tree opened tree, shot: '
tree
' '
int2str
(
shot
)])
end
end
end
end
...
@@ -156,7 +167,7 @@ function [data,ier,varnames_all,varnames_dot_all] = get_mds_tree_d3d(shot, tree
...
@@ -156,7 +167,7 @@ function [data,ier,varnames_all,varnames_dot_all] = get_mds_tree_d3d(shot, tree
mds_all
=
strvcat
(
mds_all
,
mds_ot
);
mds_all
=
strvcat
(
mds_all
,
mds_ot
);
mds_ot
=
mds_sub_tree
(
mds_ot
);
mds_ot
=
mds_sub_tree
(
mds_ot
);
end
end
% ===============================================================
% ===============================================================
% Process each name in mds_all for all variables present
% Process each name in mds_all for all variables present
% ===============================================================
% ===============================================================
...
@@ -165,10 +176,10 @@ function [data,ier,varnames_all,varnames_dot_all] = get_mds_tree_d3d(shot, tree
...
@@ -165,10 +176,10 @@ function [data,ier,varnames_all,varnames_dot_all] = get_mds_tree_d3d(shot, tree
% kk
% kk
mds_nam
=
deblank
(
mds_all
(
kk
,:));
mds_nam
=
deblank
(
mds_all
(
kk
,:));
mdscmd
=
[
'getnci("\'
mds_nam
':*","NID_NUMBER")'
];
mdscmd
=
[
'getnci("\'
mds_nam
':*","NID_NUMBER")'
];
[
mds_nids
,
mstatus
]
=
mdsvalue
(
mdscmd
);
[
mds_nids
,
mstatus
]
=
mdsvalue
(
mdscmd
);
if
~
mod
(
mstatus
,
2
)
% handle nstx different format
if
~
mod
(
mstatus
,
2
)
% handle nstx different format
mdscmd
=
[
'getnci("\\\'
mds_nam
':*","NID_NUMBER")'
];
mdscmd
=
[
'getnci("\\\'
mds_nam
':*","NID_NUMBER")'
];
[
mds_nids
,
mstatus
]
=
mdsvalue
(
mdscmd
);
[
mds_nids
,
mstatus
]
=
mdsvalue
(
mdscmd
);
end
end
varnames
=
[];
varnames
=
[];
if
mod
(
mstatus
,
2
)
if
mod
(
mstatus
,
2
)
...
@@ -185,19 +196,19 @@ function [data,ier,varnames_all,varnames_dot_all] = get_mds_tree_d3d(shot, tree
...
@@ -185,19 +196,19 @@ function [data,ier,varnames_all,varnames_dot_all] = get_mds_tree_d3d(shot, tree
varnamesc
=
char
(
varnames
);
varnamesc
=
char
(
varnames
);
idgood
=
strmatch
(
upper
(
mds_nam0
),
upper
(
varnamesc
));
idgood
=
strmatch
(
upper
(
mds_nam0
),
upper
(
varnamesc
));
varnamesc
=
varnamesc
(
idgood
,:);
varnamesc
=
varnamesc
(
idgood
,:);
data_namesc
=
varnamesc
(:,
top_num
+
2
:
end
);
data_namesc
=
varnamesc
(:,
top_num
+
2
:
end
);
numvar
=
size
(
varnamesc
,
1
);
numvar
=
size
(
varnamesc
,
1
);
% loop over all variables
% loop over all variables
if
numvar
>=
30
if
numvar
>=
30
tic
tic
for
ii
=
1
:
numvar
for
ii
=
1
:
numvar
% ii=0; ii=ii+1;
% ii=0; ii=ii+1;
fullnam
=
deblank
(
varnamesc
(
ii
,:));
fullnam
=
deblank
(
varnamesc
(
ii
,:));
data
.
mdsnames
=
strvcat
(
data
.
mdsnames
,
fullnam
);
data
.
mdsnames
=
strvcat
(
data
.
mdsnames
,
fullnam
);
dat
=
mdsvalue
(
fullnam
);
% Actual value of data
dat
=
mdsvalue
(
fullnam
);
% Actual value of data
subnam
=
deblank
(
data_namesc
(
ii
,:));
%
subnam
=
deblank
(
data_namesc
(
ii
,:));
%
id
=
findstr
(
subnam
,
':'
);
id
=
findstr
(
subnam
,
':'
);
subnam
(
id
)
=
'.'
;
subnam
(
id
)
=
'.'
;
if
toupper
==
1
if
toupper
==
1
...
@@ -221,9 +232,9 @@ function [data,ier,varnames_all,varnames_dot_all] = get_mds_tree_d3d(shot, tree
...
@@ -221,9 +232,9 @@ function [data,ier,varnames_all,varnames_dot_all] = get_mds_tree_d3d(shot, tree
for
ii
=
1
:
numvar
for
ii
=
1
:
numvar
fullnam
=
deblank
(
varnamesc
(
ii
,:));
fullnam
=
deblank
(
varnamesc
(
ii
,:));
data
.
mdsnames
=
strvcat
(
data
.
mdsnames
,
fullnam
);
data
.
mdsnames
=
strvcat
(
data
.
mdsnames
,
fullnam
);
dat
=
mdsvalue
(
fullnam
);
% Actual value of data
dat
=
mdsvalue
(
fullnam
);
% Actual value of data
subnam
=
deblank
(
data_namesc
(
ii
,:));
%
subnam
=
deblank
(
data_namesc
(
ii
,:));
%
id
=
findstr
(
subnam
,
':'
);
id
=
findstr
(
subnam
,
':'
);
subnam
(
id
)
=
'.'
;
subnam
(
id
)
=
'.'
;
if
toupper
==
1
if
toupper
==
1
...
@@ -242,18 +253,18 @@ function [data,ier,varnames_all,varnames_dot_all] = get_mds_tree_d3d(shot, tree
...
@@ -242,18 +253,18 @@ function [data,ier,varnames_all,varnames_dot_all] = get_mds_tree_d3d(shot, tree
eval
(
str
);
eval
(
str
);
end
% for ii
end
% for ii
end
% if numvar
end
% if numvar
end
% for kk
end
% for kk
if
strcmp
(
server
,
'NSTX'
)
|
strcmp
(
server
,
'EAST'
)
if
strcmp
(
server
,
'NSTX'
)
|
strcmp
(
server
,
'EAST'
)
status
=
mdsdisconnect
;
% Exit MDS+ if conneced to remote server
status
=
mdsdisconnect
;
% Exit MDS+ if conneced to remote server
end
end
return
return
% ========================================================
% ========================================================
% Testing
% Testing
% ========================================================
% ========================================================
% Testing SEE test_get_mds_tree
% Testing SEE test_get_mds_tree
% (WATCH OUT 114504 has problems use 98549 Ferron High Performance)
% (WATCH OUT 114504 has problems use 98549 Ferron High Performance)
...
@@ -273,9 +284,9 @@ function [data,ier,varnames_all,varnames_dot_all] = get_mds_tree_d3d(shot, tree
...
@@ -273,9 +284,9 @@ function [data,ier,varnames_all,varnames_dot_all] = get_mds_tree_d3d(shot, tree
filename
=
'/u/leuer/efit/diiid/s98549/g098549.04000'
%
filename
=
'/u/leuer/efit/diiid/s98549/g098549.04000'
%
read_gfile
read_gfile
shot
=
98549
;
tree
=
'IONS'
;
server
=
'DIII-D'
;
toupper
=-
1
;
shot
=
98549
;
tree
=
'IONS'
;
server
=
'DIII-D'
;
toupper
=-
1
;
ions
=
get_mds_tree
(
shot
,
tree
,
server
,
toupper
);
ions
=
get_mds_tree
(
shot
,
tree
,
server
,
toupper
);
shot
=
98549
;
tree
=
'NB'
;
server
=
'DIII-D'
;
toupper
=-
1
;
shot
=
98549
;
tree
=
'NB'
;
server
=
'DIII-D'
;
toupper
=-
1
;
nb
=
get_mds_tree
(
shot
,
tree
,
server
,
toupper
);
nb
=
get_mds_tree
(
shot
,
tree
,
server
,
toupper
);
% ========================================================
% ========================================================
...
@@ -288,4 +299,3 @@ function [data,ier,varnames_all,varnames_dot_all] = get_mds_tree_d3d(shot, tree
...
@@ -288,4 +299,3 @@ function [data,ier,varnames_all,varnames_dot_all] = get_mds_tree_d3d(shot, tree
shot
=
113363
;
tree
=
'EFIT01'
;
server
=
'NSTX'
;
shot
=
113363
;
tree
=
'EFIT01'
;
server
=
'NSTX'
;
clear
data
clear
data
data
=
get_mds_tree
(
shot
,
tree
,
server
);
data
=
get_mds_tree
(
shot
,
tree
,
server
);
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