Exemple #1
0
def CELFAH():
    temp = int(input(("Podaj temperaturę w C: ")))
    f = pytemp(temp, 'c', 'f')
    print("Temp w F =", f)
    if f >= 212:
        print("woda wrze")
    elif f <= 32:
        print("woda zamarza")
Exemple #2
0
def celcius_kelvin():
    while True:
        try:
            string = str(
                input("Konwertuję z(wpisz 'kelvin' lub 'fahrenheit'): "))
            amount = int(input("Podaj ile stopni:"))
            if string == 'kelvin':
                f = pytemp(amount, 'k', 'c')
                print(f'{amount} Kelvin to {round(f,2)} Celcius')
                break
            elif string == 'celcius':
                f = pytemp(amount, 'c', 'k')
                print(f'{amount} Celcius to {round(f,2)} Kelvin')
                break
            else:
                print("Kelvin albo Celcius")
        except not (not TypeError and not ValueError):
            print("Trzeba było wpisać stopnie")
def clean_weather_raw(df, start_time, end_time, col_substrings):
    df["Timestamp"] = pd.to_datetime(df["Timestamp"])
    df["Timestamp"] = df["Timestamp"].dt.tz_localize("UTC")  # Add UTC timezone
    df["Timestamp"] = df["Timestamp"].dt.tz_convert(
        "US/Central").dt.tz_localize(None)  # Convert to Central, then drop tz.
    df = df[(df["Timestamp"] >= start_time) & (df["Timestamp"] <= end_time)]

    df = df.filter(regex=col_substrings)

    df["AMBIENT TEMP"] = df["AMBIENT TEMP"].apply(
        lambda t: pytemp(t, "c", "f"))

    return df
Exemple #4
0
def fahrenheit_kelvin():
    while True:
        try:
            string = str(
                input("Konwertuję z(wpisz 'kelvin' lub 'fahrenheit'): "))
            amount = int(input("Podaj ile stopni:"))
            if string == 'kelvin':
                f = pytemp(amount, 'k', 'f')
                print(f'{amount} Kelvin to {round(f,2)} Fahrenheit')
                if f >= 212:
                    print("Woda wrze")
                elif f < 32:
                    print("Woda zamarza")
                break
            elif string == 'fahrenheit':
                f = pytemp(amount, 'f', 'k')
                print(f'{amount} Fahrenheit to {round(f,2)} Kelvin')
                break
            else:
                print("Kelvin albo Fahrenheit")
        except not (not TypeError and not ValueError):
            print("Trzeba było wpisać stopnie")
Exemple #5
0
from pytemp import pytemp

n = int(input('Podaj temperature: '))
fahrenheit = pytemp(n, 'celsius', 'fahrenheit')
print(fahrenheit, 'f')
if fahrenheit == 212:
    print('Woda wrze')
if fahrenheit == 32:
    print('woda zamarza')
Exemple #6
0
def trasforma_valori(valori):
    val = list(valori)
    return pytemp.pytemp(float(val[0]), val[1], val[2])
Exemple #7
0
def KELCEL():
    #Kelvin -> Celcius
    temp = int(input("Podaj temperature w Kelwinach:"))
    k1 = pytemp(temp, 'c', 'k')
    print("Temp w celcujszach: ", k1)
Exemple #8
0
def CELKEL():
    #Celcius -> Kelvin
    temp = int(input("Podaj temperature w Celcjuszach:"))
    c = pytemp(temp, 'k', 'c')
    print("Temp w Kelwinach: ", c)
Exemple #9
0
def FAHKEL():
    #Fahrenheit -> Kelvin
    temp = int(input("Podaj temperature w Fahrenheit:"))
    k = pytemp(temp, 'f', 'k')
    print("Temp w Kewinach:", k)
Exemple #10
0
def KELFAH():
    #Kelvin -> Fahrenheit
    temp = int(input("Podaj temperature w Kelwinach:"))
    f = pytemp(temp, 'k', 'f')
    print("Temp w F =", f)
Exemple #11
0
def convert(uri):
    return pytemp.pytemp(float(uri[1]), uri[2], uri[3])
Exemple #12
0
from pytemp import pytemp
inp_cel = int(input("Celcius: "))
f = pytemp(inp_cel, 'c', 'f')
if f >= 212:
    print("Woda wrze")
elif f < 32:
    print("Woda zamarza")
else:
    print("cool")

#Kelvin -> Fahrenheit
f = pytemp(40,'k', 'f')
#Fahrenheit -> Kelvin
k = pytemp(f,'f','k')
#Celcius -> Kelvin
c = pytemp(40,'k', 'c')
#Kelvin -> Celcius
k1 = pytemp(c,'c','k')
Exemple #13
0
from pytemp import pytemp
temp = int(input(("Podaj temperaturę w C: ")))
f = pytemp(temp, 'c', 'f')
print("Temp w F =", f)
if f >= 212:
    print("woda wrze")
