# File Inventory

The following table provides the name of the folder containing the
listed functions and folders in the download directory column; a list of
all files or folders of files in the ADCP Data Processing System in the
second column; and the path (directory) given to Matlab to locate these
files if they are stored in the suggested locations on the user's
computer given in the Setup & Installation in Section 2.

**Download directory functions \\ folders Matlab path**

ADCP_tools adcp2ep.m D:\\Matlabr11\\work\\ADCP_tools

> bm2dir.m
>
> bm2geo.m
>
> bm2xyze.m
>
> datmil.m
>
> fillmsk.m
>
> fixEns.m
>
> goodends.m
>
> history.m
>
> mcnote.m
>
> mfriend.m
>
> rdflead.m
>
> rdhead.m
>
> rdi2cdf.m
>
> rdsurface.m
>
> rdvlead.m
>
> runadcp.m
>
> runbm2g.m
>
> runmask.m
>
> trimbins.m

\~AddOns Gregorian.m D:\\Matlabr11\\work\\

> Hms2h.m
>
> Hms2s.m
>
> Julian.m
>
> Polar2uv.m
>
> s2hms.m
>
> uv_rotate.m
>
> uv2polar.m
>
> which1s.m

\~AddOns (p-code installers) batch D:\\Matlabr11\\toolbox\\

epic

form D:\\Matlabr11\\toolbox\\netcdf

> presto
>
> proxy
>
> starbeam
>
> starbuck
>
> starbare

included in starbare installer ncmkmask.m \~\\netcdf \\starbare

> postmask.m
>
> premask.m

www.rdinstruments.com Surface.exe D:\\Programs\\RDI\\

\~extraMs arrowsafe.m D:\\Matlabr11\\work\\

> create_batch
>
> fig2jpeg.m
>
> fig2tif.m
>
> fixdate.m
>
> fixval.m
>
> plot_tilt.m
>
> run_NOPP
>
> scr_off.m
>
> testrun
>
> tilt2nc.m
>
> trimfix.m
>
> view_adcp.m

Below is an example startup.m file for a DOS/Windows system that should
be located in the Matlab/bin directory on the user's computer. If a
startup.m file exists, these paths should be added. The path names may
need to be altered if their system is a Mac, Unix, or non-standard PC.

function startup

ncstartup

