-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add logging in all cases except print_df #38 * Add log-level to examples and tests * update logger stages --------- Co-authored-by: Martin Rätz <[email protected]>
- Loading branch information
1 parent
283fb93
commit a1f241d
Showing
11 changed files
with
79 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,61 +1,64 @@ | ||
""" | ||
Includes functions to convert units in weather data. | ||
""" | ||
import logging | ||
|
||
import pandas as pd | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
def Jcm2_to_Whm2(radiation: pd.Series): | ||
"""convert radiance unit from J/cm^2 to Wh/m^2""" | ||
radiation = radiation / 0.36 | ||
print(f"{radiation.name} transformed from from J/cm2 to Wh/m2") | ||
logger.debug("%s transformed from from J/cm2 to Wh/m2", radiation.name) | ||
return radiation | ||
|
||
|
||
def Jm2_to_Whm2(radiation: pd.Series): | ||
"""convert radiance unit from J/m^2 to Wh/m^2""" | ||
radiation = radiation / 3600 | ||
print(f"{radiation.name} transformed from from J/m2 to Wh/m2") | ||
logger.debug("%s transformed from from J/m2 to Wh/m2", radiation.name) | ||
return radiation | ||
|
||
|
||
def kJm2_to_Whm2(radiation: pd.Series): | ||
"""convert radiance unit from kJ/m^2 to Wh/m^2""" | ||
radiation = radiation / 3.6 | ||
print(f"{radiation.name} transformed from from kJ/m^2 to Wh/m^2") | ||
logger.debug("%s transformed from from kJ/m^2 to Wh/m^2", radiation.name) | ||
return radiation | ||
|
||
|
||
def hPa_to_Pa(pressure: pd.Series): | ||
"""convert pressure unit from hPa to Pa""" | ||
pressure = pressure * 100 | ||
print(f"{pressure.name} transformed from from hPa to Pa") | ||
logger.debug("%s transformed from from hPa to Pa", pressure.name) | ||
return pressure | ||
|
||
|
||
def eigth_to_tenth(cloudgrade: pd.Series): | ||
"""convert cloudgrade from eighth to tenth""" | ||
cloudgrade = cloudgrade * 10 / 8 | ||
print(f"{cloudgrade.name} transformed from from eighth to tenth") | ||
logger.debug("%s transformed from from eighth to tenth", cloudgrade.name) | ||
return cloudgrade | ||
|
||
|
||
def percent_to_tenth(cloudgrade: pd.Series): | ||
"""convert cloudgrade from percent to tenth""" | ||
cloudgrade = cloudgrade / 10 | ||
print(f"{cloudgrade.name} transformed from from percent to tenth") | ||
logger.debug("%s transformed from from percent to tenth", cloudgrade.name) | ||
return cloudgrade | ||
|
||
|
||
def kelvin_to_celcius(temperature: pd.Series): | ||
"""convert temperature from kelvin to celcius""" | ||
temperature = temperature - 273.15 | ||
print(f"{temperature.name} transformed from from kelvin to celcius") | ||
logger.debug("%s transformed from from kelvin to celcius", temperature.name) | ||
return temperature | ||
|
||
|
||
def divide_by_1000(series: pd.Series): | ||
"""divide by 1000""" | ||
series = series / 1000 | ||
print(f"{series.name} transformed from x to x/1000") | ||
logger.debug("%s transformed from x to x/1000", series.name) | ||
return series |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters