You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 12 Next »

This page is under construction

Tips for OpenEarth Users

Initialising the OpenEarth Toolbox

To initialse the Matlab part of the OpenEarth toolbox you need to run oetsettings.m after starting up Matlab. This will automatically add all relevant OpenEarthTools subdirectories to the Matlab search path enabling the user to utilise all available Matlab tools.

Example script: (to run save as mfile in MATLAB!)
%% initialise toolbox 
oetsettingsdirectory = 'D:\OpenEarthTools\trunk\matlab\'; % NB: make sure you adjust the directory of oetsettings.m to match your local settings
run([oetsettingsdirectory filesep 'oetsettings.m'])

Working with OpenDap Database

Example script: nc_dump.m
%% quickly retrieve information about a given NetCDF file 
...

include screenshot

Example script: nc_varget.m
%% get relevant info from NetCDF file
...

%% retrieve data from database 
...

include figure

Analysing data retrieved from database

Example script: getVolume.m
%% initialise toolbox 
...

Tips for OpenEarth Developers

All above tips for OpenEarth Users are also relevant to OpenEarth Developers. This section discusses a range of tools that is available in Matlab itself as well as in the OpenEarth Toolbox that are of great use for OpenEarth Developers.

Setting up a new function

An important element of

Example script: Setting up a new OpenEarth function
%% initialise toolbox 
oetnewfun

%% set up a function with the proper function name 
oetnewfun('arbitraryfunctionname')

Script demonstrating useful OpenEarth applications (by Pieter and Kees)

Error rendering macro 'code': Invalid value specified for parameter 'com.atlassian.confluence.ext.code.render.InvalidValueException'
% initialise toolbox (NB: make sure you adjust the directory of oetsettings.m to match your local settings)
run('D:\OpenEarthTools\trunk\matlab\oetsettings.m')

% edit getCalls getIsCalledBy getInputSize getInputVariables roundoff double2evalstr getFileName getVolume
writemessage('init');

%% getInputVariables / getInputSize
clear;fclose all;close all;clc
quickstart internet
d = readTransectData('Jarkus Data','Noord-Holland','03000','2006');
xInitial    = d.xe(~isnan(d.ze)); %keep only the points with non-NaN z-values
zInitial    = d.ze(~isnan(d.ze)); %keep only the points with non-NaN z-values

dbstop in getVolume at 42
dbstopcurrent
[Volume, result, Boundaries] = getVolume(xInitial, zInitial);
dbclear in getVolume at 42
dbstopcurrent
writemessage(3,'Example of getInputVariables completed');

%% roundoff
clear;fclose all;close all;clc
X = 87643.7852;
for n = -2:2:4
    Xround = roundoff(X, n);
    disp(num2str(Xround))
end

%% getdefaults
dbstop in roundoff at 40
Xround = roundoff(X);
dbclear in roundoff at 40

%% double2evalstr
clear;fclose all;close all;clc

dbstop in double2evalstr_test at 9
run double2evalstr_test
dbstopcurrent

dbstop getHsig_t_test at 30
dbstop getHsig_t_test at 41
run getHsig_t_test
dbstopcurrent
writemessage(4,'Example of double2evalstr_test completed');

%% writemessage
writemessage(7,'Staring example of writemessage');
dbstopcurrent
SavedMessages = writemessage('get')

%% IsCalls
fun = 'getDuneErosion_VTV2006';
directory = 'D:\heijer\My Documents\Program Files\McTools\mc_toolbox\mc_applications\mc_ucit\getDuneErosion\';
IsCalls = getCalls(fun, directory);
IsCalls = getCalls(fun, directory, 'quiet');
dbstopcurrent
writemessage(1,'Example of IsCalls completed');

%% IsCalledBy
clear;fclose all;close all;clc
fun = 'getVolume';
directory = 'D:\heijer\My Documents\Program Files\McTools\mc_toolbox\mc_applications\mc_ucit\getDuneErosion\';
[IsCalledBy, Line, Column] = getIsCalledBy(fun, directory);
[IsCalledBy, Line, Column] = getIsCalledBy(fun, directory, 'quiet');
dbstopcurrent
writemessage(2,'Example of IsCalledBy completed');

%% FD_GUI_figure
cd( directory);
run FD_GUI_figure
dbstopcurrent
writemessage(6,'Example of FD_GUI completed');
clc

%% guidisp
guidisp('set','FD_GUI_message_panel');
guidisp('test message panel');
guidisp('set',[]);
guidisp('Test Command line');
dbstopcurrent
writemessage(7,'Example of guidisp completed');

%% dbstate
dbstop in getDuneErosion_test at 6
dbstop in getDuneErosion_VTV2006 at 12
getDuneErosion_test('VTV2006',1);
dbstopcurrent
writemessage(7,'Example of dbstate completed');

%% dbstopcurrent
cd('D:\heijer\My Documents\Work\Deltares\Projects\McTools');
dbstopcurrent;
pause(0.1);

%% writemessage
SavedMessages = writemessage('get')
dbclear all
  • No labels