Accessing MDSplus Data from IDL

This page keeps the minimal MDSplus access patterns that were buried inside the older tutorial pages. Start by making sure your environment is correct on the cluster using the setup page. See also the current MDSplus programming page.

Direct MDSplus Calls
server = 'skylark.pppl.gov:8501'
shot = 121031

MDSCONNECT, server
MDSOPEN, 'EFIT01', shot

psirz = MDSVALUE('\EFIT01::TOP.RESULTS.GEQDSK:PSIRZ')
r = MDSVALUE('\EFIT01::TOP.RESULTS.GEQDSK:R')
z = MDSVALUE('\EFIT01::TOP.RESULTS.GEQDSK:Z')

MDSCLOSE
MDSDISCONNECT

The exact tree and node paths depend on the diagnostic or analysis tree you are targeting.

Local Helper Routines

Older PPPL workflows also used local helper routines such as OpenMDSshot and MDSGetSig to wrap the raw calls.

stat = OpenMDSshot('nstx', shot)
signal = MDSGetSig('\ip1', XAXIS=timebase, XUNITS=xunits, YUNITS=yunits)

Those helper routines are still a legacy dependency for some internal code, but the direct MDSplus calls above are the clearer baseline.

How to Make a Private MDSplus Tree
  1. Pick a tree name such as mytesttree.
  2. Define the tree path environment variable and create the target directory.
  3. Create a model tree in mdstcl.
  4. Add nodes with Traverser or TCL.
  5. Create a pulse number and write test data from IDL.
export mytesttree_path=/u/yourname/testtreedir
mkdir testtreedir
mdstcl
TCL> edit/new mytesttree
TCL> set tree mytesttree
TCL> create pulse 10
TCL> exit
IDL> MDSOPEN, 'mytesttree', 10
IDL> x = FINDGEN(10) & data = x^2
IDL> MDSPUT, ':onedim', 'build_signal($,*,$)', data, x