Functions
BiTWeather.read — Functionread(configuration::Configuration,
range::Union{Tuple{Union{Date, Nothing}, Union{Date, Nothing}}, Nothing},
fields::Union{Vector{Symbol}, Nothing})::DataFrameArguments
configuration::BiTWeather.Configuration: ABiTWeather.Configurationproviding the location and structure of the weather data.range::Union{Tuple{Union{Dates.Date, Nothing}, Union{Dates.Date, Nothing}}, Nothing}: The date range of the records to retrieve. A value of nothing for the lower, upper or both date bounds means there is no lower, upper or any date limit respectively. By selecting a date range here, you can do things such limit the records to the dates you need for your downstream processing.fields::Union{Vector{Symbol}, Nothing}: The fields to include from each record. A value of nothing means all fields included inconfigure.fieldMappingswill be included. The:dateTimefield will be included reguardless of the value offields. By providing a list of fields here, you can limit the records to the fields you need for your downstream processing.
Return
- A
DataFrames.DataFramecontaining the requested weather data in SI units stored as Float64 and indexed by year/month/day/hour/minute/second.
Fetches and returns the weather data described by configuration. It assumes the Julia environment is configured so configure.dsn is a DSN that is able to connect to the SQL database containing the weather data and read the table configure.table. It renames the configure.table fields using the configure.fieldMappings. It parses the :dateTime field into separate columns of integers containing the year, month, day, hour, minute and second. All other fields are converted to SI units equivalents and stored as Float64 values. It drops any records with missing field values.
Example
import DataFrames
import BiTWeather
configuration = BiTWeather.Configuration(
dsn = "meteobridge",
table = "backinthirty",
fieldMappings = Dict(
:dateTime => BiTWeather.FieldMapping(name = "DateTime", units = nothing),
:temperature => BiTWeather.FieldMapping(name = "TempOutNow", units = "F")
)
)
weatherData::DataFrames.DataFrame = BiTWeather.read(configuration, nothing, nothing)BiTWeather.chill — Functionchill(::Val{:CumulativeChillHour}, weatherData::DataFrame)::DataFrameImplements the Cumulative Chill Hour model.
Arguments
weatherData::DataFrames.DataFrame: The weather data used for calculating the accumulated chill hours.weatherDatamust be formatted to match the output ofBiTWeather.readand contain at least the :temperature` field.
Return
- A
DataFrames.DataFramecontaining the chill hours indexed by year/month/day/hour. The returned columns are: year, month, day, hour, temperature, $\Delta y(n)$, and $y(n)$.
Example
import DataFrames
import Dates
import BiTWeather
configuration = BiTWeather.Configuration(
dsn = "meteobridge",
table = "backinthirty",
fieldMappings = Dict(
:dateTime => BiTWeather.FieldMapping(name = "DateTime", units = nothing),
:temperature => BiTWeather.FieldMapping(name = "TempOutNow", units = "F")
)
)
year::Int = 2021
rangeStart::Dates.Date = Dates.Date(year - 1, 11, 1)
rangeEnd::Dates.Date = Dates.Date(year, 2, 28)
range::Tuple{Float64, Float64} = (rangeStart, rangeEnd)
fields::Vector{Symbol} = [:temperature]
weatherData::DataFrames.DataFrame = BiTWeather.read(configuration, range, fields)
chillData::DataFrames.DataFrame = BiTWeather.chill(Val(:CumulativeChillHour), weatherData)
println(chillData)chill(::Val{:CumulativeChillUnit}, weatherData::DataFrame)::DataFrameImplements the Cumulative Chill Unit model (also known as the Utah model).
Arguments
weatherData::DataFrames.DataFrame: The weather data used for calculating the cumulative chill units.weatherDatamust be formatted to match the output ofBiTWeather.readand contain at least the:temperaturefield.
Return
- A
DataFrames.DataFramecontaining the chill units indexed by year/month/day/hour. The returned columns are: year, month, temperature, $\Delta y(n)$, and $y(n)$.
Example
import DataFrames
import Dates
import BiTWeather
configuration = BiTWeather.Configuration(
dsn = "meteobridge",
table = "backinthirty",
fieldMappings = Dict(
:dateTime => BiTWeather.FieldMapping(name = "DateTime", units = nothing),
:temperature => BiTWeather.FieldMapping(name = "TempOutNow", units = "F")
)
)
year::Int = 2021
rangeStart::Dates.Date = Dates.Date(year - 1, 11, 1)
rangeEnd::Dates.Date = Dates.Date(year, 2, 28)
range::Tuple{Float64, Float64} = (rangeStart, rangeEnd)
fields::Vector{Symbol} = [:temperature]
weatherData::DataFrames.DataFrame = BiTWeather.read(configuration, range, fields)
chillData::DataFrames.DataFrame = BiTWeather.chill(Val(:CumulativeChillUnit), weatherData)
println(chillData)chill(::Val{:CumulativeChillPortion}, weatherData::DataFrame)::DataFrameImplements the Cumulative Chill Portion model (also known as the Dynamic model).
Arguments
weatherData::DataFrames.DataFrame: The weather data used for calculating the accumulated chill portions.weatherDatamust be formatted to match the output ofBiTWeather.readand contain at least the:temperaturefield.
Return
- A
DataFrames.DataFramecontaining the chill portions indexed by year/month/day/hour. The returned columns are: year, month, day, hour, temperature, $x(n)$, $\Delta y(n)$, and $y(n)$.
Example
import DataFrames
import Dates
import BiTWeather
configuration = BiTWeather.Configuration(
dsn = "meteobridge",
table = "backinthirty",
fieldMappings = Dict(
:dateTime => BiTWeather.FieldMapping(name = "DateTime", units = nothing),
:temperature => BiTWeather.FieldMapping(name = "TempOutNow", units = "F")
)
)
year::Int = 2021
rangeStart::Dates.Date = Dates.Date(year - 1, 9, 1)
rangeEnd::Dates.Date = Dates.Date(year, 2, 28)
range::Tuple{Float64, Float64} = (rangeStart, rangeEnd)
fields::Vector{Symbol} = [:temperature]
weatherData::DataFrames.DataFrame = BiTWeather.read(configuration, range, fields)
chillData::DataFrames.DataFrame = BiTWeather.chill(Val(:CumulativeChillPortion), weatherData)
println(chillData)chill(::Val{:MeanTemperature}, weatherData::DataFrame)::DataFrameImplements the Mean Temperature model.
Arguments
weatherData: ADataFrames.DataFramecontaining the weather data used for estimating the chill units.weatherDatamust be formatted to match the output ofBiTWeather.readand contain at least the:temperaturefield.
Return
- A
DataFrames.DataFramecontaining the chill units indexed by year/month/day/hour. The returned columns are: x and y.
For temperate climates, you want to use data from the coldest month of the year for the calculation. Whereas, for cold climates, you want to use data from the coldest two months of the year.
Example
import DataFrames
import Dates
import BiTWeather
configuration = BiTWeather.Configuration(
dsn = "meteobridge",
table = "backinthirty",
fieldMappings = Dict(
:dateTime => BiTWeather.FieldMapping(name = "DateTime", units = nothing),
:temperature => BiTWeather.FieldMapping(name = "TempOutNow", units = "F")
)
)
year::Int = 2021
rangeStart::Dates.Date = Dates.Date(year, 1, 1)
rangeEnd::Dates.Date = Dates.Date(year, 1, 31)
range::Tuple{Float64, Float64} = (rangeStart, rangeEnd)
fields::Vector{Symbol} = [:temperature]
weatherData::DataFrames.DataFrame = BiTWeather.read(configuration, range, fields)
chillData::DataFrames.DataFrame = BiTWeather.chill(Val(:MeanTemperature), weatherData)
println(chillData)BiTWeather.chillPlot — FunctionchillPlot(::Val{:CumulativeChillHour}, chillData::DataFrame)::PlotlyJS.PlotGenerates a plot of the Cumulative Chill Hour model data.
Arguments
chillData::DataFrames.DataFrame: The chill data used in generating the plot.chillDatamust be formated to match the output ofBiTWeather.chillcalled withVal(:CumulativeChillHour).
Return
- A
PlotlyJS.Plotcontaining a plot of the temperature and chill portion data.
Example
import DataFrames
import Dates
import PlotlyJS
import BiTWeather
configuration = BiTWeather.Configuration(
dsn = "meteobridge",
table = "backinthirty",
fieldMappings = Dict(
:dateTime => BiTWeather.FieldMapping(name = "DateTime", units = nothing),
:temperature => BiTWeather.FieldMapping(name = "TempOutNow", units = "F")
)
)
year::Int = 2021
rangeStart::Dates.Date = Dates.Date(year - 1, 11, 1)
rangeEnd::Dates.Date = Dates.Date(year, 2, 28)
range::Tuple{Float64, Float64} = (rangeStart, rangeEnd)
fields::Vector{Symbol} = [:temperature]
weatherData::DataFrames.DataFrame = BiTWeather.read(configuration, range, fields)
chillData::DataFrames.DataFrame = BiTWeather.chill(Val(:CumulativeChillHour), weatherData)
plot::PlotlyJS.Plot = BiTWeather.chillPlot(Val(:CumulativeChillHour), chillData)
PlotlyJS.display(plot)chillPlot(::Val{:CumulativeChillUnit}, chillData::DataFrame)::PlotlyJS.PlotGenerates a plot of the Cumulative Chill Unit model data.
Arguments
chillData::DataFrames.DataFrame: The chill data used in generating the plot.chillDatamust be formated to match the output ofBiTWeather.chillcalled withVal(:CumulativeChillUnit).
Return
- A
PlotlyJS.Plotcontaining a plot of the temperature and chill portion data.
Example
import DataFrames
import Dates
import PlotlyJS
import BiTWeather
configuration = BiTWeather.Configuration(
dsn = "meteobridge",
table = "backinthirty",
fieldMappings = Dict(
:dateTime => BiTWeather.FieldMapping(name = "DateTime", units = nothing),
:temperature => BiTWeather.FieldMapping(name = "TempOutNow", units = "F")
)
)
year::Int = 2021
rangeStart::Dates.Date = Dates.Date(year - 1, 11, 1)
rangeEnd::Dates.Date = Dates.Date(year, 2, 28)
range::Tuple{Float64, Float64} = (rangeStart, rangeEnd)
fields::Vector{Symbol} = [:temperature]
weatherData::DataFrames.DataFrame = BiTWeather.read(configuration, range, fields)
chillData::DataFrames.DataFrame = BiTWeather.chill(Val(:CumulativeChillUnit), weatherData)
plot::PlotlyJS.Plot = BiTWeather.chillPlot(Val(:CumulativeChillUnit), chillData)
PlotlyJS.display(plot)chillPlot(::Val{:CumulativeChillPortion}, chillData::DataFrame)::PlotlyJS.PlotGenerates a plot of the Cumulative Chill Portion data.
Arguments
chillData::DataFrames.DataFrame: The chill data used in generating the plot.chillDatamust be formated to match the output ofBiTWeather.chillcalled withVal(:CumulativeChillPortion).
Return
- A
PlotlyJS.Plotcontaining a plot of the temperature and chill portion data.
Example
import DataFrames
import Dates
import PlotlyJS
import BiTWeather
configuration = BiTWeather.Configuration(
dsn = "meteobridge",
table = "backinthirty",
fieldMappings = Dict(
:dateTime => BiTWeather.FieldMapping(name = "DateTime", units = nothing),
:temperature => BiTWeather.FieldMapping(name = "TempOutNow", units = "F")
)
)
year::Int = 2021
rangeStart::Dates.Date = Dates.Date(year - 1, 9, 1)
rangeEnd::Dates.Date = Dates.Date(year, 2, 28)
range::Tuple{Float64, Float64} = (rangeStart, rangeEnd)
fields::Vector{Symbol} = [:temperature]
weatherData::DataFrames.DataFrame = BiTWeather.read(configuration, range, fields)
chillData::DataFrames.DataFrame = BiTWeather.chill(Val(:CumulativeChillPortion), weatherData)
plot::PlotlyJS.Plot = BiTWeather.chillPlot(Val(:CumulativeChillPortion), chillData)
PlotlyJS.display(plot)chillPlot(::Val{:MeanTemperature}, chillData::DataFrame)::PlotlyJS.PlotGenerates a plot of the Cumulative Chill Unit model data.
Arguments
chillData::DataFrames.DataFrame: The chill data used in generating the plot.chillDatamust be formated to match the output ofBiTWeather.chillcalled withVal(:MeanTemperature).
Return
- A
PlotlyJS.Plotcontaining a plot of the temperature and chill portion data.
Example
import DataFrames
import Dates
import PlotlyJS
import BiTWeather
configuration = BiTWeather.Configuration(
dsn = "meteobridge",
table = "backinthirty",
fieldMappings = Dict(
:dateTime => BiTWeather.FieldMapping(name = "DateTime", units = nothing),
:temperature => BiTWeather.FieldMapping(name = "TempOutNow", units = "F")
)
)
year::Int = 2021
rangeStart::Dates.Date = Dates.Date(year, 1, 1)
rangeEnd::Dates.Date = Dates.Date(year, 1, 31)
range::Tuple{Float64, Float64} = (rangeStart, rangeEnd)
fields::Vector{Symbol} = [:temperature]
weatherData::DataFrames.DataFrame = BiTWeather.read(configuration, range, fields)
chillData::DataFrames.DataFrame = BiTWeather.chill(Val(:MeanTemperature), weatherData)
plot::PlotlyJS.Plot = BiTWeather.chillPlot(Val(:MeanTemperature), chillData)
PlotlyJS.display(plot)Last Reviewed on 19 February 2021