elif f <= 32:
    print("woda zamarza")
#Kelvin -> Fahrenheit
f = pytemp(40, 'k', 'f')
#Fahrenheit -> Kelvin
k = pytemp(f, 'f', 'k')
#Celcius -> Kelvin
c = pytemp(40, 'k', 'c')
#Kelvin -> Celcius
k1 = pytemp(c, 'c', 'k')
Exemple #14
0
def convert(original_list, oU, tU):
    list = []
    for num in original_list:
        list.append(round(pytemp.pytemp(int(num), oU.lower(), tU.lower()), 2))
    return list
    def updateGUI(self, weatherData, zipcode):
        from pytemp import pytemp
        
        descrptMain = weatherData['weather'][0]['main'] #main description (hot, clear, cloudy, sunny, etc.)

        #*temp, highs, lows, humidity
        realKelvinTemp = weatherData['main']['temp'] #get temperature in K
        realTempF = int(pytemp(realKelvinTemp, 'kelvin', 'fahrenheit')) #convert K temperature to temperature in F
        feelsLikeKelvin = weatherData['main']['feels_like'] #same as above, but for heat index 
        feelsLike = int(pytemp(feelsLikeKelvin, 'kelvin', 'fahrenheit'))

        humid = weatherData['main']['humidity']

        hiTempKelvin = weatherData['main']['temp_max']
        hiTempF = int(pytemp(hiTempKelvin, 'kelvin', 'fahrenheit'))
        
        loTempKelvin = weatherData['main']['temp_min']
        loTempF = int(pytemp(loTempKelvin, 'kelvin', 'fahrenheit'))

        self.tempLabel.setText(str(realTempF)+'°')
        self.tempLabel.repaint()
        self.tempLabel.setGeometry(QtCore.QRect(245, 70, 241, 121)) #250 default

        self.conditionLabel.setText(descrptMain)
        self.conditionLabel.repaint()
        self.feelsLikeTemp.setText(str(feelsLike)+'°')
        self.feelsLikeTemp.repaint()
        self.tempHiNum.setText(str(hiTempF)+ '°')
        self.tempHiNum.repaint()
        self.tempLoNum.setText(str(loTempF)+'°')
        self.tempLoNum.repaint()
        self.humidityNumLabel.setText(str(humid) + '%')
        self.humidityLabel.repaint()
        
        self.visNumLabel.setText(str(int(weatherData['visibility']*0.00062137)) + ' mi')
        self.visNumLabel.repaint()

        #*sunrise/sunset time 
        
        utc = pytz.utc
        timezone = self.getZone(zipcode) 
      
        self.sunriseTimeUnix = weatherData['sys']['sunrise']
        self.sunriseReadTime = utc.localize(datetime.utcfromtimestamp(self.sunriseTimeUnix)) #use localize for dealing with timezones
        self.sunriseWithTimezone = self.sunriseReadTime.astimezone(timezone)
        self.sunriseTimeHuman = self.sunriseWithTimezone.strftime("%-I:%M") #only print out hour:minute in 12 hour format
        
        self.sunsetTimeUnix = weatherData['sys']['sunset']
        self.sunsetReadTime = utc.localize(datetime.utcfromtimestamp(self.sunsetTimeUnix))
        self.sunsetWithTimezone = self.sunsetReadTime.astimezone(timezone)
        self.sunsetTimeHuman = self.sunsetWithTimezone.strftime("%-I:%M")
       
        
        self.sunriseNumLabel.setText(self.sunriseTimeHuman + ' am')  
        self.sunriseNumLabel.repaint()
        self.sunsetNumLabel.setText(self.sunsetTimeHuman + ' pm')
        self.sunsetNumLabel.repaint()

        #*update weather Icon
        iconID = weatherData['weather'][0]['icon']
        iconFilename = iconID + '.png'

        im = QPixmap("FILE PATH HERE/weather_icons/%s" % iconFilename) #display the corresponding weather icon (provide full file path)
        self.iconLabel.setPixmap(im)
        self.iconLabel.repaint()

        #* update locationLabel (city, state)
        z = ZipCodeDatabase() 
        code = z[zipcode]

        city = weatherData['name']
        state = code.state

        #below: open the "city, state" locationLabel in google maps to see where it is 
        self.locationLabel.setText('<a href=https://www.google.com/maps/place/%s>(%s, %s)</a>' % (zipcode, city, state))
        self.locationLabel.setOpenExternalLinks(True)
        self.locationLabel.setToolTip("See %s, %s in Google Maps" % (city, state))