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
95fd4c5b
Commit
95fd4c5b
authored
17 years ago
by
jacques.grelet_ird.fr
Browse files
Options
Downloads
Patches
Plain Diff
Code simplifié dans readTsgDataNetCDF (structure tsg remplie dynamiquement a la lecture).
parent
78888d20
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tsg_io/readTsgDataNetCDF.m
+47
-129
47 additions, 129 deletions
tsg_io/readTsgDataNetCDF.m
with
47 additions
and
129 deletions
tsg_io/readTsgDataNetCDF.m
+
47
−
129
View file @
95fd4c5b
...
@@ -15,6 +15,10 @@ function [error] = readTsgDataNetCDF( hTsgGUI, filename)
...
@@ -15,6 +15,10 @@ function [error] = readTsgDataNetCDF( hTsgGUI, filename)
%
%
% $Id$
% $Id$
% clear all variables in base workspace
% -------------------------------------
%clear all;
% Get the data from the application GUI
% Get the data from the application GUI
% -------------------------------------
% -------------------------------------
tsg
=
getappdata
(
hTsgGUI
,
'tsg_data'
);
tsg
=
getappdata
(
hTsgGUI
,
'tsg_data'
);
...
@@ -43,137 +47,51 @@ fprintf('...reading %s : ', filename);
...
@@ -43,137 +47,51 @@ fprintf('...reading %s : ', filename);
tsg
.
file
.
name
=
filename
;
tsg
.
file
.
name
=
filename
;
tsg
.
file
.
type
=
'NETCDF'
;
tsg
.
file
.
type
=
'NETCDF'
;
% Read global attributes: meta data
% ----------------------------------
% get global attributes: meta data
tsg
.
PLATFORM_NAME
=
nc
.
PLATFORM_NAME
(:);
% --------------------------------
tsg
.
SHIP_CALL_SIGN
=
nc
.
SHIP_CALL_SIGN
(:);
global_att
=
att
(
nc
);
tsg
.
SHIP_MMSI
=
nc
.
SHIP_MMSI
(:);
tsg
.
TSG_TYPE
=
nc
.
TSG_TYPE
(:);
for
i
=
1
:
length
(
global_att
)
tsg
.
TSG_NUMBER
=
nc
.
TSG_NUMBER
(:);
tsg
.
TINT_TYPE
=
nc
.
TINT_TYPE
(:);
% extract name and value from netcdf globals attributes
tsg
.
TINT_NUMBER
=
nc
.
TINT_NUMBER
(:);
% -----------------------------------------------------
tsg
.
DATA_TYPE
=
nc
.
DATA_TYPE
(:);
attribute
=
name
(
global_att
{
i
});
tsg
.
DATA_MODE
=
nc
.
DATA_MODE
(:);
value
=
global_att
{
i
}(:);
tsg
.
SAMPLING_PERIOD
=
nc
.
SAMPLING_PERIOD
(:);
tsg
.
PROCESSING_STATUS
=
nc
.
PROCESSING_STATUS
(:);
% assign globals attributes in base workspace
tsg
.
DATE_START
=
nc
.
DATE_START
(:);
% -------------------------------------------
tsg
.
DATE_END
=
nc
.
DATE_END
(:);
assignin
(
'base'
,
attribute
,
value
);
tsg
.
SOUTH_LATX
=
nc
.
SOUTH_LATX
(:);
tsg
.
NORTH_LATX
=
nc
.
NORTH_LATX
(:);
% populate tsg structure with globals attributes
tsg
.
WEST_LONX
=
nc
.
WEST_LONX
(:);
% ----------------------------------------------
tsg
.
EAST_LONX
=
nc
.
EAST_LONX
(:);
tsg
.
(
attribute
)
=
value
;
tsg
.
FORMAT_VERSION
=
nc
.
FORMAT_VERSION
(:);
tsg
.
DATE_CREATION
=
nc
.
DATE_CREATION
(:);
tsg
.
DATE_UPDATE
=
nc
.
DATE_UPDATE
(:);
tsg
.
DATA_RESTRICTIONS
=
nc
.
DATA_RESTRICTIONS
(:);
tsg
.
CITATION
=
nc
.
CITATION
(:);
tsg
.
COMMENT
=
nc
.
COMMENT
(:);
tsg
.
PROJECT_NAME
=
nc
.
PROJECT_NAME
(:);
tsg
.
PI_NAME
=
nc
.
PI_NAME
(:);
tsg
.
DATA_CENTRE
=
nc
.
DATA_CENTRE
(:);
tsg
.
DATA_ACQUISITION
=
nc
.
DATA_ACQUISITION
(:);
tsg
.
PROCESSING_CENTRE
=
nc
.
PROCESSING_CENTRE
(:);
tsg
.
PROCESSING_STATE
=
nc
.
PROCESSING_STATE
(:);
% read variables describing TSG installation
% ------------------------------------------
tsg
.
SSJT_DEPH
=
nc
{
'SSJT_DEPH'
}(:);
tsg
.
SSJT_DEPH_MIN
=
nc
{
'SSJT_DEPH_MIN'
}(:);
tsg
.
SSJT_DEPH_MAX
=
nc
{
'SSJT_DEPH_MAX'
}(:);
tsg
.
CNDC_CALCOEF
=
nc
{
'CNDC_CALCOEF'
}(:);
tsg
.
CNDC_LINCOEF
=
nc
{
'CNDC_LINCOEF'
}(:);
tsg
.
SSJT_CALCOEF
=
nc
{
'SSJT_CALCOEF'
}(:);
tsg
.
SSJT_LINCOEF
=
nc
{
'SSJT_LINCOEF'
}(:);
% read variables describing Temperature sensor at intake (TINT) installation
% --------------------------------------------------------------------------
tsg
.
SSTP_DEPH
=
nc
{
'SSTP_DEPH'
}(:);
tsg
.
SSTP_DEPH_MIN
=
nc
{
'SSTP_DEPH_MIN'
}(:);
tsg
.
SSTP_DEPH_MAX
=
nc
{
'SSTP_DEPH_MAX'
}(:);
tsg
.
SSTP_CALCOEF
=
nc
{
'SSTP_CALCOEF'
}(:);
tsg
.
SSTP_LINCOEF
=
nc
{
'SSTP_LINCOEF'
}(:);
% Coordinates
%------------
tsg
.
DATE
=
nc
{
'DATE'
}(:,:);
tsg
.
DAYD
=
nc
{
'DAYD'
}(:);
tsg
.
LATX
=
nc
{
'LATX'
}(:);
tsg
.
LONX
=
nc
{
'LONX'
}(:);
tsg
.
POSITION_QC
=
nc
{
'POSITION_QC'
}(:);
tsg
.
SPDC
=
nc
{
'SPDC'
}(:);
tsg
.
REFERENCE_DATE_TIME
=
nc
{
'REFERENCE_DATE_TIME'
}(:);
% Convert julian day with origin 1950 to Matlab datenum in memory
% ---------------------------------------------------------------
tsg
.
DAYD
=
julianToDatenum
(
tsg
.
DAYD
);
% Variables holding data from the main TSG
% data series 1
%-----------------------------------------
% measured variables
%-----------------------------------------
%if isempty(tsg.PRES)
tsg
.
PRES
=
nc
{
'PRES'
}(:);
%end
%if isempty(tsg.SSJT)
tsg
.
SSJT
=
nc
{
'SSJT'
}(:);
tsg
.
SSJT_STD
=
nc
{
'SSJT_STD'
}(:);
tsg
.
SSJT_STD_CAL
=
nc
{
'TEMP_STD_CAL'
}(:);
%end
%if isempty(tsg.CNDC)
tsg
.
CNDC
=
nc
{
'CNDC'
}(:);
tsg
.
CNDC_STD
=
nc
{
'CNDC_STD'
}(:);
tsg
.
CNDC_CAL
=
nc
{
'CNDC_CAL'
}(:);
%end
% intake temperature variable
%-----------------------------------------
tsg
.
SSTP
=
nc
{
'SSTP'
}(:);
tsg
.
SSTP_QC
=
nc
{
'SSTP_QC'
}(:);
tsg
.
SSTP_CAL
=
nc
{
'SSTP_CAL'
}(:);
tsg
.
SSTP_ADJUSTED
=
nc
{
'SSTP_ADJUSTED'
}(:);
tsg
.
SSTP_ADJUSTED_ERROR
=
nc
{
'SSTP_ADJUSTED_ERROR'
}(:);
tsg
.
SSTP_ADJUSTED_QC
=
nc
{
'SSTP_ADJUSTED_QC'
}(:);
tsg
.
SSTP_ADJUSTED_HIST
=
nc
{
'HIST_SSTP_ADJUSTED'
}(:);
% derived variables
%-----------------------------------------
tsg
.
SSPS
=
nc
{
'SSPS'
}(:);
tsg
.
SSPS_QC
=
nc
{
'SSPS_QC'
}(:);
tsg
.
SSPS_CAL
=
nc
{
'SSPS_CAL'
}(:);
tsg
.
SSPS_ADJUSTED
=
nc
{
'SSPS_ADJUSTED'
}(:);
tsg
.
SSPS_ADJUSTED_ERROR
=
nc
{
'SSPS_ADJUSTED_ERROR'
}(:);
tsg
.
SSPS_ADJUSTED_QC
=
nc
{
'SSPS_ADJUSTED_QC'
}(:);
tsg
.
SSPS_ADJUSTED_HIST
=
nc
{
'HIST_SSPS_ADJUSTED'
}(:);
% data series 2
%-----------------------------------------
% water samples
%-----------------------------------------
tsg
.
DATE_WS
=
nc
{
'DATE_WS'
}(:,:);
tsg
.
DAYD_WS
=
julianToDatenum
(
nc
{
'DAYD_WS'
}(:));
tsg
.
LATX_WS
=
nc
{
'LATX_WS'
}(:);
tsg
.
LONX_WS
=
nc
{
'LONX_WS'
}(:);
tsg
.
SSPS_WS
=
nc
{
'SSPS_WS'
}(:);
tsg
.
SSPS_WS_QC
=
nc
{
'SSPS_WS_QC'
}(:);
tsg
.
SSPS_WS_ANALDATE
=
nc
{
'SSPS_WS_ANALDATE'
}(:,:);
tsg
.
SSPS_WS_BOTTLE
=
nc
{
'SSPS_WS_BOTTLE'
}(:,:);
v
=
var
(
nc
);
for
i
=
1
:
length
(
v
)
assignin
(
'base'
,
char
(
ncnames
(
v
{
i
})),
nc
{
char
(
ncnames
(
v
{
i
}))}(:));
end
end
a
=
att
(
nc
);
% get variables describing TSG installation
for
i
=
1
:
length
(
a
)
% -----------------------------------------
assignin
(
'base'
,
char
(
ncnames
(
a
{
i
})),
nc
{
char
(
ncnames
(
a
{
i
}))}(:));
variables
=
var
(
nc
);
for
i
=
1
:
length
(
variables
)
% extract name and value from netcdf variables
% --------------------------------------------
variable
=
name
(
variables
{
i
});
value
=
variables
{
i
}(:);
% assign netcdf variables in base workspace
% -----------------------------------------
assignin
(
'base'
,
variable
,
value
);
% populate tsg structure with netcdf variables
% --------------------------------------------
tsg
.
(
variable
)
=
value
;
% transforme julian days variables to Matlab datenum
% --------------------------------------------------
if
strmatch
(
'DAYD'
,
variable
)
tsg
.
(
variable
)
=
julianToDatenum
(
tsg
.
(
variable
));
end
end
end
% Save the data in the application GUI
% Save the data in the application GUI
...
...
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