-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCoreWeather.h
58 lines (51 loc) · 1.58 KB
/
CoreWeather.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
//
// CoreWeather.h
// CoreWeather
//
// Created by Patrick Perini on 11/19/12.
// Copyright (c) 2012 pcperini. All rights reserved.
//
#pragma mark - Imports
#import "CWForecast.h"
#import "CWDailyForecast.h"
#import "CWHourlyForecast.h"
#import "CWForecaster.h"
#import "NSDate+CWSeasons.h"
#import "NSString+CWHashing.h"
#import "CLLocation+SunriseSunset.h"
#import "PCHTTP.h"
#pragma mark - Functions
/*!
Returns the fahrenheit temperature for the given celcius temperature.
@param celciusTemperature A temperature in celcius.
@return The fahrenheit temperature for the given celcius temperature.
*/
static CGFloat CWFahrenheitForCelciusTemperature(CGFloat celciusTemperature)
{
return ((celciusTemperature * 9.0) / 5.0) + 32.0;
}
/*!
Returns the celcius temperature for the given fahrenheit temperature.
@param fahrenheitTemperature A temperature in fahrenheit.
@return The celcius temperature for the given fahrenheit temperature.
*/
static CGFloat CWCelciusForFahrenheitTemperature(CGFloat fahrenheitTemperature)
{
return ((fahrenheitTemperature - 32.0) * 5.0) / 9.0;
}
/*!
Returns the km/h speed for the given mps speed.
@param mpsSpeed A speed in mps.
@return The km/h speed for the given mps speed.
*/
static CGFloat CWKPHSpeedForMPSSpeed(CGFloat mpsSpeed) {
return mpsSpeed * (3600.0) * (1.0 / 1000.0);
}
/*!
Returns the mps speed for the given km/h speed.
@param kphSpeed A speed in mps.
@return The mps speed for the given km/h speed.
*/
static CGFloat CWMPSSpeedForKPHSpeed(CGFloat kphSpeed) {
return kphSpeed / (3600.0) / (1.0 / 1000.0);
}