climate 和 weather的区别

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了climate 和 weather的区别相关的知识,希望对你有一定的参考价值。

climate (气候)指一个地方长期的较为固定的气候状态,包括阴晴、干湿、风雨等情况在内;而 weather(天气)则指某特定日子的天气情况。

1. climate的用例
He wants to move to a warmer climate.
他想搬到一个气候较温暖的地方去住。
Orange trees won’t grow in this climate.
在这样气候橘子树不能生长。
I can’t (couldn’t) imagine what it would be like to live in a hot climate.
我无法想像住在热带会怎么样。

2. weather的用例
We have fine weather today.
今天天气很好。
I hope the weather would be favourable.
我希望天气能变得有利。
The weather is horrible today.
今天天气糟糕极了。
Take warm clothes in case the weather is cold.
带些暖和衣裳以防天气转凉。
Weather permitting (= If the weather permits),we’ll have an outing tomorrow.
如果天气允许我们明天将出去郊游。
The weather forecast is for probable showers.
天气预报说可能有阵雨。
参考技术A weather和climate

weather 意为“天气”,为不可数名词,不能在前面加不定冠词,如我们只能说in such fine weather , 而不能说in such a fine weather。如:

The weather has changed. 天气变了。

【注意】weather前虽不可加不定冠词,但在表示“各种各样的天气”,或“不论哪种天气”时,weather用复数。如:

She goes out in all weathers.

weather 指某特定地区在一定时间的气象情况。

climate 指一般比较长的时间,如一季的天气状况。

A drier climate would be good for her health.气候干燥的地区会对他的健康有益。本回答被提问者采纳
参考技术B weather和climate

weather 意为“天气”,为不可数名词,不能在前面加不定冠词,如我们只能说in such fine weather , 而不能说in such a fine weather。如:

The weather has changed. 天气变了。

【注意】weather前虽不可加不定冠词,但在表示“各种各样的天气”,或“不论哪种天气”时,weather用复数。如:

She goes out in all weathers.

weather 指某特定地区在一定时间的气象情况。

climate 指一般比较长的时间,如一季的天气状况。

A drier climate would be good for her health.气候干燥的地区会对他的健康有益。
参考技术C climate 是指大范围的气象,而 weather是指小范围,局部的天气情况. 参考技术D climate (气候)指一个地方长期的较为固定的气候状态,包括阴晴、干湿、风雨等情况在内;而weather(天气)则指某特定日子的天气情况。

1. climate的用例

He wants to move to a warmer climate.
他想搬到一个气候较温暖的地方去住。

Orange trees won’t grow in this climate.
在这样气候橘子树不能生长。

I can’t (couldn’t) imagine what it would be like to live in a hot climate.
我无法想像住在热带会怎么样。

2. weather的用例
We have fine weather today.
climate (气候)指一个地方长期的较为固定的气候状态,包括阴晴、干湿、风雨等情况在内;而weather(天气)则指某特定日子的天气情况。

1. climate的用例

He wants to move to a warmer climate.
他想搬到一个气候较温暖的地方去住。

Orange trees won’t grow in this climate.
在这样气候橘子树不能生长。

I can’t (couldn’t) imagine what it would be like to live in a hot climate.
我无法想像住在热带会怎么样。

2. weather的用例
We have fine weather today.

CLLocation + Weather(Alamofire) 问题

【中文标题】CLLocation + Weather(Alamofire) 问题【英文标题】:CLLocation + Weather(Alamofire) issues 【发布时间】:2017-03-19 23:56:12 【问题描述】:

