MDSplus Programming Interfaces
The examples below demonstrate how to connect to an MDSplus server and retrieve the EFIT poloidal flux grid (PSIRZ) from the EFIT01 tree. Node paths and server names are representative of the NSTX/NSTX-U installation.
Python with MDSplus installation
import MDSplus

server = "skylark.pppl.gov:8501"
shot = 121031

conn = MDSplus.Connection(server)
conn.openTree("EFIT01", shot)

psirz = conn.get(r"\EFIT01::TOP.RESULTS.GEQDSK:PSIRZ").data()
r = conn.get(r"\EFIT01::TOP.RESULTS.GEQDSK:R").data()
z = conn.get(r"\EFIT01::TOP.RESULTS.GEQDSK:Z").data()

conn.closeTree("EFIT01", shot)
Python with mdsthin client

The mdsthin client is a lightweight Python client for MDSplus that can be installed using pip.

from mdsthin import Connection

server = "skylark.pppl.gov:8501"
shot = 121031

conn = Connection(server)
conn.openTree("EFIT01", shot)

psirz = conn.get(r"\EFIT01::TOP.RESULTS.GEQDSK:PSIRZ").data()
r = conn.get(r"\EFIT01::TOP.RESULTS.GEQDSK:R").data()
z = conn.get(r"\EFIT01::TOP.RESULTS.GEQDSK:Z").data()

conn.closeTree("EFIT01", shot)
MATLAB
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;
IDL
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
C with local MDSplus installation
#include <stdio.h>
#include <mdslib.h>

int main() {
    int shot = 121031;
    char *server = "skylark.pppl.gov:8501";
    char *expr = "\\EFIT01::TOP.RESULTS.GEQDSK:PSIRZ";

    MdsConnect(server);
    MdsOpen("EFIT01", &shot);

    /* Retrieve PSIRZ using TDI expression */
    MdsValue(expr, NULL, NULL);

    MdsClose("EFIT01", &shot);
    MdsDisconnect();
    return 0;
}

In C, production applications typically use MDSplus descriptors to manage memory and data types robustly. The example above illustrates the basic access pattern only.

Fortran with local MDSplus installation
program read_psirz
  implicit none
  integer :: shot, status
  character(len=64) :: server

  shot = 121031
  server = 'skylark.pppl.gov:8501'

  call mdsconnect(server, status)
  call mdsopen('EFIT01', shot, status)

  ! Example expressions:
  !   \EFIT01::TOP.RESULTS.GEQDSK:PSIRZ
  !   DIM_OF(PSIRZ,0), DIM_OF(PSIRZ,1)

  call mdsclose('EFIT01', shot, status)
  call mdsdisconnect(status)
end program read_psirz

The Fortran interface mirrors the C and IDL calling pattern and evaluates TDI expressions to retrieve data. Exact array-handling details depend on the local MDSplus build and Fortran bindings.