Newer
Older

jacques.grelet_ird.fr
committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
function read_Climatology(hMainFig, type)
% Function to read climatology and store result to tsg structure
%
% Input
% -----
% type ............ String describing climatology (annual,sesonal or
% monthly)
%
% Output
% ------
% none
%
% $Id$
% Retrieve named application data
% -------------------------------
tsg = getappdata( hMainFig, 'tsg_data');
% is tsg.levitus empty, climatology file is not loaded in memory
% --------------------------------------------------------------
if isempty( tsg.levitus.data) || ~strcmp(tsg.levitus.type,type)
% construct the filename and read file
% ------------------------------------
file = which(['woa01_' type '_surf.nc']);
% open netcdf climatology file
% ----------------------------
levitus = read_file_woa01(file);
% test for structure concordance
% ------------------------------
if ~isstruct(levitus)
% show dialog box with help to get climatology file
% -------------------------------------------------
errordlg({'NetCDF climatology file :', file, ...
'not present in you path',...
'Check your matlab path or download it from',...
'ftp://ftp.ifremer.fr/ifremer/ird/us191/oceano/lib/matlab/woa01_annual_surf.nc'},...
'NetCDF climatology file access error');
return;
% structure is ok, save climatology & type in tsg structure
% ---------------------------------------------------------
else
tsg.levitus.data = levitus;
tsg.levitus.type = type;
end
% save tsg structure
% ------------------
setappdata( hMainFig, 'tsg_data', tsg );
end