| Madrigal Matlab API | Doc home | Madrigal home |
The Matlab API described in this document has almost exactly the same functionality as the remote version, with two important differences:
Like all of Madrigal, the Matlab API is built on top of the the C API madrec, and the Fortran geo library. The Matlab Madrigal API consists of both MEX files written in C, and standard Matlab methods. Since Matlab is not open source, the Matlab API can only be installed successfully if Matlab is already installed.
To add your own methods to the Madrigal Matlab API, write your methods as documented in the Matlab API manual in either C or Fortran, using any Madrigal method. Then edit the appropriate Makefile in $MADROOT/source/madmatlab to build your program, using isprint as a template. Manually install the Madrigal Matlab API as described above. You may also call the Madrigal Matlab API from any *.m file you write in Matlab.
If you feel your new method, written in Matlab, C, or Fortran, would be helpful to the whole Madrigal community, please feel free to contact us at openmadrigal-developers.
***********************************************************
isprint Create an isprint-like 3D array of doubles via
a command similar to the isprint command-line
application
The calling syntax is:
[records] = isprint(file, parms, filters, [missing, [assumed, [knownbad] ] ])
where
file is path to file
(example = '/home/brideout/data/mlh980120g.001')
parms is the desired parameters in the form of a comma-delimited
string of Madrigal mnemonics (example = 'gdlat,ti,dti')
filters is the filters requested in exactly the form given in isprint
command line (example = 'time1=15:00:00 date1=01/20/1998 time2=15:30:00 date2=01/20/1998 filter=ti,500,1000')
See the isprint command for details
missing is an optional double to represent missing values. Defaults to NaN
assumed is an optional double to represent assumed values. Defaults to NaN
knownbad is an optional double to represent knownbad values. Defaults to NaN
The returned records is a three dimensional array of double with the dimensions:
[Number of rows, number of parameters requested, number of records]
***********************************************************
getInstruments returns an array of instrument structs of instruments found on local Madrigal server.
inputs: None
returns instrument struct with the fields:
instrument.name (string) Example: 'Millstone Hill Incoherent Scatter Radar'
instrument.code (int) Example: 30
instrument.mnemonic (3 char string) Example: 'mlh'
instrument.latitude (double) Example: 45.0
instrument.longitude (double) Example: 110.0
instrument.altitude (double) Example: 0.015 (km)
Raises error if unable to return instrument array
***********************************************************
getExperiments returns an array of experiments structs of instruments given input filter arguments.
Inputs:
1. instCodeArray - a 1 X N array of ints containing selected instrument codes. Special value of 0 selects all instruments.
2. starttime - Matlab datenum double (must be UTC)
3. endtime - Matlab datenum double (must be UTC)
4. localFlag - 1 if local experiments only, 0 if all experiments
Return array of Experiment struct (May be empty):
experiment.id (int) Example: 10000111
experiment.url (string) Example: 'http://www.haystack.mit.edu/cgi-bin/madtoc/1997/mlh/03dec97'
experiment.name (string) Example: 'Wide Latitude Substorm Study'
experiment.siteid (int) Example: 1
experiment.sitename (string) Example: 'Millstone Hill Observatory'
experiment.instcode (int) Code of instrument. Example: 30
experiment.instname (string) Instrument name. Example: 'Millstone Hill Incoherent Scatter Radar'
experiment.starttime (double) Matlab datenum of experiment start
experiment.endtime (double) Matlab datenum of experiment end
experiment.isLocal (int) 1 if local, 0 if not
Raises error if unable to return experiment array
***********************************************************
getExperimentFiles returns an array of experiment file structs given experiment id.
Inputs:
1. experiment id (int) - from getExperiments
Return array of Experiment File struct (May be empty):
file.name (string) Example '/opt/mdarigal/blah/mlh980120g.001'
file.kindat (int) Kindat code. Example: 3001
file.kindatdesc (string) Kindat description: Example 'Basic Derived Parameters'
file.category (int) (1=default, 2=variant, 3=history, 4=real-time)
file.status (string)('preliminary', 'final', or any other description)
file.permission (int) 0 for public, 1 for private
Raises error if unable to return experiment array
***********************************************************
getParameters returns an array of parameter structs given madrigal filename.
Inputs:
1. filename (string) - full path to local madrigal file (from getExperimentFiles)
Return array of Parameter struct:
parameter.mnemonic (string) Example 'dti'
parameter.description (string) Example:
"F10.7 Multiday average observed (Ott) - Units: W/m2/Hz"
parameter.isError (int) 1 if error parameter, 0 if not
parameter.units (string) Example "W/m2/Hz"
parameter.isMeasured (int) 1 if measured, 0 if derivable
parameter.category (string) Example: "Time Related Parameter"
parameter.isSure (int) 1 if can be found for all records, 0 if only
for some records (implies not all records have same measured
parameters)
Raises error if unable to return experiment array
***********************************************************
madsearchfiles Returns a list of comma-delimited file names
found in the local Madrigal database between
start time and end time. Use get* methods for
more complete searching.
The calling syntax is:
[numFiles, filenames, exp_starttimes, exp_endtimes] =
madsearchfiles(start_datenum, end_datenum)
where
start_datenum is a Matlab datenum giving the starting time to search
end_datenum is a Matlab datenum giving the ending time to search
numFiles is an integer giving the number of files found
filenames is a string holding a comma-delimited list of all file names (full path) found
exp_starttimes is a 1 x numFiles array of doubles giving each experiment's start time
as a Matlab datenum
exp_endtimes is a 1 x numFiles array of doubles giving each experiment's end time
as a Matlab datenum
The files returned will have started after start_datenum and ended before end_datenum
and will be default files.
***********************************************************
getMadroot return madroot, either from environment variable, or from installed value
The calling syntax is:
madroot = getMadroot()
returns char array containing MADROOT
| Madrigal Matlab API | Doc home | Madrigal home |