path(path,\'d:\\Matlabr11\\toolbox\\netcdf\\form\')

path(path,\'d:\\Matlabr11\\toolbox\\netcdf\\proxy\')

path(path,\'d:\\Matlabr11\\toolbox\\netcdf\\starbeam\')

path(path,\'d:\\Matlabr11\\toolbox\\netcdf\\starbare\')

path(path,\'d:\\Matlabr11\\toolbox\\netcdf\\presto\')

path(path,\'d:\\Matlabr11\\toolbox\\netcdf\\starbuck\')

path(path,\'d:\\Matlabr11\\toolbox\\epic\')

path(path,\'d:\\Matlabr11\\toolbox\\RPSstuff\')

path(path,\'d:\\Matlabr11\\toolbox\\TSplots\')

path(path,\'d:\\Matlabr11\\toolbox\\batch\')

path(path,\'d:\\Matlabr11\\toolbox\\lct\')

path(path,\'d:\\Matlabr11\\toolbox\\stextfun\')

path(path,\'d:\\Matlabr11\\work\\workingcode\')

path(path,\'d:\\Matlabr11\\work\\ADCP_tools\')

path(path,\'d:\\Matlabr11\\work\\graphics

## Diary Log File for Demo file {#diary-log-file-for-demo-file .unnumbered}

The diary log seen in the following pages was recorded while running a
Demo of the ADCP data processing system. This log serves as an example
of the type of information that the user will see on the screen while
running the ADCP data processing programs.

runadcp

%function \[theResult\] =
runadcp(rawdata,rawcdf,theMaskFile,theNewADCPFile,\...

trimFile);

%Runs the important ADCP functions in the following order:

rdi2cdf.m

runmask.m

goodends.m

trimBins.m

%Ocassionally the program will display some results in figures and

stops to ask if it is ok to continue. If the program seems to be waiting

and you are unsure what to do, check the matlab command window for

a message!

%Type \'pause off\' prior to running function if would like to run
unattended.

%If you do not wish to run rdi2cdf.m, to create the first netcdf file

from this data than, you must have an existing netcdf file and type

in the first 2 inputs in the command line.

i.e. theResult = runADCP(\'999wh.000\',\'999wh.cdf\').

Although you will be prompted for the INPUT files, be sure to have all

%of them accessable before beginning.

%INPUTS:

rawdata = RDI ADCP binary output file (\*.000)

rawcdf = the Netcdf file created directly from the binary ADCP file

theMaskFile = identical in size and structure to the cdf file

containing 0\'s if the data is good and 1\'s if it is bad

theNewADCPFile = the \"masked\" data file after initial filtering

trimFile = the last file created by trimming the bad ensembles

If file names are not given, they will be requested.

\%

%OUTPUTS:

\% theResult = is the trimFile, the last file created

rawdata =

D:\\Data\\Demo\\Demo000.000

Converting RDI data file to netcdf

You will be asked for some inputs from the mooring log

rdi2cdf.m version 2.2c 10/22/99

Header information from adcp file D:\\Data\\Demo\\Demo000.000

Number of bytes per ensemble 537

Number of data types 6

nbytes =

537

nt =

6

offsets =

18

70

127

289

371

453

CPU Version 8.30

Hardware Configuration for LSB 202

System Frequency = 300 kHz

Convex Beam

Sensor Configuration #1

Transducer head attached

Upward facing beam orientation

Hardware Configuration MSB 65

Beam angle = 20 degrees

4-beam janus configuration

The data is real

Number of beams used to calculate velocity data: 4

Number of depth cells 20

Pings per ensemble 300

Depth cell size 100 cm

Blank after xmit distance 176 cm

Profiling mode 1

Valid range for correlation 64

Code repetitions 3

Minimum and maximum percent good for output 0

Minimum and Maximum Error Velocity values permitted 2000 mm/s

Time between ping groups

Coordinate Transformation = 7

Data stored coordinates = Beam

Heading alignment 0

Heading Bias: 0 deg

Sensor Source = 127

Sound speed computed from ED, ES & ET

ED taken from depth sensor

EH taken from xducer heading sensor

EP taken from xducer pitch sensor

ER taken from xducer roll sensor

ES derived from conductivity sensor

ET taken from temperature sensor

Sensor Availability = 29

heading sensor

pitch sensor

roll sensor

temperature sensor

Distance to center of bin 1: 326 cm

Transmit pulse length 148

Starting water layer 1

Ending water layer 5

False target reject range values 50

Transmit lag distance 51

\-\-\-\-\-\-\-\-\-\--

infilesize =

276692

514 ensembles estimated from file size

99 ensembles read, 99 converted in 5.873400e+001 sec

199 ensembles read, 199 converted in 6.210900e+001 sec

299 ensembles read, 299 converted in 6.548400e+001 sec

399 ensembles read, 399 converted in 6.883900e+001 sec

Variable Leader ID not found

velocity data ID not found

correlation data ID not found

intensity data ID not found

percent good data ID not found

499 ensembles read, 499 converted in 7.219300e+001 sec

Variable Leader ID not found

velocity data ID not found

correlation data ID not found

intensity data ID not found

percent good data ID not found

Variable Leader ID not found

velocity data ID not found

correlation data ID not found

intensity data ID not found

percent good data ID not found

Variable Leader ID not found

velocity data ID not found

correlation data ID not found

intensity data ID not found

percent good data ID not found

Variable Leader ID not found

velocity data ID not found

correlation data ID not found

intensity data ID not found

percent good data ID not found

Variable Leader ID not found

velocity data ID not found

correlation data ID not found

intensity data ID not found

percent good data ID not found

Variable Leader ID not found

velocity data ID not found

correlation data ID not found

intensity data ID not found

percent good data ID not found

Variable Leader ID not found

velocity data ID not found

correlation data ID not found

intensity data ID not found

percent good data ID not found

Variable Leader ID not found

velocity data ID not found

correlation data ID not found

intensity data ID not found

percent good data ID not found

Variable Leader ID not found

velocity data ID not found

correlation data ID not found

intensity data ID not found

percent good data ID not found

Variable Leader ID not found

velocity data ID not found

correlation data ID not found

intensity data ID not found

percent good data ID not found

Variable Leader ID not found

velocity data ID not found

correlation data ID not found

intensity data ID not found

percent good data ID not found

Variable Leader ID not found

velocity data ID not found

correlation data ID not found

intensity data ID not found

percent good data ID not found

Variable Leader ID not found

velocity data ID not found

correlation data ID not found

intensity data ID not found

percent good data ID not found

Variable Leader ID not found

velocity data ID not found

correlation data ID not found

intensity data ID not found

percent good data ID not found

Variable Leader ID not found

velocity data ID not found

Conversion complete

7.225300e+001 seconds elapsed while processing

498 was the number of the last ensemble read

In the following figure quickly review the data

Then click \"Done\" on the Starbeam menu, and hit enter

theImageDataLimits =

-151.0000 49.8000

-78.5000 128.3000

-69.6000 87.5000

-28.4000 46.2000

theImageColorLimits =

-151.0000 151.0000

-151.0000 151.0000

-87.5000 87.5000

-87.5000 87.5000

Warning: Future versions will return empty for empty == scalar
comparisons.

In d:\\Matlabr11\\work\\ADCP_tools\\runadcp.m at line 134

fixens is currently running

Yippie\...there are no missing ensembles!! :) :) :) :) :) :) :)

\## closed: ncid = 3.

Running mask functions to remove bad data points

runmask is currently running

\## Data File: D:\\Data\\Demo\\Demo000.cdf

\## Mask File: D:\\Data\\Demo\\Demo000.msk

\## Defining dimensions \...

\## ensemble \...

\## bin \...

\## Defining variables \...

\## D \...

\## TIM \...

\## Rec \...

\## sv \...

\## vel1 \...

\## vel2 \...

\## vel3 \...

\## vel4 \...

\## cor1 \...

\## cor2 \...

\## cor3 \...

\## cor4 \...

\## AGC1 \...

\## AGC2 \...

\## AGC3 \...

\## AGC4 \...

\## PGd1 \...

\## PGd2 \...

\## PGd3 \...

\## PGd4 \...

\## Hdg \...

\## Ptch \...

\## Roll \...

\## Tx \...

\## xmitc \...

\## xmitv \...

\## dac \...

\## VDD3 \...

\## VDD1 \...

\## VDC \...

\## Filling record-variables \...

\## TIM \...

\## Rec \...

\## sv \...

\## vel1 \...

\## vel2 \...

\## vel3 \...

\## vel4 \...

\## cor1 \...

\## cor2 \...

\## cor3 \...

\## cor4 \...

\## AGC1 \...

\## AGC2 \...

\## AGC3 \...

\## AGC4 \...

\## PGd1 \...

\## PGd2 \...

\## PGd3 \...

\## PGd4 \...

\## Hdg \...

\## Ptch \...

\## Roll \...

\## Tx \...

\## xmitc \...

\## xmitv \...

\## dac \...

\## VDD3 \...

\## VDD1 \...

\## VDC \...

\## Done.

Created mask file,

D:\\Data\\Demo\\Demo000.msk

Pulling out the needed Global attributes from the Data file

This information sets the criteria for masking

vel =

-1510 1332

\## vel1 \...

\## vel2 \...

\## vel3 \...

\## vel4 \...

\## cor1 \...

\## cor2 \...

\## cor3 \...

\## cor4 \...

\## AGC1 \...

\## AGC2 \...

\## AGC3 \...

\## AGC4 \...

\## PGd1 \...

\## PGd2 \...

\## PGd3 \...

\## PGd4 \...

The mask is filled

\## closed: ncid = 4.

\## closed: ncid = 3.

In the following figure bad velocity data are displayed in black

Mark any additional bad data points

Then click \"Done\" on the Starbare menu, and hit enter

theImageDataLimits =

-154.1873 49.8000

-81.7825 128.3000

-72.0937 87.5000

-29.5841 46.2000

theImageColorLimits =

-154.1873 154.1873

-154.1873 154.1873

-87.5000 87.5000

-87.5000 87.5000

theImageDataLimits =

-34.5127 23.9000

-20.7016 37.0000

-34.2349 12.8000

-43.3032 46.5000

theImageColorLimits =

-37.0000 37.0000

-37.0000 37.0000

-46.5000 46.5000

-46.5000 46.5000

theImageDataLimits =

-20.5048 24.6000

-22.5286 36.9000

-33.8143 11.9000

-28.4349 69.8000

theImageColorLimits =

-36.9000 36.9000

-36.9000 36.9000

-69.8000 69.8000

-69.8000 69.8000

1 file(s) copied.

\## Masking: D

\## Remaining: 20 records\...

\## Masking: TIM

\## Remaining: 498 records\...

\## Masking: Rec

\## Remaining: 498 records\...

\## Masking: sv

\## Remaining: 498 records\...

\## Masking: vel1

\## Remaining: 498 records\...

\## Masking: vel2

\## Remaining: 498 records\...

\## Masking: vel3

\## Remaining: 498 records\...

\## Masking: vel4

\## Remaining: 498 records\...

\## Masking: cor1

\## Remaining: 498 records\...

\## Masking: cor2

\## Remaining: 498 records\...

\## Masking: cor3

\## Remaining: 498 records\...

\## Masking: cor4

\## Remaining: 498 records\...

\## Masking: AGC1

\## Remaining: 498 records\...

\## Masking: AGC2

\## Remaining: 498 records\...

\## Masking: AGC3

\## Remaining: 498 records\...

\## Masking: AGC4

\## Remaining: 498 records\...

\## Masking: PGd1

\## Remaining: 498 records\...

\## Masking: PGd2

\## Remaining: 498 records\...

\## Masking: PGd3

\## Remaining: 498 records\...

\## Masking: PGd4

\## Remaining: 498 records\...

\## Masking: Hdg

\## Remaining: 498 records\...

\## Masking: Ptch

\## Remaining: 498 records\...

\## Masking: Roll

\## Remaining: 498 records\...

\## Masking: Tx

\## Remaining: 498 records\...

\## Masking: xmitc

\## Remaining: 498 records\...

\## Masking: xmitv

\## Remaining: 498 records\...

\## Masking: dac

\## Remaining: 498 records\...

\## Masking: VDD3

\## Remaining: 498 records\...

\## Masking: VDD1

\## Remaining: 498 records\...

\## Masking: VDC

\## Remaining: 498 records\...

Masking is complete based on the read mask file

\## ncitem/feval failure while trying: uminus(\...)

\## closed: ncid = 3.

goodends is currently running

ddate =

13-aug-1999

rdate =

17-aug-1999

checking vel1 \...

checking vel2 \...

checking vel3 \...

checking vel4 \...

Based on the \# of good bins, 22 is the first good ensemble

and 382 is the last good, out of 498 total ensembles

from the file D:\\Data\\Demo\\Demo000.msk

Based on pitch and roll, 22 is the first good ensemble

and 360 is the last good, out of 498 total ensembles

in file D:\\Data\\Demo\\DemoM.cdf

minT =

13-Aug-1999

maxT =

17-Aug-1999

The last good ensemble is same as recovery date, 17-Aug-1999

The first good ensemble occurs at 13-Aug-1999

and the recorded deployment date is 13-aug-1999

Trimming file from ensemble 22 to 360

src =

NetCDF_File: \'D:\\Data\\Demo\\DemoM.cdf\'

nDimensions: 2

nVariables: 30

nGlobalAttributes: 43

RecordDimension: \'ensemble\'

nRecords: 498

Permission: \'nowrite\'

DefineMode: \'data\'

FillMode: \'fill\'

MaxNameLen: 0

dst =

NetCDF_File: \'D:\\Data\\Demo\\DemoT.cdf\'

nDimensions: 0

nVariables: 0

nGlobalAttributes: 0

RecordDimension: \'\'

nRecords: 0

Permission: \'clobber\'

DefineMode: \'define\'

FillMode: \'fill\'

MaxNameLen: 0

theRecdim =

NetCDF_Dimension: \'ensemble\'

itsLength: 498

\## nctrim: copying \"D\"

\## nctrim: trimming \"TIM\"

\## nctrim: trimming \"Rec\"

\## nctrim: trimming \"sv\"

\## nctrim: trimming \"vel1\"

\## nctrim: trimming \"vel2\"

\## nctrim: trimming \"vel3\"

\## nctrim: trimming \"vel4\"

\## nctrim: trimming \"cor1\"

\## nctrim: trimming \"cor2\"

\## nctrim: trimming \"cor3\"

\## nctrim: trimming \"cor4\"

\## nctrim: trimming \"AGC1\"

\## nctrim: trimming \"AGC2\"

\## nctrim: trimming \"AGC3\"

\## nctrim: trimming \"AGC4\"

\## nctrim: trimming \"PGd1\"

\## nctrim: trimming \"PGd2\"

\## nctrim: trimming \"PGd3\"

\## nctrim: trimming \"PGd4\"

\## nctrim: trimming \"Hdg\"

\## nctrim: trimming \"Ptch\"

\## nctrim: trimming \"Roll\"

\## nctrim: trimming \"Tx\"

\## nctrim: trimming \"xmitc\"

\## nctrim: trimming \"xmitv\"

\## nctrim: trimming \"dac\"

\## nctrim: trimming \"VDD3\"

\## nctrim: trimming \"VDD1\"

\## nctrim: trimming \"VDC\"

\## ncitem/feval failure while trying: uminus(\...)

\## closed: ncid = 3.

trimbins is currently running

cpfile =

d:\\applications\\RDI\\datatools\\Demo000.000

1 file(s) copied.

Running RDI surface program

1 file(s) moved.

RDI surface program found the following depth constraints in meters: min
= 17.35 max = 18.62 Mean = 18.1875

Current plot held

Current plot held

User modified depth constraints in meters: min = 17.8 max = 18.62 Mean =
18.1984

ADCP measured 19.4484 m from surface to the seabed (mean sea level)

The tidal range is approximately 0.17305 m

Finding the good bins

Redefining the \"Bin\" dimension

May take a few minutes\...

\# in Dsurf 339

\# in ensemble 339

f =

NetCDF_File: \'D:\\Data\\Demo\\DemoT.cdf\'

nDimensions: 2

nVariables: 31

nGlobalAttributes: 43

RecordDimension: \'ensemble\'

nRecords: 339

Permission: \'write\'

DefineMode: \'data\'

FillMode: \'fill\'

MaxNameLen: 0

File D:\\Data\\Demo\\DemoT.cdf has been modified

\## 4 bins were removed from the top of the water column

\## ncitem/feval failure while trying: uminus(\...)

theImageDataLimits =

-18.2000 13.7000

-17.9000 17.4000

-27.0000 14.8000

-1.5000 23.5000

theImageColorLimits =

-18.2000 18.2000

-18.2000 18.2000

-27.0000 27.0000

-27.0000 27.0000

ans =

D:\\Data\\Demo\\DemoT.cdf

theImageDataLimits =

-10.3000 14.0000

-14.9000 18.4000

-24.3000 8.1000

-9.1000 15.6000

theImageColorLimits =

-18.4000 18.4000

-18.4000 18.4000

-24.3000 24.3000

-24.3000 24.3000

theImageDataLimits =

-13.5000 10.3000

-16.2000 17.0000

-23.4000 10.2000

-3.6000 16.2000

theImageColorLimits =

-17.0000 17.0000

-17.0000 17.0000

-23.4000 23.4000

-23.4000 23.4000

theImageDataLimits =

-14.4000 8.7000

-3.7000 15.8000

-16.4000 9.5000

-3.5000 16.4000

theImageColorLimits =

-15.8000 15.8000

-15.8000 15.8000

-16.4000 16.4000

-16.4000 16.4000

adcp2ep

adcp2ep is currently running

function epDataFile = adcp2ep(adcpFile, epDataFile, ADCPtype, dlgFile)

This function is used to translate RDI ADCP data into variables that are

in terms of earth coordinates and create an epic compatible data file.

If the data is in Beam coordinates it will be transformed by runbm2g.m
into

Earth coordinates. This transformation can be run on workhorse and broad

band data, but the ADCP type must be specified.

Magnetic Declination

If a magnetic declination was provided to the insturment prior to

deployment or to rdi2cdf in post-processing it will be applied at this

time for both Earth and Beam coordinat data

Inputs:

adcpFile = the ADcp data file in beam coordinates

(Note:if running routines in sequence it should be the trimFile.)

epDataFile = the new Epic compatable file that will be created

ADCPtype = WH or BB; will default to WH if not specified

WH = workhorse, BB = broad band

note: if BB, do not need a dlgFile

dlgFile = the dialog file that was created when the ADCP was
\"deployed\"

Note: If the names of the files are not given, they will be requested.

Output:

epDataFile = same as input

TIM was corrected by 150 sec = half the ensemble time

Converting \"TIM\" to \"time\" and \"time2\"

The file has 339 ensembles and 16 bins

Averaging echo intensity

Averaging percent good

Data in Beam coordinates is being transformed to Earth

runbm2g is currently running

ADCPtype =

WH

Obtaining Beam configuration information from D:\\Data\\Demo\\999wh.dlg

Beam Width: 3.7 degrees

B =

NetCDF_File: \'D:\\Data\\Demo\\DemoT.cdf\'

nDimensions: 2

nVariables: 31

nGlobalAttributes: 43

RecordDimension: \'ensemble\'

nRecords: 339

Permission: \'nowrite\'

DefineMode: \'data\'

FillMode: \'fill\'

MaxNameLen: 0

100 ensembles converted in 1.275800e+001 sec

200 ensembles converted in 2.486600e+001 sec

300 ensembles converted in 3.709300e+001 sec

\## ncitem/feval failure while trying: uminus(\...)

Modifying the global attributes

Data_Collection_Information =

Mooring: \'9991\'

Experiment: {{7x1 cell} \[1\]}

Project: {{5x1 cell} \[1\]}

descript: {{8x1 cell} \[1\]}

comments: \'test deployment \'

longitude: \[1x1 struct\]

latitude: \[1x1 struct\]

Defining variables and their attributes

\...Defining \"time\"

\...Defining \"time2\"

\...Defining \"depth\"

\...Defining \"lon\"

\...Defining \"lat\"

\...Defining \"u_1205\"

\...Defining \"v_1206\"

\...Defining \"w_1204\"

\...Defining \"Werr_1201\"

\...Defining \"AGC_1202\"

\...Defining \"PGd_1203\"

\...Defining \"hght_18\"

\...Defining \"Tx_1211\"

Copying data to D:\\Data\\Demo\\Demo.nc

\... time

\... time2

\... lat

\... lon

\... depth

\... u_1205

\... v_1206

\... w_1204

\... Werr_1201

\... AGC_1202

\... PGd_1203

\...hght_18

\... Tx_1211

\## ncitem/feval failure while trying: uminus(\...)

ans =

D:\\Data\\Demo\\Demo.nc

diary off