Setting up Paths (Windows)

Note

As of April 2013, this version of the documentation is no longer maintained; however, it is consistent with the last (now retired) version of CODAS processing that used Matlab. We no longer update or fix the Matlab processing code, but we will maintain the Matlab code that reads CODAS Matlab output. Although the notes refer to both Python and Matlab processing, none of the code here will be maintained. This (now retired) documentation and code will remain available for awhile longer.

Python processing code is actively maintained and developed, and CODAS Python processing is documented here.

Suppose (for example) all the CODAS programs were extracted into c:\w\adcp_programs. You need to

  1. change three environment variables
  2. set up your matlab path
  3. verify that ”.py” file extenstion is associated with Python

These instructions use the Control Panel to set these variables. On a recent Windows XP installation no reboot was necessary after making the changes, but you will need to start a new command-prompt for the changes to take effect.

(1) ENVIRONMENT VARIABLES

To change these using Windows tools, as administrator, go to Settings : Control Panel : System : Advanced : Environment Variables and edit the following two entries.

Note

These paths are delimited by semicolons.

The environment variables to alter are:

  1. PATH (modify) allows the command line to find the program without the full path. This will include executables and the python program itself

    add these to PATH:

    • C:\w\adcp_programs\codas3\bin\win32 (for executables)
    • C:\w\adcp_programs\pycurrents\adcp (for .py scripts)
    • C:\w\adcp_programs\pycurrents\data\nmea (NMEA parsing programs)
    • C:\w\adcp_programs\pycurrents\adcpgui (for python gautoedit)
    • C:\w\adcp_programs\pycurrents\plot (for python navigation plots)
  2. PYTHONPATH (new variable) allows python to find the modules it needs to load

    create a new variable called PYTHONPATH with this entry:

    • C:\w\adcp_programs

(2) MATLAB PATH

You should also go into your matlab path editor and add

C:\w\adcp_programs\matlab

(the path to the UH programs directory) to the path, and save it. Any time you run matlab programs you should type “adcppath; radcppath” to add the appropriate programs to your path. Alternatively, run the commands once, then go to “Set Path” and “Save”.

IMPORTANT: See the section about mex files for more information about the “table1” we use for linear interpolation. This is important to get right and becomes more difficult with each new matlab release.

Any time you are going to run CODAS matlab code, type the following first to add the specific paths that are used.

adcppath; radcppath; mexpath

(3) Python File association

Make sure the “properties” of a python files (*.py) are associated with c:\python26\python.exe (whatever your python executable is). Modern python installations seem to do this automatically.

Manually

  • Open the folder C:\w\adcp_programs\pycurrents\adcp in Windows Explorer

  • Right-click “quick_adcp.py” and verify that the default item in “Open With” is Python.

  • If it is not, click “Open With” to choose the program that you want.

  • Click “Choose Program...” to choose the program you want.

  • Browse to your Python installation (eg. C:\Python26) and click on Python.exe

  • Select the “Always use the selected program” to open this kind of file check box if it is not selected. Click OK.

    Note From now on, Windows will open all files that have this file name extension in the program that you selected. To change this, you must follow these steps again and associate a different program with this file name extension.

Note

  • DO NOT add any subdirectories of PROGRAMS/matlab (if using the path tool in matlab, do not add the PROGRAMS/matlab diretory recursively); only add the directory itself.
  • The path to your PROGRAMS directory may be quite long. You can create a network share of the folder (recommend “read only”, and then “map network drive”) and assign the folder a drive letter (such as “P”). Then the above PATH and PYTHONPATH description would use P:\adcp_programs instead of C:\w\adcp_programs”.