我正在尝试使用 CLLocation 来捕获经度和纬度,然后使用 Alamofire 中的经度和纬度来获取天气。每次,经纬度都不会停止更新,天气数据也不会打印(如果你想查看这里的数据示例链接:http://forecast.weather.gov/MapClick.php?lat=37.33233141&lon=-122.0312186&FcstType=json)

class SampleViewController: UIViewController, CLLocationManagerDelegate 
var locationManager:CLLocationManager!
var startLocation: CLLocation!
var isFetchingWeather = false

override func viewDidLoad() 
    super.viewDidLoad()
    locationManager = CLLocationManager()
    locationManager.delegate = self
    locationManager.desiredAccuracy = kCLLocationAccuracyBest
    locationManager.requestAlwaysAuthorization()
   

     override func viewDidAppear(_ animated: Bool) 
            getCurrentLocation()
     
   func getCurrentLocation()
    if CLLocationManager.locationServicesEnabled()
        locationManager.startUpdatingLocation()

    


     func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) 
        var userLocation:CLLocation = locations[0]
        if isFetchingWeather != false
    print("user latitude = \(userLocation.coordinate.latitude)")
    print("user longitude = \(userLocation.coordinate.longitude)")
    let requestLink = "http://forecast.weather.gov/MapClick.php?lat=\(userLocation.coordinate.latitude)&lon=\(userLocation.coordinate.longitude)&FcstType=json"
    print(requestLink)
    Alamofire.request(requestLink).validate().responseJSON
         response in
            switch response.result 
            case .success(let data):
                let json = JSON(data)
                self.weatherData = json["data"].arrayValue
                    for weather in self.weatherData
                    let temp = weather["weather"].stringValue
                       self.weatherString.append(temp)
                
                print (self.weatherString)
                if self.startLocation == nil 
                    self.startLocation = userLocation as! CLLocation
                    self.locationManager.stopUpdatingLocation()
                


            case .failure(let error):
                print(error)
            
    
        
        else
            print("is fetching weather is false")
        




func locationManager(_ manager: CLLocationManager, didFailWithError error: Error)

    print("Error \(error)")


谢谢。

【问题讨论】:

【参考方案1】:

你真的不应该在你的位置委托中运行你的天气请求。相反,在 didUpdateLocations 委托中获取您的位置并将其保存到 var。接下来,调用stopUpdatingLocation(),然后调用一个单独的函数来发出你的天气请求。像这样的:

func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) 

    let newLocation = locations.last

//check accuracy and timestamp of location to make sure its not a cached/old location (if you don't care about accuracy or time, you can remove this check)
    let timeDiff = newLocation?.timestamp.timeIntervalSinceNow

    if timeDiff < 5.0 && (newLocation?.horizontalAccuracy)!<=self.accuracyNeeded

        //stop updating location
        self.locationManager.stopUpdatingLocation()

        //set currentUserLocation
        self.myLocation=newLocation?.coordinate


        //call function to get weather

        //remove delegate
        self.locationManager.delegate = nil

    


【讨论】:

感谢+1!几乎一切正常——即使是经度和纬度的链接也在打印,但 alamofire 本身什么也没返回...... @rmp 该位置是否可能没有天气数据?还是您遇到错误?【参考方案2】:

设置一个标志以指示您何时开始获取天气信息,如果设置了该标志,则不要调用 Alamofire 来获取天气信息。例如,您可以在声明 startLocation 的行之后声明类似的内容:

var isFetchingWeather = false

然后,在locationManagerdidUpdateLocations 首先检查isFetchingWeather 是否为假。如果没有,请返回。否则,获取天气信息。

func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) 
    if isFetchingWeather 
        return
    
    isFetchingWeather = true
    // Do the actual weather fetching

当然,您可能希望在获得一些位置更新后实际获取天气,因为最初的位置可能不那么准确:)

【讨论】:

我试过了,并且在 else 部分的 if 语句中,我打印了一个说明它是错误的。我运行了应用程序,控制台不停地打印打印。 @法希姆 您第一次执行提取时是否将isFetchingWeather 设置为true?您能否提供一个代码示例,以便我可以看到您在做什么?不看就知道你的代码是如何执行的有点困难:) 是的——抱歉花了这么长时间。不,我没有。让我用我运行 @Fahim 的代码更新我的问题中的代码。 在您更新的代码中,您似乎仅在 isFetchingWeather 不是 false 时才获取天气信息 - 这意味着您必须获取天气才能再次获取天气信息 :) 这不是它应该如何工作的.请参阅上面我的答案中的更新代码,了解您应该如何设置它。

以上是关于climate 和 weather的区别的主要内容,如果未能解决你的问题,请参考以下文章