Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
V
VIPSCommon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
VIPS
VIPSCommon
Commits
fb64fb3d
Commit
fb64fb3d
authored
8 years ago
by
Tor-Einar Skog
Browse files
Options
Downloads
Patches
Plain Diff
Added temp scale conversion methods
parent
f7f039f9
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
src/main/java/no/nibio/vips/util/WeatherUtil.java
+22
-0
22 additions, 0 deletions
src/main/java/no/nibio/vips/util/WeatherUtil.java
src/test/java/no/nibio/vips/util/WeatherUtilTest.java
+12
-0
12 additions, 0 deletions
src/test/java/no/nibio/vips/util/WeatherUtilTest.java
with
34 additions
and
0 deletions
src/main/java/no/nibio/vips/util/WeatherUtil.java
+
22
−
0
View file @
fb64fb3d
...
...
@@ -1519,4 +1519,26 @@ public class WeatherUtil {
// Joule is watts * seconds so average output is hourly joule / 3600 seconds
return
joulePerSquareCentimeter
*
10000
/
3600
;
}
/**
* Convert from Fahrenheit to Celcius
*
* @param fahrenheitTemp
* @return
*/
public
Double
getCelciusFromFahrenheit
(
Double
fahrenheitTemp
)
{
return
(
fahrenheitTemp
-
32
)
/
1.8
;
}
/**
* Convert from Celcius to Fahrenheit
*
* @param celciusTemp
* @return
*/
public
Double
getFahrenheitFromCelcius
(
Double
celciusTemp
)
{
return
(
celciusTemp
*
1.8
)
+
32
;
}
}
This diff is collapsed.
Click to expand it.
src/test/java/no/nibio/vips/util/WeatherUtilTest.java
+
12
−
0
View file @
fb64fb3d
...
...
@@ -647,6 +647,18 @@ public void testGetFirstObservations()
assertEquals
(
cal
.
getTime
(),
last
.
getTimeMeasured
());
}
public
void
testGetFahrenheitFromCelciusAndViceVersa
()
{
System
.
out
.
println
(
"testGetFahrenheitFromCelciusAndViceVersa"
);
WeatherUtil
instance
=
new
WeatherUtil
();
Double
expResult
=
50.0
;
Double
result
=
instance
.
getFahrenheitFromCelcius
(
10.0
);
assertEquals
(
expResult
,
result
);
expResult
=
10.0
;
result
=
instance
.
getCelciusFromFahrenheit
(
instance
.
getFahrenheitFromCelcius
(
10.0
));
assertEquals
(
expResult
,
result
);
}
/**
* Test of normalizeToExactDate method, of class WeatherUtil.
*
...
...
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