Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
davidnbresch committed Oct 25, 2014
1 parent 305e06b commit 5ec8e54
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
4 changes: 2 additions & 2 deletions code/climada_circle_plot.m
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
% David N. Bresch, [email protected], 20120430
%-

global climada_global
if not(climada_init_vars(1)),return;end; % init/import global variables
%global climada_global
if ~climada_init_vars,return;end; % init/import global variables

values=full(values);

Expand Down
17 changes: 9 additions & 8 deletions code/climada_tc_read_unisys_database.m
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function [tc_track,tc_track_mat]=climada_tc_read_unisys_database(unisys_file)
function [tc_track,tc_track_mat]=climada_tc_read_unisys_database(unisys_file,check_plot)
% TC event set track database UNISYS
% NAME:
% climada_tc_read_unisys_database
Expand All @@ -22,7 +22,7 @@
% to the code and results in substantial speed-up.
% if the binary file (see tc_track_raw_file) exists, reading of raw
% data is skipped. This allows faster iteration iro filtering (as often
% required, since raw data contains missing and errors).
% required, since raw data contains missing and errors).
% One needs to delete the binary files to re-read the raw ASCII data.
%
% previous step: see climada_tc_get_unisys_databases
Expand All @@ -36,6 +36,7 @@
% UNISYS), prompted for, if not given
% see also PARAMETERS section, especially for filters
% OPTIONAL INPUT PARAMETERS:
% check_plot: if =1, show plots, =0 not (default)
% OUTPUTS:
% tc_track: a structure with the track information for each cyclone i and
% data for each node j (times are at 00Z, 06Z, 12Z, 18Z):
Expand Down Expand Up @@ -86,15 +87,14 @@

% check inputs
if ~exist('unisys_file','var'),unisys_file=[];end
if ~exist('check_plot','var'),check_plot=0;end

% PARAMETERS
%
% general settings
% ----------------
min_nodes=3; % minimal nodes a track must have to be selected
%
check_plot=1; % whether we show a check plot (=1) or not (=0)
%
% some likely basin/dataset specific settings
% -------------------------------------------
% the UNISYS latitude comes with no sign, so one needs to know the
Expand Down Expand Up @@ -151,7 +151,8 @@
if ~exist(tc_track_proc_file,'file')

if ~exist(tc_track_raw_file,'file')
h = waitbar(0.5,'Reading and converting data ...');

if climada_global.waitbar,h = waitbar(0.5,'Reading and converting data ...');end
% open the database for reading
if ~exist(unisys_file,'file'),fprintf('ERROR: file %s not found\n',unisys_file);return;end
fid=fopen(unisys_file,'r');
Expand Down Expand Up @@ -343,14 +344,14 @@
n_tracks=length(unique_unique_ID); % amount of read tracks
msgstr=sprintf('Processing %i tracks ...',n_tracks);
fprintf('%s\n',msgstr);
h = waitbar(0,msgstr);
if climada_global.waitbar,h = waitbar(0,msgstr);end

% for printing some features (tests)
selected_tracks=0; % init: number of tracks selected
unselected_tracks=0; % init: number of tracks unselected

for ID_i=1:n_tracks
waitbar(ID_i/n_tracks,h); % update waitbar
if climada_global.waitbar,waitbar(ID_i/n_tracks,h);end % update waitbar

pos=find(unique_ID==unique_unique_ID(ID_i)); %find all datapoints which belong to the same ID (=same track)

Expand Down Expand Up @@ -413,7 +414,7 @@

end % ID_i
fprintf('%i tracks read, %i tracks chosen, %i tracks not chosen\n',n_tracks,selected_tracks,unselected_tracks)
close(h); % dispose waitbar
if exist('h','var'), close(h), end % close waitbar

clear raw_data % to save space

Expand Down

0 comments on commit 5ec8e54

Please sign in to comment.