Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
MVCM
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
Container 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
Paolo Veglio
MVCM
Commits
bb6f2daa
Commit
bb6f2daa
authored
1 year ago
by
Paolo Veglio
Browse files
Options
Downloads
Patches
Plain Diff
fixed visible reflectance test
parent
d2857bec
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
mvcm/c_tools/conf_test.c
+127
-0
127 additions, 0 deletions
mvcm/c_tools/conf_test.c
with
127 additions
and
0 deletions
mvcm/c_tools/conf_test.c
0 → 100644
+
127
−
0
View file @
bb6f2daa
/**********************************************************************
Description:
Float function conf_test.c
Computes clear sky confidence value for an individual spectral test.
Input single threshold value ('midpt') with associated confidence
limits ('locut', 'hicut'). "Low" and "high" cutoffs refer to low
or high confidence ends of an interval and not necessarily to
absolute values. Routine calculates the confidence based on an "S"
function. One may change the shape of the function by changing
'power' and/or 'midpt'.
Input arguments:
float val parameter to be tested (BT, BTD, etc.)
float locut low confidence cutoff (< locut = confidence of 0.0)
float hicut high confidence cutoff (> hicut = confidence of 1.0)
float power S function power (1.0 = linear funtion)
float midpt midpoint of S function (= confidence of 0.5)
Output arguments:
none
float confidence output clear sky confidence (0.0 - 1.0)
(returned through function call)
Revision History:
05/2007 R. Frey Converted to C
10/2012 R. Frey Included in MVCCM software
Calls:
none
***********************************************************************/
/* Includes */
#include
<stdio.h>
#include
<math.h>
float
conf_test
(
float
val
,
float
locut
,
float
hicut
,
float
power
,
float
midpt
)
{
/* Declarations */
extern
float
powf
(
float
,
float
);
int
flipped
;
float
confidence
;
float
coeff
;
float
alpha
;
float
gamma
;
float
beta
;
float
range
;
float
s1
;
float
c
;
/* Initializations */
coeff
=
powf
(
2
.
0
,
(
power
-
1
.
0
));
/* Find if high confidence cutoff is the numerically lowest or highest
value. */
if
(
hicut
>
locut
)
{
gamma
=
hicut
;
alpha
=
locut
;
flipped
=
0
;
}
else
{
gamma
=
locut
;
alpha
=
hicut
;
flipped
=
1
;
}
beta
=
midpt
;
/* If value ('val') lies outside function range, confidence is either
0.0 or 1.0. */
if
(
flipped
==
0
&&
val
>
gamma
)
{
c
=
1
.
0
;
}
else
if
(
flipped
==
0
&&
val
<
alpha
)
{
c
=
0
.
0
;
}
else
if
(
flipped
==
1
&&
val
>
gamma
)
{
c
=
0
.
0
;
}
else
if
(
flipped
==
1
&&
val
<
alpha
)
{
c
=
1
.
0
;
}
else
{
/* Otherwise, value ('val') is within the function range and the
confidence is between 0.0 and 1.0. */
if
(
val
<=
beta
)
{
range
=
2
.
0
*
(
beta
-
alpha
);
s1
=
(
val
-
alpha
)
/
range
;
if
(
flipped
==
0
)
c
=
coeff
*
powf
(
s1
,
power
);
if
(
flipped
==
1
)
c
=
1
.
0
-
(
coeff
*
powf
(
s1
,
power
));
}
else
{
range
=
2
.
0
*
(
beta
-
gamma
);
s1
=
(
val
-
gamma
)
/
range
;
if
(
flipped
==
0
)
c
=
1
.
0
-
(
coeff
*
powf
(
s1
,
power
));
if
(
flipped
)
c
=
coeff
*
powf
(
s1
,
power
);
}
}
/* Force confidence values to be between 0 and 1. */
if
(
c
>
1
.
0
)
c
=
1
.
0
;
if
(
c
<
0
.
0
)
c
=
0
.
0
;
confidence
=
c
;
return
confidence
;
}
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