Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
TSG QC
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
US191
TSG QC
Commits
7937a00d
Commit
7937a00d
authored
15 years ago
by
jacques.grelet_ird.fr
Browse files
Options
Downloads
Patches
Plain Diff
ajout de commentaires et nettoyage de code
parent
8f54a485
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
tsg_io/readTsgDataNetCDF.m
+9
-5
9 additions, 5 deletions
tsg_io/readTsgDataNetCDF.m
tsg_io/writeTSGDataNetCDF.m
+8
-21
8 additions, 21 deletions
tsg_io/writeTSGDataNetCDF.m
with
17 additions
and
26 deletions
tsg_io/readTsgDataNetCDF.m
+
9
−
5
View file @
7937a00d
function
[
error
]
=
readTsgDataNetCDF
(
hMainFig
,
filename
)
% Function to read the TSG data. Should be a NetCDF file
% GOSUD data format TSG V1.
4
% GOSUD data format TSG V1.
6
%
% Input
% -----
% hMainFig ............ Hand
e
l to the main user interface
% filename ........... Data filename
% hMainFig ............ Handl
e
to the main user interface
% filename ...........
.
Data filename
%
% Output
% ------
...
...
@@ -13,6 +13,9 @@ function [error] = readTsgDataNetCDF( hMainFig, filename)
%
% The data are store using setappdata - Variable name : 'tsg_data'
%
% DAYD, DAYD_WS and DAYD_EXT in tsg structure use Matlab datenum, they
% should be converted from julian days using 1950 reference in NetCDF file
%
% $Id$
%% Check Netcdf library version
...
...
@@ -173,8 +176,9 @@ automaticQC( hMainFig )
var
=
char
(
key
);
tsg
.
(
var
)
=
nc
.
VARIABLES
.
(
var
)
.
data__
;
% transforme julian days variables to Matlab datenum
% --------------------------------------------------
% when variable is julian days from 1950 reference, transform to
% Matlab datenum
% --------------------------------------------------------------
if
strmatch
(
'DAYD'
,
var
)
tsg
.
(
var
)
=
julianToDatenum
(
tsg
.
(
var
));
end
...
...
This diff is collapsed.
Click to expand it.
tsg_io/writeTSGDataNetCDF.m
+
8
−
21
View file @
7937a00d
function
[
error
]
=
writeTSGDataNetCDF
(
hTsgGUI
,
filename
)
% [error] = writeTSGDataNetCDF( hTsgGUI, filename)
% Function to write TSG data in NetCDF file.
% Function to write TSG data in NetCDF file
to GOSUD format 1.6
.
%
% Input
% -----
...
...
@@ -14,9 +14,8 @@ function [error] = writeTSGDataNetCDF( hTsgGUI, filename)
%
% The data are store using setappdata - Variable name : 'tsg_data'
%
% Actually, with DAYD, DAYD_WS and DAT_EXT dimensions defined: 61 variables
% DAYD, DAYD_WS dimensions defined: 57 variables
% DAYD only dimension defined: 53 variables
% DAYD, DAYD_WS and DAYD_EXT in tsg structure use Matlab datenum, they
% should be converted to julian days using 1950 reference in NetCDF file
%
% $Id$
...
...
@@ -323,7 +322,7 @@ end
end
end
end
% end of loop over variables keys
% Close waitbar
% -------------
...
...
@@ -360,24 +359,17 @@ end
% -----------------------------------------------------------------
for
key
=
keys
(
nc
.
VARIABLES
)
var
=
char
(
key
);
% Convert Matlab julian days (datenum) to 1950 reference
% ------------------------------------------------------
if
strmatch
(
'DAYD'
,
var
)
nc
.
VARIABLES
.
(
var
)
.
data__
=
datenumToJulian
(
tsg
.
(
var
));
else
nc
.
VARIABLES
.
(
var
)
.
data__
=
tsg
.
(
var
);
end
end
% % Convert Matlab julian days (datenum) to 1950 reference
% % ------------------------------------------------------
% ncv_keys = keys(nc.VARIABLES);
% d = strmatch('DAYD', ncv_keys);
% for i=1:numel(d)
% tsg.(ncv_keys{d(i)}) = datenumToJulian(tsg.(ncv_keys{d(i)}));
% end
% loop over all global attributes and get associated value in tsg
% loop over all global attributes and get associated value in tsg
% structure
% -----------------------------------------------------------------
for
key
=
keys
(
nc
.
ATTRIBUTES
)
...
...
@@ -385,8 +377,6 @@ end
nc
.
ATTRIBUTES
.
(
att
)
.
data__
=
tsg
.
(
att
);
end
% try
% write netcdf file with and display waibar (boolean)
% ---------------------------------------------------
write
(
nc
,
filename
,
'NC_CLOBBER'
,
true
);
...
...
@@ -394,9 +384,6 @@ end
% Everything OK
% -------------
error
=
1
;
% catch
% error = -1;
% end
end
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment