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
3d45e06f
Commit
3d45e06f
authored
17 years ago
by
Yves Gouriou
Browse files
Options
Downloads
Patches
Plain Diff
2007-11-27 Y.Gouriou fonction de correction D. Mathias
parent
617aadfe
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tsg_util/dev_corMethod1.m
+52
-39
52 additions, 39 deletions
tsg_util/dev_corMethod1.m
with
52 additions
and
39 deletions
tsg_util/dev_corMethod1.m
+
52
−
39
View file @
3d45e06f
function
[
correction
]
=
dev_corMethod1
(
sample
,
TIME_WINDOWS
)
function
[
tsg
]
=
...
dev_corMethod1
(
tsg
,
sample
,
dateMin
,
dateMax
,
TIME_WINDOWS
)
%
% TO DO
% 1) Test if there are NaN values in 'sample':
% We could get some problem with the computation of the median and std
% 2) Initialisation de la structure 'cor'
%
% *************************************************************************
% The correction is computed between dateMin and dateMax
% ------------------------------------------------------
dt
=
find
(
sample
.
TIME
>=
dateMin
&
sample
.
TIME
<=
dateMax
);
% Calcul des valeurs medianes de correction: achaque point de
% TO DO : Initialisation de la structure 'cor'
% comparaison, on attribue la mediane des corrections dans une fenetre de
% --------------------------------------------
% 10 jours. Puis on interpole entre chaque mediane pour avoir la correction
% a appliquer en chaque point de donnee TSG
% Fenetre de temps = 10 jours pour le calcul des valeurs medianes de
% --------------------------------------------
% correction
for
i
=
1
:
length
(
dt
)
% ------------------------------------------------------------------
COR_mediane
=
[
0
0
];
erreur_mediane
=
[
0
0
];
for
i
=
1
:
length
(
sample
)
is
=
find
(
sample
.
TIME
>
sample
.
TIME
(
i
)
-
TIME_WINDOWS
/
2
&
...
% Find the sample witihin TIME_WINDOWS
sample
.
TIME
<
sample
.
TIME
(
i
)
+
TIME_WINDOWS
/
2
);
% ------------------------------------
ind
=
find
(
sample
.
TIME
(
dt
)
>=
sample
.
TIME
(
dt
(
i
))
-
TIME_WINDOWS
/
2
&
...
sample
.
TIME
(
dt
)
<=
sample
.
TIME
(
dt
(
i
))
+
TIME_WINDOWS
/
2
);
if
~
isempty
(
is
)
% Compute the median difference and error witihn TIME_WINDOWS
COR_mediane
=
[
COR_mediane
;
...
% -----------------------------------------------------------
[
sample
.
TIME
(
i
)
median
(
sample
.
PSAL_DIF
(
is
))]];
if
~
isempty
(
j
)
erreur_mediane
=
[
erreur_mediane
;
...
cor
.
TIME
(
i
)
=
sample
.
TIME
(
i
);
[
std
(
sample
.
PSAL_DIF
(
is
))/
sqrt
(
length
(
is
))
length
(
is
)]];
cor
.
DIFF
(
i
)
=
median
(
sample
.
PSAL_DIF
(
ind
));
cor
.
ERROR
(
i
)
=
std
(
sample
.
PSAL_DIF
(
ind
))/
sqrt
(
length
(
ind
));
cor
.
NVALUE
(
i
)
=
length
(
ind
);
end
end
end
end
% The error is maximum if the median is computed with less than 4 samples
% -----------------------------------------------------------------------
cor
.
ERROR
(
find
(
cor
.
NVALUE
<
4
)
)
=
1
;
COR_mediane
=
COR_mediane
(
2
:
length
(
COR_mediane
),:);
% The correction is applied between dateMin and dateMax
erreur_mediane
=
erreur_mediane
(
2
:
length
(
erreur_mediane
),:);
% We attribute to dateMin the first correction computed
% and to dateMax the last one
erreur_mediane
(
find
(
erreur_mediane
(:,
2
)
<
4
),
1
)
=
1
;
%
% Find the tsg date in the interval dateMin-dateMax
% -------------------------------------------------
dtTsg
=
find
(
tsg
.
TIME
>=
dateMin
&
tsg
.
TIME
<=
dateMax
);
% Complete les series de correction PAS TRES BON
if
cor
.
TIME
(
1
)
~=
dateMin
if
COR_mediane
(
1
,
1
)
~=
tsg
.
TIME
(
1
)
cor
.
TIME
=
[
tsg
.
TIME
(
dtTsg
(
1
))
cor
.
TIME
];
COR_mediane
=
[[
tsg
.
TIME
(
1
)
COR_mediane
(
1
,
2
)];
COR_mediane
];
cor
.
DIFF
=
[
cor
.
DIFF
(
1
)
cor
.
DIFF
];
cor
.
ERROR
=
[
cor
.
ERROR
(
1
)
cor
.
ERROR
];
cor
.
NVALUE
=
[
cor
.
NVALUE
(
1
)
cor
.
NVALUE
];
end
end
if
cor
.
TIME
(
end
)
~=
dateMax
% Pas très bon : La correction ne doit pas être appliquée + de 10 jours
cor
.
TIME
=
[
cor
.
TIME
tsg
.
TIME
(
dtTsg
(
end
))];
% avant ou après le dernier echantillon
cor
.
DIFF
=
[
cor
.
DIFF
cor
.
DIFF
(
end
)];
% --------------------------------------------------------------------
cor
.
ERROR
=
[
cor
.
ERROR
cor
.
ERROR
(
end
)];
if
COR_mediane
(
length
(
COR_mediane
),
1
)
~=
tsg
.
TIME
(
end
)
cor
.
NVALUE
=
[
cor
.
NVALUE
cor
.
NVALUE
(
end
)];
COR_mediane
=
[
COR_mediane
;
...
[
tsg
.
TIME
(
end
)
...
COR_mediane
(
length
(
COR_mediane
),
2
)]];
end
end
% The correction is applied to the TSG between dateMin and dateMax using
COR
=
interp1
(
COR_mediane
(:,
1
),
COR_mediane
(:,
2
),
tsg
.
TIME
);
% a linear interpolation
% ----------------------------------------------------------------------
tsg
.
PSAL_ADJ
(
dtTsg
)
=
tsg
.
PSAL
(
dtTsg
)
+
...
interp1
(
cor
.
TIME
,
cor
.
DIFF
,
tsg
.
TIME
(
dtTsg
));
tsg
.
PSAL_ERR
(
dtTsg
)
=
interp1
(
cor
.
TIME
,
cor
.
ERROR
,
tsg
.
TIME
(
dtTsg
));
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